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

Delta Between Two Patch Sets: lib/typoRules.js

Issue 8559070: Integrated URL Fixer into Adblock Plus (Closed)
Left Patch Set: Added ability to opt-in and opt-out Created Oct. 19, 2012, 9:14 a.m.
Right Patch Set: Created Nov. 9, 2012, 3:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/typoNetError.js ('k') | lib/typoSurvey.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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/FileUtils.jsm"); 6 Cu.import("resource://gre/modules/FileUtils.jsm");
7 7
8 let {Prefs} = require("prefs"); 8 let {Prefs} = require("prefs");
9 9
10 let RULES_VERSION = 2; 10 let RULES_VERSION = 2;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 catch (e) 74 catch (e)
75 { 75 {
76 if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND) 76 if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND)
77 Cu.reportError(e); 77 Cu.reportError(e);
78 callback(false); 78 callback(false);
79 } 79 }
80 } 80 }
81 81
82 function getRuleFile() 82 function getRuleFile()
83 { 83 {
84 let result = FileUtils.getFile("ProfD", ["url-fixer-rules.json"]); 84 let result = FileUtils.getFile("ProfD", [require("info").addonName + "-rules.j son"]);
85 85
86 getRuleFile = function() result; 86 getRuleFile = function() result;
87 return getRuleFile(); 87 return getRuleFile();
88 } 88 }
89 89
90 function addCustomRules() 90 function addCustomRules()
91 { 91 {
92 for (let domain in Prefs.whitelist) 92 for (let domain in Prefs.whitelist)
93 onWhitelistEntryAdded(domain); 93 onWhitelistEntryAdded(domain);
94 } 94 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 bestSuggestionDistance = distance; 400 bestSuggestionDistance = distance;
401 bestSuggestionMatched = matchedLen; 401 bestSuggestionMatched = matchedLen;
402 bestSuggestionPriority = priority; 402 bestSuggestionPriority = priority;
403 } 403 }
404 } 404 }
405 if (bestSuggestion) 405 if (bestSuggestion)
406 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n; 406 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n;
407 else 407 else
408 return input; 408 return input;
409 } 409 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld