| LEFT | RIGHT |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 Cu.import("resource://gre/modules/Services.jsm"); | 5 Cu.import("resource://gre/modules/Services.jsm"); |
| 6 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 6 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
| 7 | 7 |
| 8 let {Prefs} = require("prefs"); | 8 let {Prefs} = require("prefs"); |
| 9 let {WindowObserver} = require("windowObserver"); | 9 let {WindowObserver} = require("windowObserver"); |
| 10 let {getSchemeCorrection, isKnownScheme, getDomainCorrection, getDomainReferral,
onWhitelistEntryAdded} = require("typoRules"); | 10 let {getSchemeCorrection, isKnownScheme, getDomainCorrection, getDomainReferral,
onWhitelistEntryAdded} = require("typoRules"); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 suffix += anchor; | 136 suffix += anchor; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (!hasCorrection) | 141 if (!hasCorrection) |
| 142 return null; | 142 return null; |
| 143 | 143 |
| 144 if (!appIntegration.isTypoCorrectionEnabled(window, prefix, domain, suffix)) | 144 if (!appIntegration.isTypoCorrectionEnabled(window, prefix, domain, suffix)) |
| 145 return; | 145 return null; |
| 146 | 146 |
| 147 // Show infobar to inform and ask about correction | 147 // Show infobar to inform and ask about correction |
| 148 let [message, yes, no] = getInfobarTexts(); | 148 let [message, yes, no] = getInfobarTexts(); |
| 149 message = message.replace(/\?1\?/g, prefix+domain); | 149 message = message.replace(/\?1\?/g, prefix+domain); |
| 150 let buttons = [ | 150 let buttons = [ |
| 151 { | 151 { |
| 152 label: yes, | 152 label: yes, |
| 153 accessKey: null, | 153 accessKey: null, |
| 154 callback: function() | 154 callback: function() |
| 155 { | 155 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 stringBundle = Services.strings.createBundle("chrome://" + require("info").a
ddonName + "/locale/typo.properties?" + Math.random()); | 189 stringBundle = Services.strings.createBundle("chrome://" + require("info").a
ddonName + "/locale/typo.properties?" + Math.random()); |
| 190 let result = [ | 190 let result = [ |
| 191 stringBundle.GetStringFromName("urlfixer.isItCorrect"), | 191 stringBundle.GetStringFromName("urlfixer.isItCorrect"), |
| 192 stringBundle.GetStringFromName("urlfixer.yes"), | 192 stringBundle.GetStringFromName("urlfixer.yes"), |
| 193 stringBundle.GetStringFromName("urlfixer.no") | 193 stringBundle.GetStringFromName("urlfixer.no") |
| 194 ]; | 194 ]; |
| 195 | 195 |
| 196 getInfobarTexts = function() result; | 196 getInfobarTexts = function() result; |
| 197 return getInfobarTexts(); | 197 return getInfobarTexts(); |
| 198 } | 198 } |
| LEFT | RIGHT |