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

Side by Side Diff: lib/typoFixer.js

Issue 8478020: Slight improvements to URL Fixer code (Closed)
Patch Set: Created Oct. 1, 2012, 4:03 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 | « chrome/content/options.xul ('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 /* 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("rules");
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return null; 176 return null;
177 177
178 // Ignore search keywords and such 178 // Ignore search keywords and such
179 if ("getShortcutOrURI" in window && window.getShortcutOrURI(value) != value) 179 if ("getShortcutOrURI" in window && window.getShortcutOrURI(value) != value)
180 return null; 180 return null;
181 181
182 // Spaces before the first slash or period is probably a quick search 182 // Spaces before the first slash or period is probably a quick search
183 if (/^[^\/\.\s]+\s/.test(value)) 183 if (/^[^\/\.\s]+\s/.test(value))
184 return null; 184 return null;
185 185
186 // Check manually entered corrections
187 if (Prefs.custom_replace.hasOwnProperty(value) && Prefs.custom_replace[value])
188 return Prefs.custom_replace[value];
Thomas Greiner 2012/10/02 10:31:14 Feel free to modify it but don't remove this code.
189
190 let [prefix, domain, suffix] = parseURL(value); 186 let [prefix, domain, suffix] = parseURL(value);
191 if (!domain) 187 if (!domain)
192 return null; 188 return null;
193 189
194 let oldDomain = domain; 190 let oldDomain = domain;
195 if (!isIPAddress(domain)) 191 if (!isIPAddress(domain))
196 { 192 {
197 processTypedDomain(domain); 193 processTypedDomain(domain);
198 194
199 let newDomain = getDomainCorrection(domain); 195 let newDomain = getDomainCorrection(domain);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 stringBundle = Services.strings.createBundle("chrome://url-fixer/locale/loca le.properties?" + Math.random()); 279 stringBundle = Services.strings.createBundle("chrome://url-fixer/locale/loca le.properties?" + Math.random());
284 let result = [ 280 let result = [
285 stringBundle.GetStringFromName("urlfixer.isItCorrect"), 281 stringBundle.GetStringFromName("urlfixer.isItCorrect"),
286 stringBundle.GetStringFromName("urlfixer.yes"), 282 stringBundle.GetStringFromName("urlfixer.yes"),
287 stringBundle.GetStringFromName("urlfixer.no") 283 stringBundle.GetStringFromName("urlfixer.no")
288 ]; 284 ];
289 285
290 getInfobarTexts = function() result; 286 getInfobarTexts = function() result;
291 return getInfobarTexts(); 287 return getInfobarTexts();
292 } 288 }
OLDNEW
« no previous file with comments | « chrome/content/options.xul ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld