Skip to content

Commit 3d9e8e5

Browse files
authored
Add webextensions.manifest.content scripts.world (#32084)
* Add webextensions.manifest.content_scripts.world * Tweak
1 parent 7b27644 commit 3d9e8e5

File tree

2 files changed

+36
-4
lines changed
  • files/en-us/mozilla/add-ons/webextensions

2 files changed

+36
-4
lines changed

files/en-us/mozilla/add-ons/webextensions/api/scripting/executionworld/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ Values of this type are strings. Possible values are:
1616

1717
- `ISOLATED`
1818

19-
The default execution environment of [content scripts](/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts).
19+
The default [content scripts](/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts) execution environment.
2020
This environment is isolated from the page's context: while they share the same document, the global scopes and available APIs differ.
2121

2222
- `MAIN`
2323

24-
The execution environment of the web page. This environment is shared with the web page, without isolation.
24+
The web page execution environment. This environment is shared with the web page without isolation.
2525
Scripts in this environment do not have any access to APIs that are only available to content scripts.
2626

27-
> **Warning:** Due to the lack of isolation, the web page can detect the executed code and interfere with it.
27+
> **Warning:** Due to the lack of isolation, the web page can detect and interfere with the executed code.
2828
> Do not use the `MAIN` world unless it is acceptable for web pages to read, access, or modify the logic or data that flows through the executed code.
29-
> `MAIN` is not supported in Firefox (although it is planned and the work to introduce it is tracked by [Bug 1736575](https://bugzil.la/1736575)). In the meantime, JavaScript code running in the isolated content script sandbox can use the Firefox "Xray vision" feature, as described in [Share objects with page scripts](/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts).
29+
> `MAIN` is not supported in Firefox (although it is planned, and the work to introduce it is tracked by [Bug 1736575](https://bugzil.la/1736575)). In the meantime, JavaScript code running in the isolated content script sandbox can use the Firefox "Xray vision" feature, as described in [Share objects with page scripts](/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts).
3030
3131
## Browser compatibility
3232

files/en-us/mozilla/add-ons/webextensions/manifest.json/content_scripts/index.md

+32
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,38 @@ Details of all the keys you can include are given in the table below.
281281
</p>
282282
</td>
283283
</tr>
284+
<tr>
285+
<td>
286+
<a id="run_at"><code>world</code></a>
287+
</td>
288+
<td><code>String</code></td>
289+
<td>
290+
<p>
291+
The JavaScript world the script executes in.
292+
</p>
293+
<dl>
294+
<dt><code>"ISOLATED"</code></dt>
295+
<dd>
296+
The default <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts">content scripts</a> execution environment.
297+
This environment is isolated from the page's context: while they share the same document, the global scopes and available APIs differ.
298+
</dd>
299+
<dt><code>"MAIN"</code></dt>
300+
<dd>
301+
The web page's execution environment.
302+
This environment is shared with the web page without isolation.
303+
Scripts in this environment don't have any access to the APIs that are only available to content scripts.
304+
<div class="notecard warning" id="sect1">
305+
<p>
306+
<strong>Warning:</strong> Due to the lack of isolation, the web page can detect and interfere with the executed code.
307+
Do not use the <code>MAIN</code> world unless it is acceptable for web pages to read, access, or modify the logic or data that flows through the executed code.
308+
<code>worid</code>, and therefore <code>"MAIN"</code>, is not supported in Firefox (although it is planned, and the work to introduce it is tracked by <a href="https://bugzil.la/1736575" class="external" target="_blank">Bug 1736575</a>). In the meantime, JavaScript code running in the isolated content script sandbox can use the Firefox "Xray vision" feature, as described in <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts">Share objects with page scripts</a>.
309+
</p>
310+
</div>
311+
</dd>
312+
</dl>
313+
<p>The default value is <code>"ISOLATED"</code>.</p>
314+
</td>
315+
</tr>
284316
</tbody>
285317
</table>
286318

0 commit comments

Comments
 (0)