Bug 513648: strip embedded newlines and whitespace when middleclick-pasting URLs, r+a=gavin

--HG--
extra : rebase_source : 7c1ef8fabde83c284c123d758484abd22dd4eb33
This commit is contained in:
Szókovács Róbert 2010-11-04 03:14:07 -04:00
parent ceff7bd2aa
commit 36b954ef07

View File

@ -5167,7 +5167,15 @@ function handleLinkClick(event, href, linkNode) {
}
function middleMousePaste(event) {
var url = getShortcutOrURI(readFromClipboard());
let clipboard = readFromClipboard();
if (!clipboard)
return;
// Strip embedded newlines and surrounding whitespace, to match the URL
// bar's behavior (stripsurroundingwhitespace)
clipboard.replace(/\s*\n\s*/g, "");
let url = getShortcutOrURI(clipboard);
try {
makeURI(url);
} catch (ex) {