Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To use this API, you need the `userScripts` permission and [`host_permissions`](

## Execution worlds

When a user script is registered or updated (using {{WebExtAPIRef("userScripts.register()")}} or {{WebExtAPIRef("userScripts.update()")}}), your extension can set it to run in an isolated `USER_SCRIPT` world or the `MAIN` world.
When a user script is registered, updated, or executed (using {{WebExtAPIRef("userScripts.register()")}}, {{WebExtAPIRef("userScripts.update()")}}, and {{WebExtAPIRef("userScripts.execute()")}} respectively), your extension can set it to run in an isolated `USER_SCRIPT` world or the `MAIN` world.

A `USER_SCRIPT` world provides an isolated execution environment that isn't accessible to a host page or other extensions. This isolation is similar to a [content script environment](/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#content_script_environment), except `USER_SCRIPT` worlds cannot access extension APIs.

Expand Down Expand Up @@ -51,14 +51,13 @@ When an extension updates, user scripts are cleared. To restore scripts, add cod
## Types

- {{WebExtAPIRef("userScripts.ExecutionWorld")}}
- : The execution environment for a script injected with {{WebExtAPIRef("userScripts.register()")}}
or {{WebExtAPIRef("userScripts.update()")}}.
- : The execution environment for a script injected with {{WebExtAPIRef("userScripts.,"execute()", "execute()"}}, {{WebExtAPIRef("userScripts.register()", "register()")}}, or {{WebExtAPIRef("userScripts.update()", "update()")}}.
- {{WebExtAPIRef("userScripts.RegisteredUserScript")}}
- : An `object` returned by {{WebExtAPIRef("userScripts.getScripts","getScripts()")}} representing registered user scripts and used as input to {{WebExtAPIRef("userScripts.register","register()")}} and {{WebExtAPIRef("userScripts.update","update()")}}.
- {{WebExtAPIRef("userScripts.ScriptSource")}}
- : The code or a file source for a user script.
- : The code or a file source for a user script used in {{WebExtAPIRef("userScripts.execute()", "execute()")}} and {{WebExtAPIRef("userScripts.RegisteredUserScript","RegisteredUserScript")}} .
- {{WebExtAPIRef("userScripts.UserScriptFilter")}}
- : A list of user scripts to be processed by {{WebExtAPIRef("userScripts.getScripts()")}} or {{WebExtAPIRef("userScripts.unregister()")}}.
- : A list of user scripts to be processed by {{WebExtAPIRef("userScripts.getScripts()", "getScripts()")}} or {{WebExtAPIRef("userScripts.unregister()", "unregister()")}}.
- {{WebExtAPIRef("userScripts.WorldProperties")}}
- : The configuration of a `USER_SCRIPT` execution environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ browser-compat: webextensions.api.userScripts.ScriptSource
sidebar: addonsidebar
---

The code or source file for a user script. This describes the object values of the "js" property in {{WebExtAPIRef("userScripts.RegisteredUserScript","RegisteredUserScript")}}.
The code or source file for a user script. This describes the object values of the "js" property in {{WebExtAPIRef("userScripts.execute()", "execute()")}} and {{WebExtAPIRef("userScripts.RegisteredUserScript","RegisteredUserScript")}}.

## Type

Expand Down
3 changes: 2 additions & 1 deletion files/en-us/mozilla/firefox/releases/153/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ Firefox 153 is the current [Nightly version of Firefox](https://www.firefox.com/

## Changes for add-on developers

- Adds the {{WebExtAPIRef("contextualIdentities.getSupportedColors()")}} and {{WebExtAPIRef("contextualIdentities.getSupportedIcons()")}} methods to retrieve the colors and icons available for contextual identities (containers). ([Firefox bug 2044712](https://bugzil.la/2044712))
- Supports the {{WebExtAPIRef("userScripts.execute()")}} method, enabling extensions to inject user scripts on demand into a tab or frame. Unlike {{WebExtAPIRef("userScripts.register()")}}, this method supports one-off injection of multiple script sources executed in a defined order. ([Firefox bug 1930776](https://bugzil.la/1930776))
- Extension content scripts can now read and modify constructed stylesheets in {{domxref("document.adoptedStyleSheets")}} and {{domxref("ShadowRoot.adoptedStyleSheets")}}, without `.wrappedJSObject`. ([Firefox bug 1751346](https://bugzil.la/1751346))
- Adds the {{WebExtAPIRef("contextualIdentities.getSupportedColors()")}} and {{WebExtAPIRef("contextualIdentities.getSupportedIcons()")}} methods to retrieve the colors and icons available for contextual identities (containers). ([Firefox bug 2044712](https://bugzil.la/2044712))

<!-- ### Removals -->

Expand Down