From b4ec5e858fc100651419a9b85b0965c181a3a08f Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Mon, 7 Dec 2020 01:54:05 +0000 Subject: [PATCH] Bug 1638215: Use https for canonization the URL. r=mak Differential Revision: https://phabricator.services.mozilla.com/D97942 --- .../test/general/browser_newTabDrop.js | 48 ++++++------ .../test/general/browser_newWindowDrop.js | 44 +++++------ .../content/test/general/browser_tabDrop.js | 43 +++++----- browser/components/urlbar/UrlbarInput.jsm | 13 +++- .../browser/browser_autoFill_canonize.js | 4 +- .../tests/browser/browser_canonizeURL.js | 26 +++---- .../browser/browser_searchSuggestions.js | 4 +- .../browser_updateForDomainCompletion.js | 10 +-- .../browser/browser_urlbar_event_telemetry.js | 5 +- docshell/base/URIFixup.jsm | 7 ++ docshell/test/unit/test_URIFixup_info.js | 78 +++++++++---------- modules/libpref/init/all.js | 1 + 12 files changed, 155 insertions(+), 128 deletions(-) diff --git a/browser/base/content/test/general/browser_newTabDrop.js b/browser/base/content/test/general/browser_newTabDrop.js index eed0821c71b7..3231f07c3fb0 100644 --- a/browser/base/content/test/general/browser_newTabDrop.js +++ b/browser/base/content/test/general/browser_newTabDrop.js @@ -26,20 +26,20 @@ add_task(async function test_setup() { // New Tab Button opens any link. add_task(async function single_url() { - await dropText("mochi.test/first", ["http://www.mochi.test/first"]); + await dropText("mochi.test/first", ["https://www.mochi.test/first"]); }); add_task(async function single_url2() { - await dropText("mochi.test/second", ["http://www.mochi.test/second"]); + await dropText("mochi.test/second", ["https://www.mochi.test/second"]); }); add_task(async function single_url3() { - await dropText("mochi.test/third", ["http://www.mochi.test/third"]); + await dropText("mochi.test/third", ["https://www.mochi.test/third"]); }); // Single text/plain item, with multiple links. add_task(async function multiple_urls() { await dropText("mochi.test/1\nmochi.test/2", [ - "http://www.mochi.test/1", - "http://www.mochi.test/2", + "https://www.mochi.test/1", + "https://www.mochi.test/2", ]); }); @@ -51,9 +51,9 @@ add_task(async function multiple_items_single_and_multiple_links() { [{ type: "text/plain", data: "mochi.test/6\nmochi.test/7" }], ], [ - "http://www.mochi.test/5", - "http://www.mochi.test/6", - "http://www.mochi.test/7", + "https://www.mochi.test/5", + "https://www.mochi.test/6", + "https://www.mochi.test/7", ] ); }); @@ -70,7 +70,7 @@ add_task(async function single_moz_url_multiple_links() { }, ], ], - ["http://www.mochi.test/8", "http://www.mochi.test/9"] + ["https://www.mochi.test/8", "https://www.mochi.test/9"] ); }); @@ -83,7 +83,7 @@ add_task(async function single_item_multiple_types() { { type: "text/x-moz-url", data: "mochi.test/11\nTITLE11" }, ], ], - ["http://www.mochi.test/11"] + ["https://www.mochi.test/11"] ); }); @@ -94,11 +94,11 @@ add_task(async function multiple_tabs_under_max() { urls.push("mochi.test/multi" + i); } await dropText(urls.join("\n"), [ - "http://www.mochi.test/multi0", - "http://www.mochi.test/multi1", - "http://www.mochi.test/multi2", - "http://www.mochi.test/multi3", - "http://www.mochi.test/multi4", + "https://www.mochi.test/multi0", + "https://www.mochi.test/multi1", + "https://www.mochi.test/multi2", + "https://www.mochi.test/multi3", + "https://www.mochi.test/multi4", ]); }); add_task(async function multiple_tabs_over_max_accept() { @@ -111,11 +111,11 @@ add_task(async function multiple_tabs_over_max_accept() { urls.push("mochi.test/accept" + i); } await dropText(urls.join("\n"), [ - "http://www.mochi.test/accept0", - "http://www.mochi.test/accept1", - "http://www.mochi.test/accept2", - "http://www.mochi.test/accept3", - "http://www.mochi.test/accept4", + "https://www.mochi.test/accept0", + "https://www.mochi.test/accept1", + "https://www.mochi.test/accept2", + "https://www.mochi.test/accept3", + "https://www.mochi.test/accept4", ]); await confirmPromise; @@ -151,10 +151,10 @@ add_task(async function multiple_urls() { non url2 `, [ - "http://www.mochi.test/urls0", - "http://www.mochi.test/urls1", - "http://www.mochi.test/urls2", - "http://www.mochi.test/urls3", + "https://www.mochi.test/urls0", + "https://www.mochi.test/urls1", + "https://www.mochi.test/urls2", + "https://www.mochi.test/urls3", ] ); }); diff --git a/browser/base/content/test/general/browser_newWindowDrop.js b/browser/base/content/test/general/browser_newWindowDrop.js index 2754a737e9c2..129e0f40d9a2 100644 --- a/browser/base/content/test/general/browser_newWindowDrop.js +++ b/browser/base/content/test/general/browser_newWindowDrop.js @@ -38,7 +38,7 @@ add_task(async function test_setup() { // New Window Button opens any link. add_task(async function single_url() { - await dropText("mochi.test/first", ["http://www.mochi.test/first"]); + await dropText("mochi.test/first", ["https://www.mochi.test/first"]); }); add_task(async function single_javascript() { await dropText("javascript:'bad'", ["about:blank"]); @@ -47,31 +47,31 @@ add_task(async function single_javascript_capital() { await dropText("jAvascript:'bad'", ["about:blank"]); }); add_task(async function single_url2() { - await dropText("mochi.test/second", ["http://www.mochi.test/second"]); + await dropText("mochi.test/second", ["https://www.mochi.test/second"]); }); add_task(async function single_data_url() { await dropText("data:text/html,bad", ["data:text/html,bad"]); }); add_task(async function single_url3() { - await dropText("mochi.test/third", ["http://www.mochi.test/third"]); + await dropText("mochi.test/third", ["https://www.mochi.test/third"]); }); // Single text/plain item, with multiple links. add_task(async function multiple_urls() { await dropText("mochi.test/1\nmochi.test/2", [ - "http://www.mochi.test/1", - "http://www.mochi.test/2", + "https://www.mochi.test/1", + "https://www.mochi.test/2", ]); }); add_task(async function multiple_urls_javascript() { await dropText("javascript:'bad1'\nmochi.test/3", [ "about:blank", - "http://www.mochi.test/3", + "https://www.mochi.test/3", ]); }); add_task(async function multiple_urls_data() { await dropText("mochi.test/4\ndata:text/html,bad1", [ - "http://www.mochi.test/4", + "https://www.mochi.test/4", "data:text/html,bad1", ]); }); @@ -84,9 +84,9 @@ add_task(async function multiple_items_single_and_multiple_links() { [{ type: "text/plain", data: "mochi.test/6\nmochi.test/7" }], ], [ - "http://www.mochi.test/5", - "http://www.mochi.test/6", - "http://www.mochi.test/7", + "https://www.mochi.test/5", + "https://www.mochi.test/6", + "https://www.mochi.test/7", ] ); }); @@ -103,7 +103,7 @@ add_task(async function single_moz_url_multiple_links() { }, ], ], - ["http://www.mochi.test/8", "http://www.mochi.test/9"] + ["https://www.mochi.test/8", "https://www.mochi.test/9"] ); }); @@ -116,7 +116,7 @@ add_task(async function single_item_multiple_types() { { type: "text/x-moz-url", data: "mochi.test/11\nTITLE11" }, ], ], - ["http://www.mochi.test/11"] + ["https://www.mochi.test/11"] ); }); @@ -127,11 +127,11 @@ add_task(async function multiple_tabs_under_max() { urls.push("mochi.test/multi" + i); } await dropText(urls.join("\n"), [ - "http://www.mochi.test/multi0", - "http://www.mochi.test/multi1", - "http://www.mochi.test/multi2", - "http://www.mochi.test/multi3", - "http://www.mochi.test/multi4", + "https://www.mochi.test/multi0", + "https://www.mochi.test/multi1", + "https://www.mochi.test/multi2", + "https://www.mochi.test/multi3", + "https://www.mochi.test/multi4", ]); }); add_task(async function multiple_tabs_over_max_accept() { @@ -146,11 +146,11 @@ add_task(async function multiple_tabs_over_max_accept() { await dropText( urls.join("\n"), [ - "http://www.mochi.test/accept0", - "http://www.mochi.test/accept1", - "http://www.mochi.test/accept2", - "http://www.mochi.test/accept3", - "http://www.mochi.test/accept4", + "https://www.mochi.test/accept0", + "https://www.mochi.test/accept1", + "https://www.mochi.test/accept2", + "https://www.mochi.test/accept3", + "https://www.mochi.test/accept4", ], true ); diff --git a/browser/base/content/test/general/browser_tabDrop.js b/browser/base/content/test/general/browser_tabDrop.js index 64e4ebc2a897..8746f01d5196 100644 --- a/browser/base/content/test/general/browser_tabDrop.js +++ b/browser/base/content/test/general/browser_tabDrop.js @@ -1,3 +1,6 @@ +// TODO (Bug 1680996): Investigate why this test takes a long time. +requestLongerTimeout(2); + const ANY_URL = undefined; registerCleanupFunction(async function cleanup() { @@ -22,7 +25,7 @@ add_task(async function test_setup() { }); add_task(async function single_url() { - await dropText("mochi.test/first", ["http://www.mochi.test/first"]); + await dropText("mochi.test/first", ["https://www.mochi.test/first"]); }); add_task(async function single_javascript() { await dropText("javascript:'bad'", []); @@ -34,20 +37,20 @@ add_task(async function single_search() { await dropText("search this", [ANY_URL]); }); add_task(async function single_url2() { - await dropText("mochi.test/second", ["http://www.mochi.test/second"]); + await dropText("mochi.test/second", ["https://www.mochi.test/second"]); }); add_task(async function single_data_url() { await dropText("data:text/html,bad", []); }); add_task(async function single_url3() { - await dropText("mochi.test/third", ["http://www.mochi.test/third"]); + await dropText("mochi.test/third", ["https://www.mochi.test/third"]); }); // Single text/plain item, with multiple links. add_task(async function multiple_urls() { await dropText("mochi.test/1\nmochi.test/2", [ - "http://www.mochi.test/1", - "http://www.mochi.test/2", + "https://www.mochi.test/1", + "https://www.mochi.test/2", ]); }); add_task(async function multiple_urls_javascript() { @@ -65,9 +68,9 @@ add_task(async function multiple_items_single_and_multiple_links() { [{ type: "text/plain", data: "mochi.test/6\nmochi.test/7" }], ], [ - "http://www.mochi.test/5", - "http://www.mochi.test/6", - "http://www.mochi.test/7", + "https://www.mochi.test/5", + "https://www.mochi.test/6", + "https://www.mochi.test/7", ] ); }); @@ -84,7 +87,7 @@ add_task(async function single_moz_url_multiple_links() { }, ], ], - ["http://www.mochi.test/8", "http://www.mochi.test/9"] + ["https://www.mochi.test/8", "https://www.mochi.test/9"] ); }); @@ -97,7 +100,7 @@ add_task(async function single_item_multiple_types() { { type: "text/x-moz-url", data: "mochi.test/11\nTITLE11" }, ], ], - ["http://www.mochi.test/11"] + ["https://www.mochi.test/11"] ); }); @@ -108,11 +111,11 @@ add_task(async function multiple_tabs_under_max() { urls.push("mochi.test/multi" + i); } await dropText(urls.join("\n"), [ - "http://www.mochi.test/multi0", - "http://www.mochi.test/multi1", - "http://www.mochi.test/multi2", - "http://www.mochi.test/multi3", - "http://www.mochi.test/multi4", + "https://www.mochi.test/multi0", + "https://www.mochi.test/multi1", + "https://www.mochi.test/multi2", + "https://www.mochi.test/multi3", + "https://www.mochi.test/multi4", ]); }); add_task(async function multiple_tabs_over_max_accept() { @@ -125,11 +128,11 @@ add_task(async function multiple_tabs_over_max_accept() { urls.push("mochi.test/accept" + i); } await dropText(urls.join("\n"), [ - "http://www.mochi.test/accept0", - "http://www.mochi.test/accept1", - "http://www.mochi.test/accept2", - "http://www.mochi.test/accept3", - "http://www.mochi.test/accept4", + "https://www.mochi.test/accept0", + "https://www.mochi.test/accept1", + "https://www.mochi.test/accept2", + "https://www.mochi.test/accept3", + "https://www.mochi.test/accept4", ]); await confirmPromise; diff --git a/browser/components/urlbar/UrlbarInput.jsm b/browser/components/urlbar/UrlbarInput.jsm index 0ee41309bcb9..7565416c0324 100644 --- a/browser/components/urlbar/UrlbarInput.jsm +++ b/browser/components/urlbar/UrlbarInput.jsm @@ -2265,7 +2265,18 @@ class UrlbarInput { } else { value = value + suffix; } - value = "http://www." + value; + + try { + const info = Services.uriFixup.getFixupURIInfo( + value, + Ci.nsIURIFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI + ); + value = info.fixedURI.spec; + } catch (ex) { + Cu.reportError( + `An error occured while trying to fixup "${value}": ${ex}` + ); + } this.value = value; return value; diff --git a/browser/components/urlbar/tests/browser/browser_autoFill_canonize.js b/browser/components/urlbar/tests/browser/browser_autoFill_canonize.js index 911b015edc67..099fc904176c 100644 --- a/browser/components/urlbar/tests/browser/browser_autoFill_canonize.js +++ b/browser/components/urlbar/tests/browser/browser_autoFill_canonize.js @@ -55,8 +55,8 @@ add_task(async function() { desc: "CTRL+ENTER on the autofilled part should bypass autofill", typed: "exam", autofilled: "example.com/", - modified: "www.exam.com", - waitForUrl: "http://www.exam.com/", + modified: "https://www.exam.com", + waitForUrl: "https://www.exam.com/", keys: [["KEY_Enter", { ctrlKey: true }]], }); }); diff --git a/browser/components/urlbar/tests/browser/browser_canonizeURL.js b/browser/components/urlbar/tests/browser/browser_canonizeURL.js index 0082ea86d78a..e15f6a393e5a 100644 --- a/browser/components/urlbar/tests/browser/browser_canonizeURL.js +++ b/browser/components/urlbar/tests/browser/browser_canonizeURL.js @@ -15,15 +15,15 @@ add_task(async function checkCtrlWorks() { let defaultEngine = await Services.search.getDefault(); let testcases = [ - ["example", "http://www.example.com/", { ctrlKey: true }], + ["example", "https://www.example.com/", { ctrlKey: true }], // Check that a direct load is not overwritten by a previous canonization. ["http://example.com/test/", "http://example.com/test/", {}], - ["ex-ample", "http://www.ex-ample.com/", { ctrlKey: true }], - [" example ", "http://www.example.com/", { ctrlKey: true }], - [" example/foo ", "http://www.example.com/foo", { ctrlKey: true }], + ["ex-ample", "https://www.ex-ample.com/", { ctrlKey: true }], + [" example ", "https://www.example.com/", { ctrlKey: true }], + [" example/foo ", "https://www.example.com/foo", { ctrlKey: true }], [ " example/foo bar ", - "http://www.example.com/foo%20bar", + "https://www.example.com/foo%20bar", { ctrlKey: true }, ], ["example.net", "http://example.net/", { ctrlKey: true }], @@ -158,11 +158,11 @@ add_task(async function autofill() { ]); let testcases = [ - ["ex", "http://www.ex.com/", { ctrlKey: true }], + ["ex", "https://www.ex.com/", { ctrlKey: true }], // Check that a direct load is not overwritten by a previous canonization. ["ex", "http://example.com/", {}], // search alias - ["@goo", "http://www%2E@goo.com/", { ctrlKey: true }], + ["@goo", "https://www.goo.com/", { ctrlKey: true }], ]; function promiseAutofill() { @@ -232,13 +232,13 @@ add_task(async function() { EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" }); info("Send enter key with the ctrl"); - EventUtils.synthesizeKey("VK_RETURN", { type: "keydown", ctrlKey: true }); - await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); - is( - gBrowser.selectedBrowser.documentURI.spec, - `http://www.${testWord}.com/`, - "The loaded url is canonized" + const onLoad = BrowserTestUtils.waitForDocLoadAndStopIt( + `https://www.${testWord}.com/`, + gBrowser.selectedBrowser ); + EventUtils.synthesizeKey("VK_RETURN", { type: "keydown", ctrlKey: true }); + await onLoad; + info("The loaded url is canonized"); }); function simulatePastingToUrlbar(text) { diff --git a/browser/components/urlbar/tests/browser/browser_searchSuggestions.js b/browser/components/urlbar/tests/browser/browser_searchSuggestions.js index 685a5d46459e..d32512978866 100644 --- a/browser/components/urlbar/tests/browser/browser_searchSuggestions.js +++ b/browser/components/urlbar/tests/browser/browser_searchSuggestions.js @@ -132,7 +132,9 @@ add_task(async function plainEnterOnSuggestion() { }); add_task(async function ctrlEnterOnSuggestion() { - await testPressEnterOnSuggestion("http://www.foofoo.com/", { ctrlKey: true }); + await testPressEnterOnSuggestion("https://www.foofoo.com/", { + ctrlKey: true, + }); }); add_task(async function copySuggestionText() { diff --git a/browser/components/urlbar/tests/browser/browser_updateForDomainCompletion.js b/browser/components/urlbar/tests/browser/browser_updateForDomainCompletion.js index 33ef9214563c..27b097cdd742 100644 --- a/browser/components/urlbar/tests/browser/browser_updateForDomainCompletion.js +++ b/browser/components/urlbar/tests/browser/browser_updateForDomainCompletion.js @@ -11,14 +11,14 @@ add_task(async function() { async function(browser) { gURLBar.value = "example"; gURLBar.select(); - let loadPromise = BrowserTestUtils.browserLoaded( - browser, - false, - url => url == "http://www.example.com/" + const loadPromise = BrowserTestUtils.waitForDocLoadAndStopIt( + "https://www.example.com/", + gBrowser.selectedBrowser ); + EventUtils.sendKey("return"); await loadPromise; - is(gURLBar.value, "www.example.com"); + ok(true, "https://www.example.com is loaded correctly"); } ); }); diff --git a/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js b/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js index a43c66d61a57..a5ab5ada82ec 100644 --- a/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js +++ b/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js @@ -387,7 +387,10 @@ const tests = [ async function(win) { info("Type something and canonize"); win.gURLBar.select(); - let promise = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser); + const promise = BrowserTestUtils.waitForDocLoadAndStopIt( + "https://www.example.com/", + gBrowser.selectedBrowser + ); await UrlbarTestUtils.promiseAutocompleteResultPopup({ window: win, value: "example", diff --git a/docshell/base/URIFixup.jsm b/docshell/base/URIFixup.jsm index 5d341b485ea6..14ca2df86586 100644 --- a/docshell/base/URIFixup.jsm +++ b/docshell/base/URIFixup.jsm @@ -67,6 +67,12 @@ XPCOMUtils.defineLazyPreferenceGetter( "browser.fixup.alternate.enabled", true ); +XPCOMUtils.defineLazyPreferenceGetter( + this, + "alternateProtocol", + "browser.fixup.alternate.protocol", + "https" +); const { FIXUP_FLAG_NONE, @@ -780,6 +786,7 @@ function maybeSetAlternateFixedURI(info, fixupFlags) { try { info.fixedURI = uri .mutate() + .setScheme(alternateProtocol) .setHost(newHost) .finalize(); } catch (ex) { diff --git a/docshell/test/unit/test_URIFixup_info.js b/docshell/test/unit/test_URIFixup_info.js index 40ca898f1f6f..f2dc18f54e7a 100644 --- a/docshell/test/unit/test_URIFixup_info.js +++ b/docshell/test/unit/test_URIFixup_info.js @@ -59,12 +59,12 @@ var testcases = [ { input: "http://mozilla/", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", }, { input: "http://test./", fixedURI: "http://test./", - alternateURI: "http://www.test./", + alternateURI: "https://www.test./", }, { input: "127.0.0.1", @@ -234,13 +234,13 @@ var testcases = [ { input: "whitelisted/foo.txt", fixedURI: "http://whitelisted/foo.txt", - alternateURI: "http://www.whitelisted.com/foo.txt", + alternateURI: "https://www.whitelisted.com/foo.txt", protocolChange: true, }, { input: "mozilla", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -248,7 +248,7 @@ var testcases = [ { input: "test.", fixedURI: "http://test./", - alternateURI: "http://www.test./", + alternateURI: "https://www.test./", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -256,7 +256,7 @@ var testcases = [ { input: ".test", fixedURI: "http://.test/", - alternateURI: "http://www..test/", + alternateURI: "https://www..test/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -284,7 +284,7 @@ var testcases = [ { input: "mozilla ", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -292,7 +292,7 @@ var testcases = [ { input: " mozilla ", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -312,7 +312,7 @@ var testcases = [ { input: "mozilla\n", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -320,7 +320,7 @@ var testcases = [ { input: "mozilla \r\n", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -328,7 +328,7 @@ var testcases = [ { input: "moz\r\nfirefox\nos\r", fixedURI: "http://mozfirefoxos/", - alternateURI: "http://www.mozfirefoxos.com/", + alternateURI: "https://www.mozfirefoxos.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -348,27 +348,27 @@ var testcases = [ { input: "http://whitelisted/", fixedURI: "http://whitelisted/", - alternateURI: "http://www.whitelisted.com/", + alternateURI: "https://www.whitelisted.com/", inWhitelist: true, }, { input: "whitelisted", fixedURI: "http://whitelisted/", - alternateURI: "http://www.whitelisted.com/", + alternateURI: "https://www.whitelisted.com/", protocolChange: true, inWhitelist: true, }, { input: "whitelisted.", fixedURI: "http://whitelisted./", - alternateURI: "http://www.whitelisted./", + alternateURI: "https://www.whitelisted./", protocolChange: true, inWhitelist: true, }, { input: "mochi.test", fixedURI: "http://mochi.test/", - alternateURI: "http://www.mochi.test/", + alternateURI: "https://www.mochi.test/", protocolChange: true, inWhitelist: true, }, @@ -383,7 +383,7 @@ var testcases = [ { input: "some.domain", fixedURI: "http://some.domain/", - alternateURI: "http://www.some.domain/", + alternateURI: "https://www.some.domain/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -391,13 +391,13 @@ var testcases = [ { input: "café.com", fixedURI: "http://xn--caf-dma.com/", - alternateURI: "http://www.xn--caf-dma.com/", + alternateURI: "https://www.xn--caf-dma.com/", protocolChange: true, }, { input: "mozilla.nonexistent", fixedURI: "http://mozilla.nonexistent/", - alternateURI: "http://www.mozilla.nonexistent/", + alternateURI: "https://www.mozilla.nonexistent/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -405,7 +405,7 @@ var testcases = [ { input: "mochi.ocm", fixedURI: "http://mochi.com/", - alternateURI: "http://www.mochi.com/", + alternateURI: "https://www.mochi.com/", protocolChange: true, }, { @@ -439,7 +439,7 @@ var testcases = [ { input: "5+2", fixedURI: "http://5+2/", - alternateURI: "http://www.5+2.com/", + alternateURI: "https://www.5+2.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -458,13 +458,13 @@ var testcases = [ { input: "mozilla.com/?q=search", fixedURI: "http://mozilla.com/?q=search", - alternateURI: "http://www.mozilla.com/?q=search", + alternateURI: "https://www.mozilla.com/?q=search", protocolChange: true, }, { input: "mozilla.com?q=search", fixedURI: "http://mozilla.com/?q=search", - alternateURI: "http://www.mozilla.com/?q=search", + alternateURI: "https://www.mozilla.com/?q=search", protocolChange: true, }, { @@ -479,7 +479,7 @@ var testcases = [ { input: "mozilla.com'?q=search", fixedURI: "http://mozilla.com/?q=search", - alternateURI: "http://www.mozilla.com/?q=search", + alternateURI: "https://www.mozilla.com/?q=search", protocolChange: true, }, { @@ -493,7 +493,7 @@ var testcases = [ { input: "':?", fixedURI: "http://'/?", - alternateURI: "http://www.'.com/?", + alternateURI: "https://www.'.com/?", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -501,7 +501,7 @@ var testcases = [ { input: "whitelisted?.com", fixedURI: "http://whitelisted/?.com", - alternateURI: "http://www.whitelisted.com/?.com", + alternateURI: "https://www.whitelisted.com/?.com", protocolChange: true, }, { @@ -523,13 +523,13 @@ var testcases = [ { input: "mozilla/", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", protocolChange: true, }, { input: "mozilla", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", protocolChange: true, keywordLookup: true, affectedByDNSForSingleWordHosts: true, @@ -537,7 +537,7 @@ var testcases = [ { input: "mozilla5/2", fixedURI: "http://mozilla5/2", - alternateURI: "http://www.mozilla5.com/2", + alternateURI: "https://www.mozilla5.com/2", protocolChange: true, keywordLookup: true, affectedByDNSForSingleWordHosts: true, @@ -545,7 +545,7 @@ var testcases = [ { input: "mozilla/foo", fixedURI: "http://mozilla/foo", - alternateURI: "http://www.mozilla.com/foo", + alternateURI: "https://www.mozilla.com/foo", protocolChange: true, keywordLookup: true, affectedByDNSForSingleWordHosts: true, @@ -553,7 +553,7 @@ var testcases = [ { input: "mozilla\\", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -588,7 +588,7 @@ var testcases = [ { input: "plonk/ #", fixedURI: "http://plonk/%20#", - alternateURI: "http://www.plonk.com/%20#", + alternateURI: "https://www.plonk.com/%20#", protocolChange: true, keywordLookup: false, }, @@ -601,13 +601,13 @@ var testcases = [ input: "\u10E0\u10D4\u10D2\u10D8\u10E1\u10E2\u10E0\u10D0\u10EA\u10D8\u10D0.\u10D2\u10D4", fixedURI: "http://xn--lodaehvb5cdik4g.xn--node/", - alternateURI: "http://www.xn--lodaehvb5cdik4g.xn--node/", + alternateURI: "https://www.xn--lodaehvb5cdik4g.xn--node/", protocolChange: true, }, { input: " \t mozilla.org/\t \t ", fixedURI: "http://mozilla.org/", - alternateURI: "http://www.mozilla.org/", + alternateURI: "https://www.mozilla.org/", protocolChange: true, }, { @@ -617,13 +617,13 @@ var testcases = [ { input: "mozilla/", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", protocolChange: true, }, { input: "mozilla/ test /", fixedURI: "http://mozilla/%20test%20/", - alternateURI: "http://www.mozilla.com/%20test%20/", + alternateURI: "https://www.mozilla.com/%20test%20/", protocolChange: true, }, { @@ -638,7 +638,7 @@ var testcases = [ { input: "http;mozilla", fixedURI: "http://http;mozilla/", - alternateURI: "http://www.http;mozilla.com/", + alternateURI: "https://www.http;mozilla.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -652,7 +652,7 @@ var testcases = [ { input: "http//mozilla.org", fixedURI: "http://http//mozilla.org", - alternateURI: "http://www.http.com//mozilla.org", + alternateURI: "https://www.http.com//mozilla.org", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, @@ -675,13 +675,13 @@ if (AppConstants.platform == "win") { testcases.push({ input: "//mozilla", fixedURI: "http://mozilla/", - alternateURI: "http://www.mozilla.com/", + alternateURI: "https://www.mozilla.com/", protocolChange: true, }); testcases.push({ input: "/a", fixedURI: "http://a/", - alternateURI: "http://www.a.com/", + alternateURI: "https://www.a.com/", keywordLookup: true, protocolChange: true, affectedByDNSForSingleWordHosts: true, diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index a42f23728439..4a950cf41fd7 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -911,6 +911,7 @@ pref("nglayout.debug.paint_flashing_chrome", false); // URI fixup prefs pref("browser.fixup.alternate.enabled", true); pref("browser.fixup.alternate.prefix", "www."); +pref("browser.fixup.alternate.protocol", "https"); pref("browser.fixup.alternate.suffix", ".com"); pref("browser.fixup.fallback-to-https", true);