Extension APIs of Wren
The chrome.* namespaces an extension context gets, generated from api/ext_*.widl (docs/extensions.md, section 3.9).
The same description produces the host's method table and argument decoders (src/page/ext_api_generated.odin),
the constants of chrome.* and the conformance cases (src/page/ext_api_generated_test.odin).
- A namespace or a member exists in a context only when the manifest has its permission, the kind of context is
listed, and the manifest has an
actionwhen it needs one. A call outside these rules fails in the host too. - A method returns a promise. With a function as its last argument, it calls it with the result instead, and sets
chrome.runtime.lastErrorduring that call when it failed.browser.*(Firefox flavour) has promises only. - Arguments are matched to the signature as in Chrome: an optional parameter is left out when the argument in its place does not have its type. A wrong type, a missing property or a value out of bounds is an error that names the parameter and the property.
- Status
host: the browser answers. Statusrealm: the context answers itself, without the browser's loop.
| Namespace | Gate | Methods | Events |
|---|---|---|---|
| action | no permission; contexts: Background, Popup, Tab; the manifest has an action | 14 | 1 |
| alarms | permission alarms; contexts: Background, Popup, Tab | 5 | 1 |
| extension | no permission; contexts: Background, Popup, Tab | 4 | 0 |
| i18n | no permission; contexts: Background, Popup, Tab, Content | 3 | 0 |
| idle | permission idle; contexts: Background, Popup, Tab | 2 | 1 |
| management | no permission; contexts: Background, Popup, Tab | 1 | 0 |
| offscreen | permission offscreen; contexts: Background, Popup, Tab | 3 | 0 |
| permissions | no permission; contexts: Background, Popup, Tab | 4 | 2 |
| runtime | no permission; contexts: Background, Popup, Tab, Offscreen | 9 | 7 |
| scripting | permission scripting; contexts: Background, Popup, Tab | 7 | 0 |
| storage | permission storage; contexts: Background, Popup, Tab, Content | 0 | 1 |
| storage.local | permission storage; contexts: Background, Popup, Tab, Content | 6 | 1 |
| storage.sync | permission storage; contexts: Background, Popup, Tab, Content | 6 | 1 |
| storage.session | permission storage; contexts: Background, Popup, Tab | 7 | 1 |
| storage.managed | permission storage; contexts: Background, Popup, Tab, Content | 2 | 1 |
| tabs | no permission; contexts: Background, Popup, Tab | 8 | 9 |
| webNavigation | permission webNavigation; contexts: Background, Popup, Tab | 2 | 9 |
| windows | no permission; contexts: Background, Popup, Tab | 7 | 4 |