diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index e9836ba6df6a..0bbe0b0196fc 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -853,38 +853,6 @@ return rv; }, - /** - * Determine if a URI is an about: page pointing to a local resource. - */ - isLocalAboutURI(aURI, aResolvedURI) { - if (!aURI.schemeIs("about")) { - return false; - } - - // Specially handle about:blank as local - if (aURI.pathQueryRef === "blank") { - return true; - } - - try { - // Use the passed in resolvedURI if we have one - const resolvedURI = - aResolvedURI || - Services.io.newChannelFromURI( - aURI, - null, // loadingNode - Services.scriptSecurityManager.getSystemPrincipal(), // loadingPrincipal - null, // triggeringPrincipal - Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, // securityFlags - Ci.nsIContentPolicy.TYPE_OTHER // contentPolicyType - ).URI; - return resolvedURI.schemeIs("jar") || resolvedURI.schemeIs("file"); - } catch (ex) { - // aURI might be invalid. - return false; - } - }, - /** * Sets an icon for the tab if the URI is defined in FAVICON_DEFAULTS. */ @@ -5567,7 +5535,7 @@ // pointing to local resources. if ( aRequest instanceof Ci.nsIChannel && - gBrowser.isLocalAboutURI(aRequest.originalURI, aRequest.URI) + aRequest.originalURI.schemeIs("about") ) { return false; } diff --git a/browser/base/content/test/tabs/browser.ini b/browser/base/content/test/tabs/browser.ini index 76a19a411639..71623bedf6e1 100644 --- a/browser/base/content/test/tabs/browser.ini +++ b/browser/base/content/test/tabs/browser.ini @@ -24,7 +24,6 @@ tags = audiochannel skip-if = (verify && debug && (os == 'linux')) support-files = test_bug1358314.html -[browser_isLocalAboutURI.js] [browser_e10s_about_page_triggeringprincipal.js] skip-if = verify support-files = diff --git a/browser/base/content/test/tabs/browser_isLocalAboutURI.js b/browser/base/content/test/tabs/browser_isLocalAboutURI.js deleted file mode 100644 index eee28bd75661..000000000000 --- a/browser/base/content/test/tabs/browser_isLocalAboutURI.js +++ /dev/null @@ -1,56 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/** - * Unit tests for tabbrowser.isLocalAboutURI to make sure it returns the - * appropriate values for various URIs as well as optional resolved URI. - */ - -add_task(function test_URI() { - const check = (spec, expect, description) => { - const URI = Services.io.newURI(spec); - try { - is(gBrowser.isLocalAboutURI(URI), expect, description); - } catch (ex) { - ok(false, "isLocalAboutURI should not throw"); - } - }; - check("https://www.mozilla.org/", false, "https is not about"); - check("http://www.mozilla.org/", false, "http is not about"); - check("about:blank", true, "about:blank is local"); - check("about:about", true, "about:about is local"); - check("about:newtab", true, "about:newtab is local"); - check( - "about:random-invalid-uri", - false, - "about:random-invalid-uri is invalid but should not throw" - ); -}); - -add_task(function test_URI_with_resolved() { - const check = (spec, resolvedSpec, expect, description) => { - const URI = Services.io.newURI(spec); - const resolvedURI = Services.io.newURI(resolvedSpec); - is(gBrowser.isLocalAboutURI(URI, resolvedURI), expect, description); - }; - check( - "about:newtab", - "jar:file:///Applications/Firefox.app/Contents/Resources/browser/omni.ja!/chrome/browser/res/activity-stream/prerendered/en-US/activity-stream.html", - true, - "about:newtab with jar is local" - ); - check( - "about:newtab", - "file:///mozilla-central/browser/base/content/newtab/newTab.xhtml", - true, - "about:newtab with file is local" - ); - check( - "about:newtab", - "https://www.mozilla.org/newtab", - false, - "about:newtab with https is not local" - ); -}); diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index db2cb05a7040..9d051d65d05a 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -2978,7 +2978,7 @@ var SessionStoreInternal = { // waiting for data from the frame script. This throbber is disabled // if the URI is a local about: URI. let uriObj = aTab.linkedBrowser.currentURI; - if (!uriObj || (uriObj && !aWindow.gBrowser.isLocalAboutURI(uriObj))) { + if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) { newTab.setAttribute("busy", "true"); } @@ -3662,7 +3662,7 @@ var SessionStoreInternal = { // Start the throbber to pretend we're doing something while actually // waiting for data from the frame script. This throbber is disabled // if the URI is a local about: URI. - if (!uriObj || (uriObj && !window.gBrowser.isLocalAboutURI(uriObj))) { + if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) { tab.setAttribute("busy", "true"); } diff --git a/browser/modules/AsyncTabSwitcher.jsm b/browser/modules/AsyncTabSwitcher.jsm index 5ab93207e1cc..d902e5c430a2 100644 --- a/browser/modules/AsyncTabSwitcher.jsm +++ b/browser/modules/AsyncTabSwitcher.jsm @@ -374,9 +374,7 @@ class AsyncTabSwitcher { // determined by the busy state on the tab element and checking // if the loaded URI is local. let isBusy = this.requestedTab.hasAttribute("busy"); - let isLocalAbout = this.tabbrowser.isLocalAboutURI( - requestedBrowser.currentURI - ); + let isLocalAbout = requestedBrowser.currentURI.schemeIs("about"); let hasSufficientlyLoaded = !isBusy && !isLocalAbout; let fl = requestedBrowser.frameLoader;