diff --git a/browser/actors/BrowserTabParent.jsm b/browser/actors/BrowserTabParent.jsm index 94eb81622a89..e6fb6d3d60aa 100644 --- a/browser/actors/BrowserTabParent.jsm +++ b/browser/actors/BrowserTabParent.jsm @@ -13,6 +13,7 @@ class BrowserTabParent extends JSWindowActorParent { } let gBrowser = browser.ownerGlobal.gBrowser; + if (!gBrowser) { // Note: gBrowser might be null because this message might be received // from the extension process. There's still an embedderElement involved, @@ -22,6 +23,15 @@ class BrowserTabParent extends JSWindowActorParent { return; } + if (!gBrowser.tabpanels || !gBrowser.tabpanels.contains(browser)) { + // Note: This is ignoring browser elements related to extension pages that are not loaded + // as a browser tab (like sidebars, devtools panels and options pages embedded into + // about:addons, browserAction and pageAction popup panels. + // (Ideally we could call gBrowser.getTabForBrowser, but it returns undefined early in + // the tab browser creation and we would ignore browsers related to newly created tabs). + return; + } + switch (message.name) { case "Browser:WindowCreated": { gBrowser.announceWindowCreated(browser, message.data.userContextId);