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

Side by Side Diff: lib/typoFixer.js

Issue 8450003: Reimplemented whitelist handling (Closed)
Patch Set: Created Sept. 25, 2012, 3:48 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
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} = require("rules"); 10 let {getSchemeCorrection, isKnownScheme, getDomainCorrection, getDomainReferral} = require("rules");
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 { 240 {
241 // Yes: Do nothing 241 // Yes: Do nothing
242 } 242 }
243 }, 243 },
244 { 244 {
245 label: no, 245 label: no,
246 accessKey: null, 246 accessKey: null,
247 callback: function() 247 callback: function()
248 { 248 {
249 // No: Add to list of corrections (ignore) 249 // No: Add to list of corrections (ignore)
250 if (/^www\./.test(value)) 250 let {onWhitelistEntryAdded} = require("rules");
251 { 251 let entry = oldDomain.replace(/^www\./, "");
252 value = value.substr(4); 252 Prefs.whitelist[entry] = true;
253 } 253 onWhitelistEntryAdded(entry);
254 Prefs.whitelist[value] = value;
255 Prefs.whitelist = JSON.parse(JSON.stringify(Prefs.whitelist)); 254 Prefs.whitelist = JSON.parse(JSON.stringify(Prefs.whitelist));
256 255
257 require("appIntegration").loadURI(value); 256 require("appIntegration").loadURI(value);
258 processFalsePositive(oldDomain, domain); 257 processFalsePositive(oldDomain, domain);
259 } 258 }
260 } 259 }
261 ]; 260 ];
262 require("appIntegration").openInfobar(window, "url-fixer-infobar-askafter", me ssage, buttons, 1); 261 require("appIntegration").openInfobar(window, "url-fixer-infobar-askafter", me ssage, buttons, 1);
263 262
264 require("survey").incrementCorrectionsCounter(); 263 require("survey").incrementCorrectionsCounter();
(...skipping 15 matching lines...) Expand all
280 let result = [ 279 let result = [
281 stringBundle.GetStringFromName("urlfixer.isItCorrect"), 280 stringBundle.GetStringFromName("urlfixer.isItCorrect"),
282 stringBundle.GetStringFromName("urlfixer.yes"), 281 stringBundle.GetStringFromName("urlfixer.yes"),
283 stringBundle.GetStringFromName("urlfixer.no"), 282 stringBundle.GetStringFromName("urlfixer.no"),
284 stringBundle.GetStringFromName("urlfixer.cancel") 283 stringBundle.GetStringFromName("urlfixer.cancel")
285 ]; 284 ];
286 285
287 getInfobarTexts = function() result; 286 getInfobarTexts = function() result;
288 return getInfobarTexts(); 287 return getInfobarTexts();
289 } 288 }
OLDNEW
« lib/rules.js ('K') | « lib/rules.js ('k') | lib/updateRules.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld