Bug 1561970 - BrowserTabParent should ignore browser elements related to non-tab extension pages. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D37051

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Luca Greco 2019-07-09 20:58:51 +00:00
Родитель 4784081571
Коммит b41031dd54
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -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);