[Pkg-mozext-commits] [tabmixplus] 11/28: Reuse blank tab when closing new window in single window mode, update referrerPolicy code after bug 1113431
David Prévot
taffit at moszumanska.debian.org
Sun Jul 5 15:02:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 7c25b62599677516cba8cfbde5cea43fccb991a6
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Jun 22 09:52:14 2015 +0300
Reuse blank tab when closing new window in single window mode, update referrerPolicy code after bug 1113431
---
modules/SingleWindowModeUtils.jsm | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/modules/SingleWindowModeUtils.jsm b/modules/SingleWindowModeUtils.jsm
index bd1a72f..2754bc6 100644
--- a/modules/SingleWindowModeUtils.jsm
+++ b/modules/SingleWindowModeUtils.jsm
@@ -109,7 +109,12 @@ this.SingleWindowModeUtils = {
existingWindow.tablib.init(); // just in case tablib isn't init yet
var uriToLoad = args[0];
var urls = [];
- var [referrerURI, postData, allowThirdPartyFixup] = [null, null, false];
+ var params = {
+ referrerURI: null,
+ referrerPolicy: TabmixSvc.version(390) && Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
+ postData: null,
+ allowThirdPartyFixup: false
+ };
if (uriToLoad instanceof Ci.nsISupportsArray) {
let count = uriToLoad.Count();
for (let i = 0; i < count; i++) {
@@ -123,9 +128,20 @@ this.SingleWindowModeUtils = {
// just close the new window
}
else if (args.length >= 3) {
- referrerURI = args[2];
- postData = args[3] || null;
- allowThirdPartyFixup = args[4] || false;
+ params.referrerURI = args[2];
+ if (TabmixSvc.version(390)) {
+ if (typeof(params.referrerURI) == "string") {
+ try {
+ params.referrerURI = existingWindow.makeURI(params.referrerURI);
+ } catch (e) {
+ params.referrerURI = null;
+ }
+ }
+ if (args[5] !== undefined)
+ params.referrerPolicy = args[5];
+ }
+ params.postData = args[3] || null;
+ params.allowThirdPartyFixup = args[4] || false;
urls = [uriToLoad];
}
else
@@ -134,7 +150,12 @@ this.SingleWindowModeUtils = {
try {
// open the tabs in current window
if (urls.length) {
- var firstTabAdded = existingBrowser.addTab(urls[0], referrerURI, null, postData, null, allowThirdPartyFixup);
+ var firstTabAdded = existingBrowser.selectedTab;
+ let isBlankTab = existingBrowser.isBlankNotBusyTab(firstTabAdded);
+ if (isBlankTab)
+ existingWindow.openLinkIn(urls[0], "current", params);
+ else
+ firstTabAdded = existingBrowser.addTab(urls[0], params);
for (let i = 1; i < urls.length; ++i)
existingBrowser.addTab(urls[i]);
}
@@ -168,8 +189,10 @@ this.SingleWindowModeUtils = {
win.setAttribute(attr, newWindow.__winRect[attr]);
}
newWindow.close();
- if (firstTabAdded)
+ if (firstTabAdded) {
existingBrowser.selectedTab = firstTabAdded;
+ existingBrowser.ensureTabIsVisible(firstTabAdded);
+ }
// for the case the window is minimized or not in focus
existingWindow.focus();
},0);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list