Wren a web browser where WebAssembly runs everything, JavaScript included

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 action when 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.lastError during 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. Status realm: the context answers itself, without the browser's loop.
NamespaceGateMethodsEvents
actionno permission; contexts: Background, Popup, Tab; the manifest has an action141
alarmspermission alarms; contexts: Background, Popup, Tab51
extensionno permission; contexts: Background, Popup, Tab40
i18nno permission; contexts: Background, Popup, Tab, Content30
idlepermission idle; contexts: Background, Popup, Tab21
managementno permission; contexts: Background, Popup, Tab10
offscreenpermission offscreen; contexts: Background, Popup, Tab30
permissionsno permission; contexts: Background, Popup, Tab42
runtimeno permission; contexts: Background, Popup, Tab, Offscreen97
scriptingpermission scripting; contexts: Background, Popup, Tab70
storagepermission storage; contexts: Background, Popup, Tab, Content01
storage.localpermission storage; contexts: Background, Popup, Tab, Content61
storage.syncpermission storage; contexts: Background, Popup, Tab, Content61
storage.sessionpermission storage; contexts: Background, Popup, Tab71
storage.managedpermission storage; contexts: Background, Popup, Tab, Content21
tabsno permission; contexts: Background, Popup, Tab89
webNavigationpermission webNavigation; contexts: Background, Popup, Tab29
windowsno permission; contexts: Background, Popup, Tab74

Edit this page on GitHub