Skip to content

Extension API

All the APIs documented are available through the browser namespace.

webfuseSession Scope Webfuse Exclusive

Section titled “webfuseSession Scope ”

The webfuseSession namespace contains methods specific to Webfuse sessions. This is the primary API for interacting with Webfuse functionality from within an extension. The webfuseSession namespace acts as a proxy to the Session API and exposes the following methods for convenience, for example:

  • browser.webfuseSession.log()
  • browser.webfuseSession.getParticipants()
  • browser.webfuseSession.getSessionInfo()
  • browser.webfuseSession.end()

The runtime namespace targets the browser in general.

Sends a message to the following components of the extension: Popup, Background, Newtab page.

browser.runtime.sendMessage(message: unknown): void

message

  • The message to send.
browser.runtime.onMessage.addListener(callback: (message: unknown) => void): void

Listens for messages from the extension.

callback

  • The callback function to handle the message.
browser.runtime.onMessage.addListener((message, sender) => {});

The tabs namespace contains methods for managing tabs, overriding standard Chrome APIs to work with Webfuse sessions.

browser.tabs.sendMessage(tabId: number, message: unknown, options: {
frameId?: number;
}): Promise<unknown | null>

Sends a message from any component to the content script of that specific tab.

tabId

  • The tabId to send the message to. Can be queried via getTabs() method. Passing null will send the message to all tabs.

message

  • The message to send. Must be a JSON-serializable object.

options

  • Additional options for message delivery:
  • frameId Send the message to a specific frame within the tab.

Returns a promise that resolves with the response from the content script’s message handler.

By default, messages are sent to the main frame of the tab. Use the frameId option to target specific frames:

// Send to main frame (default)
browser.tabs.sendMessage(tabId, { greeting: "Hello main frame" });
// Send to specific frame
browser.tabs.sendMessage(tabId, { greeting: "Hello frame" }, { frameId: 123 });
browser.webNavigation.getAllFrames(details: {
tabId: number;
})

Retrieves information about all frames in a tab.

details

  • Query details:
  • tabId The ID of the tab to query.

Returns a Promise that resolves with an array of frame objects:

[
{
frameId: 123,
parentFrameId: 0,
url: "https://example.com/iframe.html"
}
]

The browserAction namespace contains methods for managing the extension popup.

Open the extension popup.

browser.browserAction.openPopup(): void

Close the extension popup.

browser.browserAction.closePopup(): void

Resize the extension popup. If no parameters are provided, the popup will be resized to its default size.

browser.browserAction.resizePopup(width: number, height: number): void

width

  • The width of the popup.

height

  • The height of the popup.

Detach the extension popup from the browser action button to make it draggable with UI controls.

browser.browserAction.detachPopup()

Attach the extension popup back to the browser action button to make it non-draggable and restores its original position.

browser.browserAction.attachPopup()