[Pkg-mozext-commits] [tabmixplus] 18/23: Save and restore container data (userContextId) with our Session Manager. Follow up bug 1274461 - Part 2: restore tabs 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 27d0d99fd39a0661939095738b886010fbc02563
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Sep 4 08:53:56 2016 +0300
Save and restore container data (userContextId) with our Session Manager. Follow up bug 1274461 - Part 2: restore tabs should preserve userContextId
---
chrome/content/session/session.js | 21 +++++++++++++++++++++
chrome/content/session/sessionStore.js | 1 +
2 files changed, 22 insertions(+)
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index a4128f4..9b7907c 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -2896,6 +2896,7 @@ TabmixSessionManager = {
return false;
data.pos = aTab._tPos;
data.image = tabState.image;
+ data.userContextId = tabState.userContextId || null;
data.properties = TabmixSessionData.getTabProperties(aTab, true);
var rdfLabelTab = rdfLabelTabs + "/" + aTab.linkedPanel;
var rdfNodeTab = this.RDFService.GetResource(rdfLabelTab);
@@ -2924,6 +2925,9 @@ TabmixSessionManager = {
saveTabData: function SM_saveTabData(aNode, aData) {
this.setIntLiteral(aNode, "index", aData.index);
this.setIntLiteral(aNode, "tabPos", aData.pos);
+ if (aData.userContextId) {
+ this.setIntLiteral(aNode, "userContextId", aData.userContextId);
+ }
this.setLiteral(aNode, "image", aData.image || "");
this.setLiteral(aNode, "properties", aData.properties);
this.setLiteral(aNode, "history", aData.history);
@@ -3346,6 +3350,22 @@ TabmixSessionManager = {
for (let t = 0; t < tabsData.length; t++) {
let data = tabsData[t];
let tab = gBrowser.tabs[newIndex + t];
+
+ let userContextId = data.userContextId;
+ let reuseExisting = !Tabmix.isVersion(490) ||
+ tab.getAttribute("usercontextid") == (userContextId || "");
+ if (!reuseExisting) {
+ let tabToRemove = tab;
+ let forceNotRemote = !data.pinned;
+ tab = gBrowser.addTab("about:blank", {
+ skipAnimation: true,
+ forceNotRemote: forceNotRemote,
+ userContextId: userContextId,
+ });
+ gBrowser.removeTab(tabToRemove);
+ gBrowser.moveTabTo(tab, newIndex + t);
+ }
+
tabs.push(tab);
// flag. dont save tab that are in restore phase
if (!tab.hasAttribute("inrestore"))
@@ -3561,6 +3581,7 @@ TabmixSessionManager = {
data.pos = aTabData.pos;
data.closedAt = aTabData.closedAt || Date.now();
data.image = aTabData.image;
+ data.userContextId = aTabData.userContextId || null;
// closed tab can not be protected - set protected to 0
var _locked = TMP_SessionStore._getAttribute(tabState, "_locked") != "false" ? "1" : "0";
data.properties = "0" + _locked;
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index cff55a9..b9e4072 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -821,6 +821,7 @@ var TabmixConvertSession = {
tabData.scroll = {scroll: scroll};
}
}
+ tabData.userContextId = TabmixSessionManager.getIntValue(rdfNodeTab, "userContextId", 0);
var properties = TabmixSessionManager.getLiteralValue(rdfNodeTab, "properties");
var tabAttribute = ["Images", "Subframes", "MetaRedirects", "Plugins", "Javascript"];
--
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