Bug 252441 - Dropping text containing spaces will now perform a search on the given sentence. r=gavin.sharp

This commit is contained in:
Lukas Nordin 2013-03-27 11:49:02 -04:00
parent c0b4a0ab95
commit 382a30b4a7
2 changed files with 4 additions and 5 deletions

View File

@ -4030,8 +4030,7 @@
url = browserDragAndDrop.drop(event, { }, true);
} catch (ex) {}
// valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
if (!url || url.contains(" "))
if (!url)
return;
let bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
@ -4043,12 +4042,12 @@
if (!tab || dropEffect == "copy") {
// We're adding a new tab.
let newIndex = this._getDropIndex(event);
let newTab = this.tabbrowser.loadOneTab(getShortcutOrURI(url), {inBackground: bgLoad});
let newTab = this.tabbrowser.loadOneTab(url, {inBackground: bgLoad, allowThirdPartyFixup: true});
this.tabbrowser.moveTabTo(newTab, newIndex);
} else {
// Load in an existing tab.
try {
this.tabbrowser.getBrowserForTab(tab).loadURI(getShortcutOrURI(url));
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
if (!bgLoad)
this.selectedItem = tab;
} catch(ex) {

View File

@ -64,7 +64,7 @@ function test() {
drop("mochi.test/first", true);
drop("javascript:'bad'");
drop("jAvascript:'bad'");
drop("space bad");
drop("search this", true);
drop("mochi.test/second", true);
drop("data:text/html,bad");
drop("mochi.test/third", true);