tabs/utils
The tabs/utils
module contains low-level functions for working with
XUL tabs
and the XUL tabbrowser
object.
API Reference
Functions
activateTab(tab, window)
Set the specified tab as the active, or selected, tab.
A XUL tab
element
to activate.
A browser window.
getTabBrowser(window)
Get the tabbrowser
element for the given browser window.
A browser window.
getTabContainer(window)
Get the tabbrowser
's
tabContainer
property.
A browser window.
getTabs(window)
Returns the tabs for the specified window
.
If you omit window
, this function will return tabs
across all the browser's windows. However, if your add-on
has not opted into private browsing, then the function will
exclude all tabs that are hosted by private browser windows.
To learn more about private windows, how to opt into private browsing, and how
to support private browsing, refer to the
documentation for the private-browsing
module.
Optional.
An array of tab
elements.
getActiveTab(window)
Given a browser window, get the active, or selected, tab.
A browser window.
The currently selected
tab
.
getOwnerWindow(tab)
Get the browser window that owns the specified tab
.
A browser tab
.
A browser window.
openTab(window, url, options)
Open a new tab in the specified browser window.
The browser window in which to open the tab.
URL for the document to load.
Options for the new tab. These are currently only applicable to Firefox for Android.
If true
, open the new tab, but keep the currently selected tab selected.
If false
, make the new tab the selected tab.
Optional, defaults to false
.
Pin this tab. Optional, defaults to false
.
The new tab
.
isTabOpen(tab)
Test whether the specified tab is open.
A XUL tab
element.
true
if the tab is open, otherwise false
.
getURI(tab)
Get the specified tab's URI.
A XUL tab
element.
The current URI.
getTabBrowserForTab(tab)
Get the specified tab's tabbrowser
.
A XUL tab
element.
getBrowserForTab(tab)
Get the specified tab's browser
.
A XUL tab
element.
getTabTitle(tab)
Get the title of the document hosted by the specified tab, or the tab's label if the tab doesn't host a document.
A XUL tab
element.
setTabTitle(tab, title)
Set the title of the document hosted by the specified tab, or the tab's label if the tab doesn't host a document.
A XUL tab
element.
The new title.
getTabContentWindow(tab)
Get the specified tab's content window.
A XUL tab
element.
getAllTabContentWindows()
Get all tabs' content windows across all the browsers' windows.
Array of windows.
getTabForContentWindow(window)
Get the tab element that hosts the specified content window.
getTabURL(tab)
Get the specified tab's URL.
A XUL tab
element.
The current URI.
getTabContentType(tab)
Get the contentType
of the document hosted by the specified tab.
A XUL tab
element.
getSelectedTab(window)
Get the selected tab for the specified browser window.
A XUL tab
element.