Index: lib/typoFixer.js |
=================================================================== |
--- a/lib/typoFixer.js |
+++ b/lib/typoFixer.js |
@@ -3,19 +3,18 @@ |
* You can obtain one at http://mozilla.org/MPL/2.0/. */ |
Cu.import("resource://gre/modules/Services.jsm"); |
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
let {Prefs} = require("prefs"); |
let {WindowObserver} = require("windowObserver"); |
let {getSchemeCorrection, isKnownScheme, getDomainCorrection, getDomainReferral} = require("rules"); |
-let {processTypedDomain} = require("typedItCollector"); |
-let {processUserCorrection} = require("typedItCollector"); |
-let {processFalsePositive} = require("typedItCollector"); |
+let {processTypedDomain, processDomainCorrection, |
+ processUserCorrection, processFalsePositive} = require("typedItCollector"); |
let appIntegration = require("appIntegration"); |
// Attach our handlers to all browser windows |
new WindowObserver( |
{ |
applyToWindow: function(window) |
{ |
if (!appIntegration.isKnownWindow(window)) |
@@ -89,17 +88,16 @@ function handlePageLoad(event) |
{ |
let newURL = textField.value.replace(/^\s+/, "").replace(/\s+$/, ""); |
if (!newURL.length) |
return; |
let [prefix, newHost, suffix] = parseURL(newURL); |
let oldHost = document.defaultView.location.hostname.toLowerCase(); |
- processTypedDomain(newHost); |
processUserCorrection(oldHost, newHost); |
if (newHost.indexOf("www.") == 0 && oldHost.indexOf("www.") == 0) |
{ |
// Ignore www. prefix if they both start with it |
newHost = newHost.substr(4); |
oldHost = oldHost.substr(4); |
} |
@@ -187,16 +185,17 @@ function correctURL(window, value) |
let oldDomain = domain; |
if (!isIPAddress(domain)) |
{ |
processTypedDomain(domain); |
let newDomain = getDomainCorrection(domain); |
if (newDomain != domain) |
{ |
+ processDomainCorrection(domain, newDomain); |
domain = newDomain; |
hasCorrection = true; |
let referral = getDomainReferral(domain.replace(/^www\./, "")); |
if (referral) |
{ |
// We need to add a query string parameter when sending users to this domain |
let anchorIndex = suffix.indexOf("#"); |
@@ -249,28 +248,24 @@ function correctURL(window, value) |
// No: Add to list of corrections (ignore) |
let {onWhitelistEntryAdded} = require("rules"); |
let entry = oldDomain.replace(/^www\./, ""); |
Prefs.whitelist[entry] = true; |
onWhitelistEntryAdded(entry); |
Prefs.whitelist = JSON.parse(JSON.stringify(Prefs.whitelist)); |
require("appIntegration").loadURI(window, value); |
- processFalsePositive(oldDomain, domain); |
+ processFalsePositive(domain, oldDomain); |
} |
} |
]; |
require("appIntegration").openInfobar(window, "url-fixer-infobar-askafter", message, buttons, 1); |
require("survey").incrementCorrectionsCounter(); |
- // Consider the correction a second typed domain |
- if (!isIPAddress(domain)) |
- processTypedDomain(domain); |
- |
return prefix + domain + suffix; |
} |
let stringBundle = null; |
function getInfobarTexts() |
{ |
// Randomize URI to work around bug 719376 |