| Index: lib/typoFixer.js |
| =================================================================== |
| --- a/lib/typoFixer.js |
| +++ b/lib/typoFixer.js |
| @@ -27,44 +27,44 @@ let netError = require("typoNetError"); |
| let typoWindowObserver = null; |
| exports.attachWindowObserver = attachWindowObserver; |
| function attachWindowObserver() |
| { |
| if (typoWindowObserver) |
| return; |
| - |
| + |
| // Attach our handlers to all browser windows |
| typoWindowObserver = new WindowObserver({ |
| applyToWindow: function(window) |
| { |
| if (!appIntegration.isKnownWindow(window)) |
| return; |
| - |
| + |
| appIntegration.applyToWindow(window, correctURL); |
| }, |
| removeFromWindow: function(window) |
| { |
| if (!appIntegration.isKnownWindow(window)) |
| return; |
| - |
| + |
| appIntegration.removeFromWindow(window); |
| } |
| }); |
| } |
| attachWindowObserver(); |
| exports.detachWindowObserver = detachWindowObserver; |
| function detachWindowObserver() |
| { |
| if (!typoWindowObserver) |
| return; |
| - |
| + |
| // Detach our handlers from all browser windows |
| typoWindowObserver.shutdown(); |
| typoWindowObserver = null; |
| } |
| function parseURL(url) |
| { |
| if (/^\s*((?:\w+:)?\/*(?:[^\/#]*@)?)([^\/:#]*)/.test(url)) |
| @@ -169,17 +169,17 @@ function correctURL(window, value) |
| suffix += anchor; |
| } |
| } |
| } |
| if (!hasCorrection) |
| return null; |
| - |
| + |
| if (!appIntegration.isTypoCorrectionEnabled(window, prefix, domain, suffix)) |
| return null; |
| // Show infobar to inform and ask about correction |
| let [message, yes, no] = getInfobarTexts(); |
| message = message.replace(/\?1\?/g, prefix+domain); |
| let buttons = [ |
| { |
| @@ -222,11 +222,11 @@ function getInfobarTexts() |
| if (!stringBundle) |
| stringBundle = Services.strings.createBundle("chrome://" + require("info").addonName + "/locale/typo.properties?" + Math.random()); |
| let result = [ |
| stringBundle.GetStringFromName("urlfixer.isItCorrect"), |
| stringBundle.GetStringFromName("urlfixer.yes"), |
| stringBundle.GetStringFromName("urlfixer.no") |
| ]; |
| - getInfobarTexts = function() result; |
| + getInfobarTexts = () => result; |
| return getInfobarTexts(); |
| } |