|
| 1 | +<pre class="metadata"> |
| 2 | +Title: window.browser |
| 3 | +Shortname: wecg-browser |
| 4 | +Level: 1 |
| 5 | +Group: wecg |
| 6 | +Status: UD |
| 7 | +URL: https://w3c.github.io/webextensions/specification/window.browser.html |
| 8 | +Editor: Patrick Kettner, Google, [email protected] |
| 9 | +Abstract: This specification reserves the <code>window.browser</code> namespace for use by WebExtensions. |
| 10 | +Repository: w3c/webextensions |
| 11 | +Complain About: accidental-2119 on, missing-example-ids on |
| 12 | +</pre> |
| 13 | + |
| 14 | +<pre class=link-defaults> |
| 15 | +spec:html; type:attribute; text:window |
| 16 | +</pre> |
| 17 | + |
| 18 | +<pre class="anchors"> |
| 19 | +spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ |
| 20 | + type: dfn; text: valid non-empty URL; url: valid-non-empty-url-potentially-surrounded-by-spaces |
| 21 | +</pre> |
| 22 | + |
| 23 | +<section class="non-normative"> |
| 24 | + ## Introduction |
| 25 | + <em>This section is non-normative.</em> |
| 26 | + |
| 27 | + Browser extensions are programs to extend the capabilities of web browsers. |
| 28 | + Although not standardized at first, web browsers have independently implemented a common interoperable set of extension APIs, called WebExtensions. |
| 29 | + |
| 30 | + Modern WebExtensions are an evolution of a system originally introduced in |
| 31 | + Chromium. In that system, any API that was added was put under the |
| 32 | + <code>chrome</code> namespace. When WebExtensions were adopted outside of |
| 33 | + Chromium, other vendors used the more neutral <code>browser</code> namespace. |
| 34 | + That <code>browser</code> is now considered the canonically correct namespace |
| 35 | + for all WebExtension APIs. Some interactions with WebExtensions (such as |
| 36 | + external messaging from websites to background processes) necessitate |
| 37 | + the exposure of this namespace to the web. |
| 38 | + |
| 39 | + Given that, this document defines <code>window.browser</code> as reserved for |
| 40 | + the use of APIs designed to interact with WebExtensions. The specifics of what |
| 41 | + APIs within <code>window.browser</code> are at present intentionally undefined, |
| 42 | + and are left up to User Agent implementation. |
| 43 | +</section> |
| 44 | + |
| 45 | + |
| 46 | + <section> |
| 47 | + <h3 id="window-interface"> |
| 48 | + <a attribute lt="browser"><code>window.browser</code></a> API |
| 49 | + </h3> |
| 50 | + |
| 51 | + {{browser}} is UA defined attribute exposed on {{window}}. When implemented, |
| 52 | + it MUST be used only for WebExtension related functionality. |
| 53 | + </section> |
| 54 | + |
| 55 | + |
| 56 | +<pre class="idl"> |
| 57 | + partial interface Window { |
| 58 | + attribute object browser; |
| 59 | + }; |
| 60 | + |
| 61 | +</pre> |
| 62 | + |
| 63 | + <section> |
| 64 | + <h3 id="worker-interface"> |
| 65 | + Worker API |
| 66 | + </h3> |
| 67 | + |
| 68 | + When {{browser}} is defined on {{window}}, it SHOULD also be exposed on {{ServiceWorkerGlobalScope}} |
| 69 | + of origins associated with WebExtensions. |
| 70 | + It MUST be used exclusively for WebExtension purposes, however the contents of each instance of {{browser}} is UA defined. |
| 71 | + </section> |
| 72 | + |
| 73 | +<pre class="idl"> |
| 74 | + partial interface ServiceWorkerGlobalScope { |
| 75 | + attribute object browser; |
| 76 | + }; |
| 77 | +</pre> |
0 commit comments