function gotContextInfo(contexts) {
for (const context of contexts) {
if (context.tabId === -1) {
console.log("Not hosted in a tab");
} else {
console.log(
`Hosted in tab: ${context.tabId} and frame ${context.frameId} with URL ${context.documentUrl}`,
);
}
}
}
let gettingContextInfo = browser.runtime.getContexts({ incognito: true });
gettingContextInfo.then(gotContextInfo);runtime.getContexts() / notebook
runtime.getContexts()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.