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

Side by Side Diff: lib/typoFixer.js

Issue 10220011: Fixed: FQDNs were incorrectly recognized as typos (Closed)
Patch Set: Created April 16, 2013, 1:55 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (/^[^\/\.\s]+\s/.test(value)) 122 if (/^[^\/\.\s]+\s/.test(value))
123 return null; 123 return null;
124 124
125 let [prefix, domain, suffix] = parseURL(value); 125 let [prefix, domain, suffix] = parseURL(value);
126 if (!domain) 126 if (!domain)
127 return null; 127 return null;
128 128
129 let oldDomain = domain; 129 let oldDomain = domain;
130 if (!isIPAddress(domain)) 130 if (!isIPAddress(domain))
131 { 131 {
132 // Remove . at end of domain for fully qualified domain names
133 if (domain[domain.length - 1] == ".")
134 domain = domain.substr(0, domain.length - 1);
Wladimir Palant 2013/04/16 13:59:29 How about: domain = domain.replace(/\.$/, "");
135
132 processTypedDomain(domain); 136 processTypedDomain(domain);
133 137
134 let newDomain = getDomainCorrection(domain); 138 let newDomain = getDomainCorrection(domain);
135 if (newDomain != domain) 139 if (newDomain != domain)
136 { 140 {
137 processDomainCorrection(domain, newDomain); 141 processDomainCorrection(domain, newDomain);
138 domain = newDomain; 142 domain = newDomain;
139 hasCorrection = true; 143 hasCorrection = true;
140 144
141 let referral = getDomainReferral(domain.replace(/^www\./, "")); 145 let referral = getDomainReferral(domain.replace(/^www\./, ""));
(...skipping 78 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