Bug 1447807 - Error: browser.ownerGlobal is null r=mixedpuppy

Error: browser.ownerGlobal is null

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Trishul 2019-10-25 18:19:30 +00:00
Родитель dd6c574455
Коммит adfefda6ba
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -699,13 +699,20 @@ class TabTracker extends TabTrackerBase {
}
getBrowserData(browser) {
let { gBrowser } = browser.ownerGlobal;
let window = browser.ownerGlobal;
if (!window) {
return {
tabId: -1,
windowId: -1,
};
}
let { gBrowser } = window;
// Some non-browser windows have gBrowser but not getTabForBrowser!
if (!gBrowser || !gBrowser.getTabForBrowser) {
if (browser.ownerGlobal.top.document.documentURI === "about:addons") {
if (window.top.document.documentURI === "about:addons") {
// When we're loaded into a <browser> inside about:addons, we need to go up
// one more level.
browser = browser.ownerGlobal.docShell.chromeEventHandler;
browser = window.docShell.chromeEventHandler;
({ gBrowser } = browser.ownerGlobal);
} else {