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

Side by Side Diff: lib/typoFixer.js

Issue 9302008: Ignore urlbar inputs without any special characters (Closed)
Patch Set: Created Jan. 31, 2013, 2:47 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 | « no previous file | 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-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (/^([\w\-]+:)/.test(value) && !isKnownScheme(RegExp.$1)) 114 if (/^([\w\-]+:)/.test(value) && !isKnownScheme(RegExp.$1))
115 return null; 115 return null;
116 116
117 // Ignore search keywords and such 117 // Ignore search keywords and such
118 if ("getShortcutOrURI" in window && window.getShortcutOrURI(value) != value) 118 if ("getShortcutOrURI" in window && window.getShortcutOrURI(value) != value)
119 return null; 119 return null;
120 120
121 // Spaces before the first slash or period is probably a quick search 121 // Spaces before the first slash or period is probably a quick search
122 if (/^[^\/\.\s]+\s/.test(value)) 122 if (/^[^\/\.\s]+\s/.test(value))
123 return null; 123 return null;
124
125 // No special characters is probably a quick search
126 if (!/[^\w ]/.test(value))
127 return null;
124 128
125 let [prefix, domain, suffix] = parseURL(value); 129 let [prefix, domain, suffix] = parseURL(value);
126 if (!domain) 130 if (!domain)
127 return null; 131 return null;
128 132
129 let oldDomain = domain; 133 let oldDomain = domain;
130 if (!isIPAddress(domain)) 134 if (!isIPAddress(domain))
131 { 135 {
132 processTypedDomain(domain); 136 processTypedDomain(domain);
133 137
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 stringBundle = Services.strings.createBundle("chrome://" + require("info").a ddonName + "/locale/typo.properties?" + Math.random()); 224 stringBundle = Services.strings.createBundle("chrome://" + require("info").a ddonName + "/locale/typo.properties?" + Math.random());
221 let result = [ 225 let result = [
222 stringBundle.GetStringFromName("urlfixer.isItCorrect"), 226 stringBundle.GetStringFromName("urlfixer.isItCorrect"),
223 stringBundle.GetStringFromName("urlfixer.yes"), 227 stringBundle.GetStringFromName("urlfixer.yes"),
224 stringBundle.GetStringFromName("urlfixer.no") 228 stringBundle.GetStringFromName("urlfixer.no")
225 ]; 229 ];
226 230
227 getInfobarTexts = function() result; 231 getInfobarTexts = function() result;
228 return getInfobarTexts(); 232 return getInfobarTexts();
229 } 233 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld