mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
Bug 92737 - Part 4: Open multiple tabs when multiple items are dropped on tab
+ Follow up: Bug 92737 - Part 3: Open multiple tabs when multiple items are dropped on remote content area - browser.js: "usercontextid" (default: 0)
This commit is contained in:
parent
cc008be0a7
commit
eaf424b1c9
2 changed files with 21 additions and 25 deletions
|
|
@ -5124,7 +5124,8 @@ function handleDroppedLink(event, urlOrLinks, name)
|
|||
|
||||
let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
|
||||
|
||||
let userContextId = gBrowser.selectedBrowser.getAttribute("usercontextid");
|
||||
let userContextId = gBrowser.selectedBrowser
|
||||
.getAttribute("usercontextid") || 0;
|
||||
|
||||
let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
if (event.shiftKey)
|
||||
|
|
|
|||
|
|
@ -4507,40 +4507,35 @@
|
|||
this.tabbrowser.updateCurrentBrowser(true);
|
||||
} else {
|
||||
// Pass true to disallow dropping javascript: or data: urls
|
||||
let url;
|
||||
let links;
|
||||
try {
|
||||
url = browserDragAndDrop.drop(event, { }, true);
|
||||
links = browserDragAndDrop.dropLinks(event, true);
|
||||
} catch (ex) {}
|
||||
|
||||
// // valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
|
||||
// if (!url || url.includes(" ")) //PMed
|
||||
if (!url) //FF
|
||||
if (!links || links.length === 0) //FF
|
||||
return;
|
||||
|
||||
let bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
|
||||
if (event.shiftKey)
|
||||
bgLoad = !bgLoad;
|
||||
inBackground = !inBackground;
|
||||
|
||||
let tab = this._getDragTargetTab(event);
|
||||
if (!tab || dropEffect == "copy") {
|
||||
// We're adding a new tab.
|
||||
let newIndex = this._getDropIndex(event);
|
||||
let newTab = this.tabbrowser.loadOneTab(url, {inBackground: bgLoad, allowThirdPartyFixup: true});
|
||||
this.tabbrowser.moveTabTo(newTab, newIndex);
|
||||
} else {
|
||||
// Load in an existing tab.
|
||||
try {
|
||||
let webNav = Ci.nsIWebNavigation;
|
||||
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, flags);
|
||||
if (!bgLoad)
|
||||
this.selectedItem = tab;
|
||||
} catch(ex) {
|
||||
// Just ignore invalid urls
|
||||
}
|
||||
}
|
||||
let targetTab = this._getDragTargetTab(event);
|
||||
let userContextId = this.selectedItem
|
||||
.getAttribute("usercontextid") || 0;
|
||||
let replace = !(!tab || dropEffect == "copy");
|
||||
let newIndex = this._getDropIndex(event);
|
||||
let urls = links.map(link => link.url);
|
||||
this.tabbrowser.loadTabs(urls, {
|
||||
inBackground,
|
||||
replace,
|
||||
allowThirdPartyFixup: true,
|
||||
targetTab,
|
||||
newIndex,
|
||||
userContextId,
|
||||
});
|
||||
}
|
||||
|
||||
if (draggedTab) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue