[Pkg-mozext-commits] [tabmixplus] 17/23: Restoring closed tab does not restore its container type. Follow up bug 1274461 - Part 1: undoCloseTab should preserve userContextId
David Prévot
taffit at moszumanska.debian.org
Fri Sep 23 03:31:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 8de244c9836fd17e750b9f78dc01d62f04deb234
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Sep 3 21:43:46 2016 +0300
Restoring closed tab does not restore its container type. Follow up bug 1274461 - Part 1: undoCloseTab should preserve userContextId
---
chrome/content/session/sessionStore.js | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index 5bf1931..cff55a9 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -546,14 +546,14 @@ var TMP_ClosedTabs = {
return null;
// get tab data
- var tabData = this.getClosedTabAtIndex(aIndex);
+ let {state, pos} = this.getClosedTabAtIndex(aIndex);
var tabToRemove = null;
var cTab = gBrowser.mCurrentTab;
var isCurrentBlank = gBrowser.isBlankNotBusyTab(cTab);
if (aWhere == "current" && !isCurrentBlank) {
tabToRemove = cTab;
- tabData.pos = cTab._tPos;
+ pos = cTab._tPos;
} else if (typeof aBlankTabToReuse == "undefined" && isCurrentBlank) {
aBlankTabToReuse = cTab;
}
@@ -566,8 +566,20 @@ var TMP_ClosedTabs = {
tabToRemove.collapsed = true;
}
- var newTab = aBlankTabToReuse ||
- gBrowser.addTab("about:blank", {skipAnimation: tabToRemove || skipAnimation, dontMove: true});
+ let userContextId = state.userContextId;
+ let reuseExisting = aBlankTabToReuse &&
+ (!Tabmix.isVersion(490) ||
+ aBlankTabToReuse.getAttribute("usercontextid") == (userContextId || ""));
+ let newTab = reuseExisting ? aBlankTabToReuse :
+ gBrowser.addTab("about:blank", {
+ skipAnimation: tabToRemove || skipAnimation,
+ dontMove: true,
+ userContextId: userContextId,
+ });
+ if (!reuseExisting && aBlankTabToReuse) {
+ gBrowser.removeTab(aBlankTabToReuse, {animate: false});
+ }
+
newTab.linkedBrowser.stop();
// if tabbar is hidden when there is only one tab and
// we replace that tab with new one close the current tab fast so the tab bar don't have time to reveals
@@ -575,7 +587,7 @@ var TMP_ClosedTabs = {
gBrowser.removeTab(tabToRemove, {animate: false});
}
// add restored tab to current window
- TabmixSvc.ss.setTabState(newTab, TabmixSvc.JSON.stringify(tabData.state));
+ TabmixSvc.ss.setTabState(newTab, TabmixSvc.JSON.stringify(state));
if (TMP_TabView.exist("afterUndoCloseTab")) {
TabView.afterUndoCloseTab();
@@ -585,11 +597,11 @@ var TMP_ClosedTabs = {
// we don't call moveTabTo from add tab if it called from sss_undoCloseTab
var restorePosition = Tabmix.prefs.getBoolPref("undoClosePosition");
if (aWhere == "current" || (aWhere == "original" && restorePosition)) {
- gBrowser.moveTabTo(newTab, Math.min(gBrowser.tabs.length - 1, tabData.pos));
+ gBrowser.moveTabTo(newTab, Math.min(gBrowser.tabs.length - 1, pos));
} else if (aWhere != "end" && Tabmix.getOpenTabNextPref()) {
let tab = gBrowser._lastRelatedTab || gBrowser.selectedTab;
- let pos = newTab._tPos > tab._tPos ? 1 : 0;
- gBrowser.moveTabTo(newTab, tab._tPos + pos);
+ let offset = newTab._tPos > tab._tPos ? 1 : 0;
+ gBrowser.moveTabTo(newTab, tab._tPos + offset);
} else if (aBlankTabToReuse && !Tabmix.getOpenTabNextPref()) {
// move reused tab to the end
gBrowser.moveTabTo(newTab, gBrowser.tabs.length - 1);
--
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