Skip to content

Commit b4839f4

Browse files
committed
Specify execution context
1 parent d7f281f commit b4839f4

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

specification/index.bs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,24 @@ This key may be present.
153153

154154
Filenames beginning with an underscore (`_`) are reserved for use by user agent.
155155

156-
# Isolated worlds
156+
# Execution contexts
157157

158-
<dfn>Worlds</dfn> are isolated JavaScript contexts with access to the same underlying DOM tree but their own set of wrappers around those DOM objects. Declarations in the global scope are also isolated.
158+
Extensions can execute JavaScript code, in any of the following execution contexts:
159+
160+
* An <dfn>extension context</dfn> is any JavaScript execution context associated with an extension.
161+
* A <dfn>privileged extension context</dfn> has access to the full set of extension APIs available to the extension. The most prominent example is the background page or worker defined by the [[#key-background]] part of the [=manifest=].
162+
* The main execution context of a web page, also known as the <dfn>main world</dfn>, is not an extension context. It does not have access to any extension API, except when an extension allows so through [#key-externally_connectable].
163+
* An <dfn>isolated world</dfn> is an isolated JavaScript context with access to the same underlying DOM tree but their own set of wrappers around those DOM objects. Declarations in the global scope are also isolated. A limited number of extension APIs may be available in these execution contexts.
164+
* Some extension APIs may involve the execution of JavaScript code in contexts other than what is specified above. For example, the `userScripts` API allows the creation of `USER_SCRIPT` worlds that are isolated similarly to [=isolated world=]s but with distinct API availability. The `proxy` API allows the registration of Proxy auto-config (PAC) scripts whose execution environment is outside the scope of this specification.
159165

160166
# Unavailable APIs
161167

162168
# The `browser` global
163169

170+
The `browser` global is the primary namespace hosting extension APIs, available to [=extension context=]s.
171+
172+
Although the [=main world=] of a web page is not an [=extension context=], it may also contain the `browser` global to offer access functionality granted by [#key-externally_connectable].
173+
164174
# Extension origin
165175

166176
# Localization

0 commit comments

Comments
 (0)