Merge pull request #35 from andreja6/master

Default to search if URL is malformed
This commit is contained in:
rn10950 2019-02-22 21:22:13 -05:00 committed by GitHub
commit 81f33843bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -2165,8 +2165,26 @@ function handleURLBarRevert()
return isScrolling;
}
function isURL(str) {
return (str.indexOf("\.") != -1 || str.indexOf(":") != -1) && str.indexOf("?") != 0;
//return true;
}
function handleURLBarCommand(aUserAction, aTriggeringEvent)
{
if(!isURL(gURLBar.value))
{
var searchstr = gURLBar.value;
if(searchstr.indexOf("?") == 0)
searchstr = searchstr.substr(1);
//alert("not a valid url defaulting to search");
OpenSearch(null, searchstr, false, false);
return;
}
try {
addToUrlbarHistory(gURLBar.value);
} catch (ex) {