scripting.ExecutionWorld

Specifies the execution environment of a script injected with scripting.executeScript() or registered with scripting.registerContentScripts().

Type

Values of this type are strings. Possible values are:

  • ISOLATED The default execution environment of content scripts. This environment is isolated from the page's context: while they share the same document, the global scopes and available APIs differ.
  • MAIN The execution environment of the web page. This environment is shared with the web page, without isolation. Scripts in this environment do not have any access to APIs that are only available to content scripts.

    Warning: Due to the lack of isolation, the web page can detect the executed code and interfere with it. 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. MAIN is not supported in Firefox (although it is planned and the work to introduce it is tracked by Bug 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.

Browser compatibility

BCD tables only load in the browser

Note: This API is based on Chromium's chrome.scripting API.