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

Side by Side Diff: lib/typoRules.js

Issue 29337915: Issue 3748 - Update URL Fixer dependency on buildtools to revision c92cc4e4a338 and make it E10S-co… (Closed)
Patch Set: Created March 7, 2016, 8:19 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/typoNetError.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the URL Fixer, 2 * This file is part of the URL Fixer,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * URL Fixer is free software: you can redistribute it and/or modify 5 * URL Fixer is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * URL Fixer is distributed in the hope that it will be useful, 9 * URL Fixer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 21 matching lines...) Expand all
32 let updateTimer = null; 32 let updateTimer = null;
33 updateTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 33 updateTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
34 updateTimer.initWithCallback(onTimer, 1000 * 60 * 5, Ci.nsITimer.TYPE_REPEATING_ SLACK); 34 updateTimer.initWithCallback(onTimer, 1000 * 60 * 5, Ci.nsITimer.TYPE_REPEATING_ SLACK);
35 onShutdown.add(() => updateTimer.cancel()); 35 onShutdown.add(() => updateTimer.cancel());
36 36
37 function loadRules() 37 function loadRules()
38 { 38 {
39 loadRulesFrom(Services.io.newFileURI(getRuleFile()).spec, false, function(succ ess) 39 loadRulesFrom(Services.io.newFileURI(getRuleFile()).spec, false, function(succ ess)
40 { 40 {
41 if (!success) 41 if (!success)
42 loadRulesFrom(require("info").addonRoot + "defaults/typoRules.json", true) ; 42 loadRulesFrom("chrome://" + require("info").addonName + "/content/typoRule s.json", true);
43 }); 43 });
44 } 44 }
45 45
46 function loadRulesFrom(url, ignoreVersion, callback) 46 function loadRulesFrom(url, ignoreVersion, callback)
47 { 47 {
48 if (typeof callback != "function") 48 if (typeof callback != "function")
49 callback = function() {}; 49 callback = function() {};
50 50
51 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci. nsIXMLHttpRequest); 51 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci. nsIXMLHttpRequest);
52 request.open("GET", url); 52 request.open("GET", url);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 bestSuggestionDistance = distance; 413 bestSuggestionDistance = distance;
414 bestSuggestionMatched = matchedLen; 414 bestSuggestionMatched = matchedLen;
415 bestSuggestionPriority = priority; 415 bestSuggestionPriority = priority;
416 } 416 }
417 } 417 }
418 if (bestSuggestion) 418 if (bestSuggestion)
419 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n; 419 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n;
420 else 420 else
421 return input; 421 return input;
422 } 422 }
OLDNEW
« no previous file with comments | « lib/typoNetError.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld