Bug 1597793 - Don't return a tabId for non-tab windows. r=snorp
authorAgi Sferro <agi@sferro.dev>
Sat, 25 Jan 2020 07:27:17 +0000
changeset 511765 1aecf00f2b3b24e4080d05c1b41e0924ca9d543f
parent 511764 bb84c78d3f3b002456c8f972ac1d5cadad79ae6c
child 511766 5c1cbb5434277963d33680d61fe64c28987135cb
push id37055
push userccoroiu@mozilla.com
push dateSat, 25 Jan 2020 21:38:07 +0000
treeherdermozilla-central@3bc0d683a41c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1597793
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1597793 - Don't return a tabId for non-tab windows. r=snorp If the window is a popup there is no WebExtension tab object present. Differential Revision: https://phabricator.services.mozilla.com/D60942
mobile/android/components/extensions/ext-utils.js
--- a/mobile/android/components/extensions/ext-utils.js
+++ b/mobile/android/components/extensions/ext-utils.js
@@ -260,19 +260,29 @@ class TabTracker extends TabTrackerBase 
   getBrowserData(browser) {
     const window = browser.ownerGlobal;
     if (!window.BrowserApp) {
       return {
         tabId: -1,
         windowId: -1,
       };
     }
+
+    const windowId = windowTracker.getId(window);
+
+    if (!windowTracker.isBrowserWindow(window)) {
+      return {
+        windowId,
+        tabId: -1,
+      };
+    }
+
     return {
+      windowId,
       tabId: this.getId(window.BrowserApp.selectedTab),
-      windowId: windowTracker.getId(window),
     };
   }
 
   get activeTab() {
     let win = windowTracker.topWindow;
     if (win && win.BrowserApp) {
       return win.BrowserApp.selectedTab;
     }