{"json_modified": "2016-05-18T04:14:00.518585", "uuid": "4efa7c87-72ce-47fc-9baa-f5f2a4a52b3d", "title": "Downloading JSON and JavaScript in extensions", "url": "/en-US/docs/Downloading_JSON_and_JavaScript_in_extensions", "tags": ["AJAX", "Extensions", "Add-ons", "XMLHttpRequest", "JSON"], "translations": [{"uuid": "29c47b6e-d7af-44ca-8841-650eb06a3c63", "title": "T\u00e9l\u00e9charger du JSON et du JavaScript dans une extension", "url": "/fr/docs/T%C3%A9l%C3%A9charger_du_JSON_et_du_JavaScript_dans_une_extension", "tags": ["AJAX", "Extensions"], "summary": "Une pratique courante utilis\u00e9e par de nombreuses extensions est d'utiliser XMLHttpRequest ou un m\u00e9canisme similaire pour charger du code JavaScript ou des donn\u00e9es au format JSON depuis un site distant. Le contenu r\u00e9cup\u00e9r\u00e9 est ensuite interpr\u00e9t\u00e9 avec la fonction eval()
. Cette pratique est dangereuse, et une extension qui l'utiliserait ne pourrait pas franchir l'\u00e9tape de la revue de code pour \u00eatre h\u00e9berg\u00e9e sur le site AMO", "localization_tags": [], "locale": "fr", "last_edit": "2014-05-22T10:44:09", "review_tags": []}, {"uuid": "5290b1cb-6f78-4f20-ac90-e725866b4545", "title": "\u5728\u6269\u5c55\u4e2d\u4e0b\u8f7dJSON\u548cJavaScript", "url": "/zh-CN/docs/Downloading_JSON_and_JavaScript_in_extensions", "tags": ["Extensions"], "summary": "
\n\u5728\u5f88\u591a\u6269\u5c55\u4e2d\u5e38\u89c1\u7684\u7528\u6cd5\u662f\u4f7f\u7528XMLHttpRequest\uff08\u6216\u8005\u5176\u4ed6\u673a\u5236\uff09\u4ece\u4e00\u4e2a\u8fdc\u7a0b\u7684\u7f51\u7ad9\u4e0b\u8f7d JavaScript \u6216\u8005JSON\uff08\u8fd9\u4e24\u8005\u662f\u4e0d\u540c\u7684\uff01\uff09\u4e00\u65e6\u5185\u5bb9\u4e0b\u8f7d\u5b8c\u6210\uff0c\u6269\u5c55\u7684\u4f5c\u8005\u5c31\u4f1a\u4f7f\u7528 eval()
\u7ee7\u7eed\u8fdb\u884c\u89e3\u7801\u7684\u5de5\u4f5c\uff0c\u628a\u5b57\u4e32\u5185\u5bb9\u8f6c\u6362\u6210 JavaScript \u5bf9\u8c61\u3002\u8fd9\u6837\u7684\u505a\u6cd5\u662f\u975e\u5e38\u5371\u9669\u7684\uff0c\u5e76\u4e14\uff0c\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u901a\u8fc7AMO\u7684\u5ba1\u6838\u3002\u6240\u4ee5\u8fd9\u6837\u7684\u6269\u5c55\u5c06\u4e0d\u4f1a\u88ab\u5141\u8bb8\u79bb\u5f00AMO\u7684\u7802\u7bb1\u3002", "localization_tags": [], "locale": "zh-CN", "last_edit": "2008-06-29T03:10:46", "review_tags": []}], "modified": "2014-03-27T10:07:15", "label": "Downloading JSON and JavaScript in extensions", "localization_tags": [], "locale": "en-US", "id": 33482, "last_edit": "2008-06-29T02:17:44", "summary": "A common practice found in many extensions is using XMLHttpRequest (or some other mechanism) to download JavaScript or JSON (they are different) from a remote website. Once the content has been downloaded, the extension authors proceed to use eval()
to decode the string content into JavaScript objects. This practice is dangerous and will not, in fact, pass an AMO review. So the extension will not be allowed to move out of the AMO sandbox.", "sections": [{"id": "Downloading_JSON", "title": " Downloading JSON "}, {"id": "Downloading_JavaScript", "title": "Downloading JavaScript"}], "slug": "Downloading_JSON_and_JavaScript_in_extensions", "review_tags": []}