| Index: lib/typoFixer.js |
| =================================================================== |
| --- a/lib/typoFixer.js |
| +++ b/lib/typoFixer.js |
| @@ -8,9 +8,8 @@ |
| 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 |
| @@ -94,7 +93,6 @@ |
| 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) |
| @@ -143,7 +141,7 @@ |
| function correctURL(window, value) |
| { |
| let hasCorrection = false; |
| - |
| + |
| value = value.trim(); |
| if (value.length == 0) |
| return null; |
| @@ -179,7 +177,7 @@ |
| // Check manually entered corrections |
| if (Prefs.custom_replace.hasOwnProperty(value) && Prefs.custom_replace[value]) |
| return Prefs.custom_replace[value]; |
| - |
| + |
| let [prefix, domain, suffix] = parseURL(value); |
| if (!domain) |
| return null; |
| @@ -192,6 +190,7 @@ |
| let newDomain = getDomainCorrection(domain); |
| if (newDomain != domain) |
| { |
| + processDomainCorrection(domain, newDomain); |
| domain = newDomain; |
| hasCorrection = true; |
| @@ -247,15 +246,14 @@ |
| callback: function() |
| { |
| // No: Add to list of corrections (ignore) |
| - if (/^www\./.test(value)) |
| - { |
| - value = value.substr(4); |
| - } |
| - Prefs.whitelist[value] = value; |
| + 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(value); |
| - processFalsePositive(oldDomain, domain); |
| + require("appIntegration").loadURI(window, value); |
| + processFalsePositive(domain, oldDomain); |
| } |
| } |
| ]; |
| @@ -263,10 +261,6 @@ |
| require("survey").incrementCorrectionsCounter(); |
| - // Consider the correction a second typed domain |
| - if (!isIPAddress(domain)) |
| - processTypedDomain(domain); |
| - |
| return prefix + domain + suffix; |
| } |