diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index d8749b6f8c48..15efdd51cf0f 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -3835,13 +3835,6 @@ already_AddRefed HttpBaseChannel::CloneLoadInfoForRedirect( // Reset our sandboxed null principal ID when cloning loadInfo for an // externally visible redirect. if (!isInternalRedirect) { - // If we've redirected from http to something that isn't, clear - // the "external" flag, as loads that now go to other apps should be - // allowed to go ahead and not trip infinite-loop protection - // (see bug 1717314 for context). - if (!aNewURI->SchemeIs("http") && !aNewURI->SchemeIs("https")) { - newLoadInfo->SetLoadTriggeredFromExternal(false); - } newLoadInfo->ResetSandboxedNullPrincipalID(); } diff --git a/uriloader/exthandler/HandlerService.js b/uriloader/exthandler/HandlerService.js index 62f2982defda..168333251bfd 100644 --- a/uriloader/exthandler/HandlerService.js +++ b/uriloader/exthandler/HandlerService.js @@ -568,8 +568,6 @@ HandlerService.prototype = { for (let extension of storedHandlerInfo.extensions) { handlerInfo.appendExtension(extension); } - } else if (this._mockedHandler) { - this._insertMockedHandler(handlerInfo); } }, @@ -734,48 +732,6 @@ HandlerService.prototype = { } return ""; }, - - _mockedHandler: null, - _mockedProtocol: null, - - _insertMockedHandler(handlerInfo) { - if (handlerInfo.type == this._mockedProtocol) { - handlerInfo.preferredApplicationHandler = this._mockedHandler; - handlerInfo.possibleApplicationHandlers.insertElementAt( - this._mockedHandler, - 0 - ); - } - }, - - // test-only: mock the handler instance for a particular protocol/scheme - mockProtocolHandler(protocol) { - if (!protocol) { - this._mockedProtocol = null; - this._mockedHandler = null; - return; - } - this._mockedProtocol = protocol; - this._mockedHandler = { - QueryInterface: ChromeUtils.generateQI([Ci.nsILocalHandlerApp]), - launchWithURI(uri, context) { - Services.obs.notifyObservers(uri, "mocked-protocol-handler"); - }, - name: "Mocked handler", - detailedDescription: "Mocked handler for tests", - equals(x) { - return x == this; - }, - executable: Services.dirsvc.get("XCurProcD", Ci.nsIFile), - parameterCount: 0, - clearParameters() {}, - appendParameter() {}, - getParameter() {}, - parameterExists() { - return false; - }, - }; - }, }; this.NSGetFactory = ComponentUtils.generateNSGetFactory([HandlerService]); diff --git a/uriloader/exthandler/tests/mochitest/browser.ini b/uriloader/exthandler/tests/mochitest/browser.ini index 1d0c5c52225b..255b57465ea1 100644 --- a/uriloader/exthandler/tests/mochitest/browser.ini +++ b/uriloader/exthandler/tests/mochitest/browser.ini @@ -56,8 +56,6 @@ support-files = support-files = file_external_protocol_iframe.html [browser_protocol_ask_dialog_external.js] -support-files = - redirect_helper.sjs [browser_protocol_ask_dialog_permission.js] [browser_protocolhandler_loop.js] [browser_remember_download_option.js] diff --git a/uriloader/exthandler/tests/mochitest/browser_protocol_ask_dialog_external.js b/uriloader/exthandler/tests/mochitest/browser_protocol_ask_dialog_external.js index f2e714f682b1..e05d03836f66 100644 --- a/uriloader/exthandler/tests/mochitest/browser_protocol_ask_dialog_external.js +++ b/uriloader/exthandler/tests/mochitest/browser_protocol_ask_dialog_external.js @@ -7,17 +7,12 @@ let gHandlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService( Ci.nsIHandlerService ); -const TEST_PATH = getRootDirectory(gTestPath).replace( - "chrome://mochitests/content", - "http://example.com" -); - /** * Creates dummy protocol handler */ function initTestHandlers() { let handlerInfoThatAsks = HandlerServiceTestUtils.getBlankHandlerInfo( - "local-app-test" + "should-ask" ); let appHandler = Cc[ @@ -113,7 +108,7 @@ add_task(async function test_external_asks_anyway() { gBrowser, true ); - let fakeCmdLine = makeCmdLineHelper("local-app-test:dummy"); + let fakeCmdLine = makeCmdLineHelper("should-ask:dummy"); cmdLineHandler.handle(fakeCmdLine); let dialog = await chooserDialogOpenPromise; ok(dialog, "Should have prompted."); @@ -174,52 +169,3 @@ add_task(async function test_web_app_doesnt_ask() { dialogOpenListener ); }); - -add_task(async function external_https_redirect_doesnt_ask() { - // Listen for a dialog open and fail the test if it does: - let dialogOpenListener = () => ok(false, "Shouldn't have opened a dialog!"); - document.documentElement.addEventListener("dialogopen", dialogOpenListener); - registerCleanupFunction(() => - document.documentElement.removeEventListener( - "dialogopen", - dialogOpenListener - ) - ); - - let initialTab = gBrowser.selectedTab; - - gHandlerService.wrappedJSObject.mockProtocolHandler("local-app-test"); - registerCleanupFunction(() => - gHandlerService.wrappedJSObject.mockProtocolHandler() - ); - - // Set up a promise for an app to have launched with the right URI: - let loadPromise = TestUtils.topicObserved("mocked-protocol-handler"); - - // Load the URL: - const kURL = "local-app-test:redirect"; - let cmdLineHandler = Cc["@mozilla.org/browser/final-clh;1"].getService( - Ci.nsICommandLineHandler - ); - let fakeCmdLine = makeCmdLineHelper( - TEST_PATH + "redirect_helper.sjs?uri=" + encodeURIComponent(kURL) - ); - cmdLineHandler.handle(fakeCmdLine); - - // Check that the mock app was launched. If the dialog showed instead, - // the test will fail. - let [uri] = await loadPromise; - is(uri.spec, "local-app-test:redirect", "Should have seen correct URI."); - // We might have opened a blank tab, see bug 1718104 and friends. - if (gBrowser.selectedTab != initialTab) { - BrowserTestUtils.removeTab(gBrowser.selectedTab); - } - - // We do this both here and in cleanup so it's easy to add tasks to this test, - // and so we clean up correctly if the test aborts before we get here. - document.documentElement.removeEventListener( - "dialogopen", - dialogOpenListener - ); - gHandlerService.wrappedJSObject.mockProtocolHandler(); -}); diff --git a/uriloader/exthandler/tests/mochitest/redirect_helper.sjs b/uriloader/exthandler/tests/mochitest/redirect_helper.sjs deleted file mode 100644 index 1d66c1e9316b..000000000000 --- a/uriloader/exthandler/tests/mochitest/redirect_helper.sjs +++ /dev/null @@ -1,12 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -Cu.importGlobalProperties(["URLSearchParams"]); - -function handleRequest(request, response) { - response.setStatusLine(request.httpVersion, 302, "Moved Temporarily"); - response.setHeader("Location", new URLSearchParams(request.queryString).get("uri")); -} -