OLD | NEW |
1 <div id="pageData-name" class="pageData">Formats: Manifest Files</div> | 1 <div id="pageData-name" class="pageData">Formats: Manifest Files</div> |
2 <div id="pageData-showTOC" class="pageData">true</div> | 2 <div id="pageData-showTOC" class="pageData">true</div> |
3 | 3 |
4 <p> | 4 <p> |
5 Every extension, installable web app, and theme has a | 5 Every extension, installable web app, and theme has a |
6 <a href="http://www.json.org">JSON</a>-formatted manifest file, | 6 <a href="http://www.json.org">JSON</a>-formatted manifest file, |
7 named <code>manifest.json</code>, | 7 named <code>manifest.json</code>, |
8 that provides important information. | 8 that provides important information. |
9 </p> | 9 </p> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 <em>// Pick one (or none)</em> | 32 <em>// Pick one (or none)</em> |
33 "<a href="browserAction.html">browser_action</a>": {...}, | 33 "<a href="browserAction.html">browser_action</a>": {...}, |
34 "<a href="pageAction.html">page_action</a>": {...}, | 34 "<a href="pageAction.html">page_action</a>": {...}, |
35 "<a href="themes.html">theme</a>": {...}, | 35 "<a href="themes.html">theme</a>": {...}, |
36 "<a href="#app">app</a>": {...}, | 36 "<a href="#app">app</a>": {...}, |
37 | 37 |
38 <em>// Add any of these that you need</em> | 38 <em>// Add any of these that you need</em> |
39 "<a href="background_pages.html">background</a>": {...}, | 39 "<a href="background_pages.html">background</a>": {...}, |
40 "<a href="override.html">chrome_url_overrides</a>": {...}, | 40 "<a href="override.html">chrome_url_overrides</a>": {...}, |
41 "<a href="content_scripts.html">content_scripts</a>": [...], | 41 "<a href="content_scripts.html">content_scripts</a>": [...], |
42 "<a href="contentSecurityPolicy.html">content_security_policy</a>": "<em>polic
yString</em>", | 42 "<a href="../extensions/contentSecurityPolicy.html">content_security_policy</a
>": "<em>policyString</em>", |
43 "<a href="fileBrowserHandler.html">file_browser_handlers</a>": [...], | 43 "<a href="fileBrowserHandler.html">file_browser_handlers</a>": [...], |
44 "<a href="#homepage_url">homepage_url</a>": "http://<em>path/to/homepage</em>"
, | 44 "<a href="#homepage_url">homepage_url</a>": "http://<em>path/to/homepage</em>"
, |
45 "<a href="#incognito">incognito</a>": "spanning" <em>or</em> "split", | 45 "<a href="#incognito">incognito</a>": "spanning" <em>or</em> "split", |
46 "<a href="#intents">intents</a>": {...} | 46 "<a href="#intents">intents</a>": {...} |
47 "<a href="#key">key</a>": "<em>publicKey</em>", | 47 "<a href="#key">key</a>": "<em>publicKey</em>", |
48 "<a href="#minimum_chrome_version">minimum_chrome_version</a>": "<em>versionSt
ring</em>", | 48 "<a href="#minimum_chrome_version">minimum_chrome_version</a>": "<em>versionSt
ring</em>", |
49 | 49 |
50 "<a href="#nacl_modules">nacl_modules</a>": [...], | 50 "<a href="#nacl_modules">nacl_modules</a>": [...], |
51 "<a href="#offline_enabled">offline_enabled</a>": true, | 51 "<a href="#offline_enabled">offline_enabled</a>": true, |
52 "<a href="omnibox.html">omnibox</a>": { "keyword": "<em>aString</em>" }, | 52 "<a href="omnibox.html">omnibox</a>": { "keyword": "<em>aString</em>" }, |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 <p> | 840 <p> |
841 Defines an collection of app or extension pages that are to be served | 841 Defines an collection of app or extension pages that are to be served |
842 in a sandboxed unique origin, and optionally a Content Security Policy to use | 842 in a sandboxed unique origin, and optionally a Content Security Policy to use |
843 with them. Being in a sandbox has two implications: | 843 with them. Being in a sandbox has two implications: |
844 </p> | 844 </p> |
845 | 845 |
846 <ol> | 846 <ol> |
847 <li>A sandboxed page will not have access to extension or app APIs, or | 847 <li>A sandboxed page will not have access to extension or app APIs, or |
848 direct access to non-sandboxed pages (it may communicate with them via | 848 direct access to non-sandboxed pages (it may communicate with them via |
849 <code>postMessage()</code>).</li> | 849 <code>postMessage()</code>).</li> |
850 <li>A sandboxed page is not subject to the | 850 <li> |
851 <a href="contentSecurityPolicy.html">Content Security Policy (CSP)</a> used | 851 <p>A sandboxed page is not subject to the |
852 by the rest of the app or extension (it has its own separate CSP value). This | 852 <a href="../extensions/contentSecurityPolicy.html">Content Security Policy |
853 means that, for example, it can use inline script and <code>eval</code>.</li> | 853 (CSP)</a> used by the rest of the app or extension (it has its own separate |
854 </ol> | 854 CSP value). This means that, for example, it can use inline script and |
| 855 <code>eval</code>.</p> |
855 | 856 |
856 <p>For example, here's how to specify that two extension pages are to be served | 857 <p>For example, here's how to specify that two extension pages are to be |
857 in a sandbox with a custom CSP:</p> | 858 served in a sandbox with a custom CSP:</p> |
858 | 859 |
859 <pre>{ | 860 <pre>{ |
860 ... | 861 ... |
861 "sandbox": { | 862 "sandbox": { |
862 "pages": [ | 863 "pages": [ |
863 "page1.html", | 864 "page1.html", |
864 "directory/page2.html" | 865 "directory/page2.html" |
865 ] | 866 ] |
866 <i>// content_security_policy is optional.</i> | 867 <i>// content_security_policy is optional.</i> |
867 "content_security_policy": | 868 "content_security_policy": |
868 "sandbox allow-scripts; script-src https://www.google.com" | 869 "sandbox allow-scripts; script-src https://www.google.com" |
869 ], | 870 ], |
870 ... | 871 ... |
871 }</pre> | 872 }</pre> |
872 | 873 |
873 <p> | 874 <p> |
874 If not specified, the default <code>content_security_policy</code> value is | 875 If not specified, the default <code>content_security_policy</code> value is |
875 <code>sandbox allow-scripts allow-forms</code>. You can specify your CSP | 876 <code>sandbox allow-scripts allow-forms</code>. You can specify your CSP |
876 value to restrict the sandbox even further, but it must have the <code>sandbox</
code> | 877 value to restrict the sandbox even further, but it must have the <code>sandbox
</code> |
877 directive and may not have the <code>allow-same-origin</code> token (see | 878 directive and may not have the <code>allow-same-origin</code> token (see |
878 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-
element.html#attr-iframe-sandbox">the | 879 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-ifram
e-element.html#attr-iframe-sandbox">the |
879 HTML5 specification</a> for possible sandbox tokens). | 880 HTML5 specification</a> for possible sandbox tokens). |
880 </p> | 881 </p> |
| 882 </li> |
| 883 </ol> |
881 | 884 |
882 <p> | 885 <p> |
883 Note that you only need to list pages that you expected to be loaded in | 886 Note that you only need to list pages that you expected to be loaded in |
884 windows or frames. Resources used by sandboxed pages (e.g. stylesheets or | 887 windows or frames. Resources used by sandboxed pages (e.g. stylesheets or |
885 JavaScript source files) do not need to appear in the | 888 JavaScript source files) do not need to appear in the |
886 <code>sandboxed_page</code> list, they will use the sandbox of the page | 889 <code>sandboxed_page</code> list, they will use the sandbox of the page |
887 that embeds them. | 890 that embeds them. |
888 </p> | 891 </p> |
889 | 892 |
890 <p> | 893 <p> |
| 894 <a href="sandboxingEval.html">"Using eval in Chrome Extensions. Safely."</a> |
| 895 goes into more detail about implementing a sandboxing workflow that enables use |
| 896 of libraries that would otherwise have issues executing under extension's |
| 897 <a href="../extensions/contentSecurityPolicy.html">default Content Security |
| 898 Policy</a>. |
| 899 </p> |
| 900 |
| 901 <p> |
891 Sandboxed page may only be specified when using | 902 Sandboxed page may only be specified when using |
892 <a href="#manifest_version"><code>manifest_version</code></a> 2 or above. | 903 <a href="#manifest_version"><code>manifest_version</code></a> 2 or above. |
893 </p> | 904 </p> |
OLD | NEW |