bug 233205 Pressing Ctrl+Enter does not remove trailing spaces, patch by Patrick McCormick (patrick@meer.net), r=me
git-svn-id: svn://10.0.0.236/trunk@157123 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1396,19 +1396,28 @@ function canonizeUrl(aTriggeringEvent, aPostDataRef)
|
||||
|
||||
// Prevent suffix when already exists www , http , /
|
||||
if (!/^(www|http)|\/\s*$/i.test(url)) {
|
||||
var suffix = null;
|
||||
|
||||
if (aTriggeringEvent && 'ctrlKey' in aTriggeringEvent &&
|
||||
aTriggeringEvent.ctrlKey && 'shiftKey' in aTriggeringEvent &&
|
||||
aTriggeringEvent.shiftKey)
|
||||
// Tack http://www. and .org on.
|
||||
url = "http://www." + url + ".org/";
|
||||
suffix = ".org/";
|
||||
|
||||
else if (aTriggeringEvent && 'ctrlKey' in aTriggeringEvent &&
|
||||
aTriggeringEvent.ctrlKey)
|
||||
// Tack www. and .com on.
|
||||
url = "http://www." + url + ".com/";
|
||||
suffix = ".com/";
|
||||
|
||||
else if (aTriggeringEvent && 'shiftKey' in aTriggeringEvent &&
|
||||
aTriggeringEvent.shiftKey)
|
||||
// Tack www. and .org on.
|
||||
url = "http://www." + url + ".net/";
|
||||
suffix = ".net/";
|
||||
|
||||
if (suffix != null) {
|
||||
// trim leading/trailing spaces (bug 233205)
|
||||
url = url.replace( /^\s+/, "");
|
||||
url = url.replace( /\s+$/, "");
|
||||
// Tack www. and suffix on.
|
||||
url = "http://www." + url + suffix;
|
||||
}
|
||||
}
|
||||
|
||||
gURLBar.value = getShortcutOrURI(url, aPostDataRef);
|
||||
|
||||
Reference in New Issue
Block a user