Wren a web browser where WebAssembly runs everything, JavaScript included

chrome.tabs

The tabs of Wren's windows, as the shell describes them (src/page/ext_api.odin, ext_tabs.odin). A tab's url and title are given only with the tabs permission, a host grant for its URL, or for the extension's own pages. create, update and remove act from a task of the loop of their own, then answer.

Gate: no permission; contexts: Background, Popup, Tab. Source: api/ext_tabs.widl.

Methods and properties

MemberResultStatusGate
query(optional QueryInfo queryInfo)Tab[]host
get(i64 tabId)Tabhost
getCurrent()TabhostThe tab of the calling page; undefined for a popup or the background.
create(CreateProperties createProperties)Tabhost
update(optional i64 tabId, UpdateProperties updateProperties)TabhostNo tabId: the selected tab of the current window.
remove(TabIds tabIds)voidhost
sendMessage(i64 tabId, any message, optional MessageSendOptions options)anyhostTo the content scripts of the extension in the tab (one frame with frameId) that listen to runtime.onMessage. The first answer wins; with none, "Could not establish connection. Receiving end does not exist.".
connect(i64 tabId, optional TabConnectInfo connectInfo)PortrealmA port to the content scripts of the extension in the tab (one frame with frameId) that listen to runtime.onConnect.

Events

EventListener's parametersGate
onActivatedActiveInfo activeInfo
onUpdatedi64 tabId, ChangeInfo changeInfo, Tab tab"loading" at the request, "complete" at the document's load event.
onRemovedi64 tabId, RemoveInfo removeInfo
onCreatedTab tab
onReplacedi64 addedTabId, i64 removedTabId
onAttachedi64 tabId, object attachInfo
onDetachedi64 tabId, object detachInfo
onMovedi64 tabId, object moveInfo
onHighlightedobject highlightInfo

Constants

  • TAB_ID_NONE = -1
  • TAB_INDEX_NONE = -1

Types

TabStatus

A string: "unloaded", "loading", "complete". chrome.tabs.TabStatus names them.

UrlOrUrls

One URL or match pattern, or a list of them.

One of: string or string[].

TabIds

One tab id, or a list of them.

One of: i64 or i64[].

MutedInfo

PropertyType
mutedbool

Tab

PropertyType
idi64
indexi64
windowIdi64
activebool
highlightedbool
selectedbool
pinnedbool
incognitobool
discardedbool
autoDiscardablebool
frozenbool
groupIdi64
audiblebool
mutedInfoMutedInfo
statusTabStatus
url (optional)string
title (optional)string

QueryInfo

PropertyType
active (optional)bool
currentWindow (optional)bool
lastFocusedWindow (optional)bool
windowId (optional)i64-2: the current window.
highlighted (optional)bool
pinned (optional)bool
status (optional)TabStatus
index (optional)i64
url (optional)UrlOrUrlsMatch patterns; tabs whose URL the extension may not see never match.

CreateProperties

PropertyType
windowId (optional)i64
index (optional)i64
url (optional)stringA web page, about:blank or a file of the extension (relative to its root).
active (optional)bool
selected (optional)bool
pinned (optional)bool
openerTabId (optional)i64

UpdateProperties

PropertyType
url (optional)string
active (optional)bool
highlighted (optional)bool
selected (optional)bool
pinned (optional)bool
muted (optional)bool

ActiveInfo

PropertyType
tabIdi64
windowIdi64

ChangeInfo

PropertyType
status (optional)TabStatus
url (optional)string

RemoveInfo

PropertyType
windowIdi64
isWindowClosingbool

MessageSendOptions

PropertyType
frameId (optional)i64One frame only (0: the top document).
documentId (optional)string

TabConnectInfo

PropertyType
name (optional)string
frameId (optional)i64
documentId (optional)string

Edit this page on GitHub