diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 11:29:52 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 11:29:52 +0200 |
commit | 3c93fde763c87eaaa655a517cc93faa895415185 (patch) | |
tree | b4b60798e65a5514e35f1c6840eda6cbf1e69853 /application/palemoon/base/content/tabbrowser.xml | |
parent | 54cd77a551a0576f7593d24dfc9d82abcf99154f (diff) | |
download | UXP-3c93fde763c87eaaa655a517cc93faa895415185.tar UXP-3c93fde763c87eaaa655a517cc93faa895415185.tar.gz UXP-3c93fde763c87eaaa655a517cc93faa895415185.tar.lz UXP-3c93fde763c87eaaa655a517cc93faa895415185.tar.xz UXP-3c93fde763c87eaaa655a517cc93faa895415185.zip |
Bug 92737 - Part 2: Open multiple tabs when multiple items are dropped on non-remote content area
browser.js:
// handleDroppedLink has the following 2 overloads:
// handleDroppedLink(event, url, name)
// handleDroppedLink(event, links)
function handleDroppedLink(event, urlOrLinks, name)
{
let links;
if (Array.isArray(urlOrLinks)) {
links = urlOrLinks;
} else {
links = [{ url: urlOrLinks, name, type: "" }];
}
...it is in the previous commit.
Diffstat (limited to 'application/palemoon/base/content/tabbrowser.xml')
-rw-r--r-- | application/palemoon/base/content/tabbrowser.xml | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 4f713d76f..0d9c29395 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -1314,6 +1314,24 @@ <parameter name="aLoadInBackground"/> <parameter name="aReplace"/> <body><![CDATA[ + let aAllowThirdPartyFixup; + let aTargetTab; + let aNewIndex = -1; + let aPostDatas = []; + let aUserContextId; + if (arguments.length == 2 && + typeof arguments[1] == "object") { + let params = arguments[1]; + aLoadInBackground = params.inBackground; + aReplace = params.replace; + aAllowThirdPartyFixup = params.allowThirdPartyFixup; + aTargetTab = params.targetTab; + aNewIndex = typeof params.newIndex === "number" ? + params.newIndex : aNewIndex; + aPostDatas = params.postDatas || aPostDatas; + aUserContextId = params.userContextId; + } + if (!aURIs.length) return; @@ -1331,22 +1349,53 @@ var multiple = aURIs.length > 1; var owner = multiple || aLoadInBackground ? null : this.selectedTab; var firstTabAdded = null; + var targetTabIndex = -1; if (aReplace) { + let browser; + if (aTargetTab) { + browser = this.getBrowserForTab(aTargetTab); + targetTabIndex = aTargetTab._tPos; + } else { + browser = this.mCurrentBrowser; + targetTabIndex = this.tabContainer.selectedIndex; + } + let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE; + if (aAllowThirdPartyFixup) { + flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | + Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS; + } try { - this.loadURI(aURIs[0], null, null); + browser.loadURIWithFlags(aURIs[0], { + flags, postData: aPostDatas[0] + }); } catch (e) { // Ignore failure in case a URI is wrong, so we can continue // opening the next ones. } + } else { + firstTabAdded = this.addTab(aURIs[0], { + ownerTab: owner, + skipAnimation: multiple, + allowThirdPartyFixup: aAllowThirdPartyFixup, + postData: aPostDatas[0], + userContextId: aUserContextId + }); + if (aNewIndex !== -1) { + this.moveTabTo(firstTabAdded, aNewIndex); + targetTabIndex = firstTabAdded._tPos; + } } - else - firstTabAdded = this.addTab(aURIs[0], {ownerTab: owner, skipAnimation: multiple}); - var tabNum = this.tabContainer.selectedIndex; + let tabNum = targetTabIndex; for (let i = 1; i < aURIs.length; ++i) { - let tab = this.addTab(aURIs[i], {skipAnimation: true}); - if (aReplace) + let tab = this.addTab(aURIs[i], { + skipAnimation: true, + allowThirdPartyFixup: aAllowThirdPartyFixup, + postData: aPostDatas[i], + userContextId: aUserContextId + }); + if (targetTabIndex !== -1) this.moveTabTo(tab, ++tabNum); } |