summaryrefslogtreecommitdiffstats
path: root/mobile/android/components/extensions/ext-android.js
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/components/extensions/ext-android.js')
-rw-r--r--mobile/android/components/extensions/ext-android.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/mobile/android/components/extensions/ext-android.js b/mobile/android/components/extensions/ext-android.js
index 4524c4529b..13f91fb617 100644
--- a/mobile/android/components/extensions/ext-android.js
+++ b/mobile/android/components/extensions/ext-android.js
@@ -129,8 +129,7 @@ class WindowTracker extends WindowTrackerBase {
getCurrentWindow(context) {
// In GeckoView the popup is on a separate window so getCurrentWindow for
// the popup should return whatever is the topWindow.
- // TODO: Bug 1651506 use context?.viewType === "popup" instead
- if (context?.currentWindow?.moduleManager.settings.isPopup) {
+ if (context?.viewType === "popup") {
return this.topWindow;
}
return super.getCurrentWindow(context);
@@ -283,6 +282,18 @@ class TabTracker extends TabTrackerBase {
};
}
+ getBrowserDataForContext(context) {
+ if (["tab", "background"].includes(context.viewType)) {
+ return this.getBrowserData(context.xulBrowser);
+ } else if (context.viewType === "popup") {
+ const chromeWindow = windowTracker.getCurrentWindow(context);
+ const windowId = chromeWindow ? windowTracker.getId(chromeWindow) : -1;
+ return { tabId: -1, windowId };
+ }
+
+ return { tabId: -1, windowId: -1 };
+ }
+
get activeTab() {
const window = windowTracker.topWindow;
if (window) {
@@ -467,8 +478,7 @@ class Window extends WindowBase {
isCurrentFor(context) {
// In GeckoView the popup is on a separate window so the current window for
// the popup is whatever is the topWindow.
- // TODO: Bug 1651506 use context?.viewType === "popup" instead
- if (context?.currentWindow?.moduleManager.settings.isPopup) {
+ if (context?.viewType === "popup") {
return mobileWindowTracker.topWindow == this.window;
}
return super.isCurrentFor(context);