From 7e085a93c6a73afb3d297de3141f0adbec9e539d Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Sun, 23 Apr 2017 13:03:11 +0200 Subject: [PATCH] Bug 1299053 - Ensure that background pages have windowId -1 in browser.extension.getViews r=aswan MozReview-Commit-ID: HdayD0JrIBm --HG-- extra : rebase_source : 5dbf78b9f735cd086e800806b2ad76669dbd67f5 --- .../components/extensions/test/browser/browser_ext_getViews.js | 1 + toolkit/components/extensions/ExtensionPageChild.jsm | 1 + 2 files changed, 2 insertions(+) diff --git a/browser/components/extensions/test/browser/browser_ext_getViews.js b/browser/components/extensions/test/browser/browser_ext_getViews.js index 61cc6facd04a..3e6ae598869c 100644 --- a/browser/components/extensions/test/browser/browser_ext_getViews.js +++ b/browser/components/extensions/test/browser/browser_ext_getViews.js @@ -131,6 +131,7 @@ add_task(async function() { } await checkViews("background", 0, 0, 0); + await checkViewsWithFilter({windowId: -1}, 1); await checkViewsWithFilter({tabId: -1}, 1); let tabId1 = await openTab(winId1); diff --git a/toolkit/components/extensions/ExtensionPageChild.jsm b/toolkit/components/extensions/ExtensionPageChild.jsm index aeb1bf8ffc1a..3d1893066f71 100644 --- a/toolkit/components/extensions/ExtensionPageChild.jsm +++ b/toolkit/components/extensions/ExtensionPageChild.jsm @@ -153,6 +153,7 @@ class ExtensionBaseContextChild extends BaseContext { let globalView = ExtensionPageChild.contentGlobals.get(this.messageManager); return globalView ? globalView.windowId : -1; } + return -1; } get tabId() {