Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typoFixer.js

Issue 8554013: Renamed necessary components for ABP integration (Closed)
Patch Set: Created Oct. 10, 2012, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/typoAppIntegration.js ('k') | lib/typoRules.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, onWhitelistEntryRemoved} = require("rules"); 10 let {getSchemeCorrection, isKnownScheme, getDomainCorrection, getDomainReferral, onWhitelistEntryRemoved} = require("typoRules");
11 let {processTypedDomain, processDomainCorrection, 11 let {processTypedDomain, processDomainCorrection,
12 processUserCorrection, processFalsePositive} = require("typedItCollector"); 12 processUserCorrection, processFalsePositive} = require("typedItCollector");
13 let appIntegration = require("appIntegration"); 13 let appIntegration = require("typoAppIntegration");
14 14
15 // Attach our handlers to all browser windows 15 // Attach our handlers to all browser windows
16 new WindowObserver( 16 new WindowObserver(
17 { 17 {
18 applyToWindow: function(window) 18 applyToWindow: function(window)
19 { 19 {
20 if (!appIntegration.isKnownWindow(window)) 20 if (!appIntegration.isKnownWindow(window))
21 return; 21 return;
22 22
23 let browser = appIntegration.getBrowser(window); 23 let browser = appIntegration.getBrowser(window);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 { 244 {
245 // Yes: Do nothing 245 // Yes: Do nothing
246 } 246 }
247 }, 247 },
248 { 248 {
249 label: no, 249 label: no,
250 accessKey: null, 250 accessKey: null,
251 callback: function() 251 callback: function()
252 { 252 {
253 // No: Add to list of corrections (ignore) 253 // No: Add to list of corrections (ignore)
254 let {onWhitelistEntryAdded} = require("rules"); 254 let {onWhitelistEntryAdded} = require("typoRules");
255 let entry = oldDomain.replace(/^www\./, ""); 255 let entry = oldDomain.replace(/^www\./, "");
256 Prefs.whitelist[entry] = true; 256 Prefs.whitelist[entry] = true;
257 onWhitelistEntryAdded(entry); 257 onWhitelistEntryAdded(entry);
258 Prefs.whitelist = JSON.parse(JSON.stringify(Prefs.whitelist)); 258 Prefs.whitelist = JSON.parse(JSON.stringify(Prefs.whitelist));
259 259
260 require("appIntegration").loadURI(window, value); 260 appIntegration.loadURI(window, value);
261 processFalsePositive(domain, oldDomain); 261 processFalsePositive(domain, oldDomain);
262 } 262 }
263 } 263 }
264 ]; 264 ];
265 // We need to have persistence being set to 1 due to redirect which happens af terwards 265 // We need to have persistence being set to 1 due to redirect which happens af terwards
266 require("appIntegration").openInfobar(window, "url-fixer-infobar-askafter", me ssage, buttons, 1); 266 appIntegration.openInfobar(window, "url-fixer-infobar-askafter", message, butt ons, 1);
267 267
268 require("survey").incrementCorrectionsCounter(); 268 require("survey").incrementCorrectionsCounter();
269 269
270 return prefix + domain + suffix; 270 return prefix + domain + suffix;
271 } 271 }
272 272
273 let stringBundle = null; 273 let stringBundle = null;
274 274
275 function getInfobarTexts() 275 function getInfobarTexts()
276 { 276 {
277 // Randomize URI to work around bug 719376 277 // Randomize URI to work around bug 719376
278 if (!stringBundle) 278 if (!stringBundle)
279 stringBundle = Services.strings.createBundle("chrome://url-fixer/locale/loca le.properties?" + Math.random()); 279 stringBundle = Services.strings.createBundle("chrome://url-fixer/locale/typo .properties?" + Math.random());
280 let result = [ 280 let result = [
281 stringBundle.GetStringFromName("urlfixer.isItCorrect"), 281 stringBundle.GetStringFromName("urlfixer.isItCorrect"),
282 stringBundle.GetStringFromName("urlfixer.yes"), 282 stringBundle.GetStringFromName("urlfixer.yes"),
283 stringBundle.GetStringFromName("urlfixer.no") 283 stringBundle.GetStringFromName("urlfixer.no")
284 ]; 284 ];
285 285
286 getInfobarTexts = function() result; 286 getInfobarTexts = function() result;
287 return getInfobarTexts(); 287 return getInfobarTexts();
288 } 288 }
OLDNEW
« no previous file with comments | « lib/typoAppIntegration.js ('k') | lib/typoRules.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld