From 9f1210036d2c639fcb21457feb5f486e30cb0733 Mon Sep 17 00:00:00 2001 From: Tomislav Jovanovic Date: Thu, 13 Feb 2020 19:20:50 +0000 Subject: [PATCH] Bug 1493620 - Skip forcing about:blank in windowless browsers for background pages r=rpl,kmag Differential Revision: https://phabricator.services.mozilla.com/D62568 --HG-- extra : moz-landing-system : lando --- toolkit/components/extensions/ExtensionParent.jsm | 26 +++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/toolkit/components/extensions/ExtensionParent.jsm b/toolkit/components/extensions/ExtensionParent.jsm index 64e2a3ea3603..37b3cde3ce31 100644 --- a/toolkit/components/extensions/ExtensionParent.jsm +++ b/toolkit/components/extensions/ExtensionParent.jsm @@ -1272,15 +1272,11 @@ class HiddenXULWindow { // The windowless browser is a thin wrapper around a docShell that keeps // its related resources alive. It implements nsIWebNavigation and - // forwards its methods to the underlying docShell, but cannot act as a - // docShell itself. Getting .docShell gives us the - // underlying docShell, and `QueryInterface(nsIWebNavigation)` gives us - // access to the webNav methods that are already available on the - // windowless browser, but contrary to appearances, they are not the same - // object. - let chromeShell = windowlessBrowser.docShell.QueryInterface( - Ci.nsIWebNavigation - ); + // forwards its methods to the underlying docShell. That .docShell + // needs `QueryInterface(nsIWebNavigation)` to give us access to the + // webNav methods that are already available on the windowless browser. + let chromeShell = windowlessBrowser.docShell; + chromeShell.QueryInterface(Ci.nsIWebNavigation); if (PrivateBrowsingUtils.permanentPrivateBrowsing) { let attrs = chromeShell.getOriginAttributes(); @@ -1288,16 +1284,10 @@ class HiddenXULWindow { chromeShell.setOriginAttributes(attrs); } - let system = Services.scriptSecurityManager.getSystemPrincipal(); - chromeShell.createAboutBlankContentViewer(system, system); chromeShell.useGlobalHistory = false; - let loadURIOptions = { - triggeringPrincipal: system, - }; - chromeShell.loadURI( - "chrome://extensions/content/dummy.xhtml", - loadURIOptions - ); + chromeShell.loadURI("chrome://extensions/content/dummy.xhtml", { + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), + }); await promiseObserved( "chrome-document-global-created", -- 2.11.4.GIT