[Pkg-mozext-commits] [tabmixplus] 23/123: Update TGM compatibility after changeset 1553cb0a2702
David Prévot
taffit at moszumanska.debian.org
Wed Sep 17 21:16:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 10ba61500e9a5b41c81acddcae3baf80373cfc84
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Aug 16 12:35:43 2014 +0300
Update TGM compatibility after changeset 1553cb0a2702
---
chrome/content/session/session.js | 5 +---
chrome/content/session/sessionStore.js | 11 +++++---
modules/extensions/TabGroupsManager.jsm | 48 ++++++++++++++++-----------------
3 files changed, 33 insertions(+), 31 deletions(-)
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index e749a84..9f3d2ae 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -3108,7 +3108,7 @@ try{
this.tabsToLoad = newtabsCount;
this.setStripVisibility(newtabsCount);
- let tabsData = TabmixConvertSession.getTabsState(rdfNodeTabs);
+ let tabsData = TabmixConvertSession.getTabsState(rdfNodeTabs, true);
let tabs = [], numVisibleTabs = 0, firstVisibleTab = -1
let needToReload = this.prefBranch.getBoolPref("restore.reloadall");
for (let t = 0; t < tabsData.length ; t++) {
@@ -3131,9 +3131,6 @@ try{
firstVisibleTab = newIndex + t;
}
-///XXX
-/// check TGM compatibilities
-
this._setTabviewTab(tab, data);
if (needToReload) {
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index ff66e38..dd01750 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -746,7 +746,7 @@ var TabmixConvertSession = {
return state;
},
- getTabsState: function cs_getTabsState(rdfNodeTabs) {
+ getTabsState: function cs_getTabsState(rdfNodeTabs, internal) {
var _tabs = [], tabsData = [];
function _tabData(rdfTab) {
@@ -764,7 +764,7 @@ var TabmixConvertSession = {
}
tabsData.sort(function (a, b) {return a - b;});
for (let i = 0; i < tabsData.length ; i++) {
- let tab = this.getTabState(tabsData[i].node);
+ let tab = this.getTabState(tabsData[i].node, false, internal);
if (tab)
_tabs.push(tab);
}
@@ -792,7 +792,7 @@ var TabmixConvertSession = {
return _tabs;
},
- getTabState: function cs_getTabState(rdfNodeTab, aClosedTab) {
+ getTabState: function cs_getTabState(rdfNodeTab, aClosedTab, internal) {
var tabData = {entries:[], index: 0, zoom: 1, disallow:"", text:""};
tabData.entries = this.getHistoryState(rdfNodeTab);
if (!tabData.entries.length)
@@ -837,6 +837,11 @@ var TabmixConvertSession = {
switch (RegExp.$1) {
case "tabgroups-data":
// TGM data
+ if (internal) {
+ // for Tabmix SessionManager use
+ extData.__tabmixTGM = RegExp.$2;
+ break;
+ }
let [groupId, groupName] = RegExp.$2.split(" ");
extData.TabGroupsManagerGroupId = groupId;
extData.TabGroupsManagerGroupName = groupName;
diff --git a/modules/extensions/TabGroupsManager.jsm b/modules/extensions/TabGroupsManager.jsm
index a911238..67f4ab5 100644
--- a/modules/extensions/TabGroupsManager.jsm
+++ b/modules/extensions/TabGroupsManager.jsm
@@ -1,14 +1,6 @@
"use strict";
/**
-XXX not working good
-
-1. when we restore closed windows with group to current window
-2. when restore saved sessions to current window
-
-*/
-
-/**
* original code by onemen
*/
var EXPORTED_SYMBOLS = ["TMP_TabGroupsManager"];
@@ -58,6 +50,26 @@ let TMP_TabGroupsManager = {
' $&'
).toCode();
+ /*
+ we have some compatibility issue if we let TabGroupsManager
+ listen to "SSTabRestoring", probably since TGM move tabs around
+ the fix is to call TGM.moveTabToGroupBySessionStore for each tab
+ after the tab restored by SessionStore
+ */
+ sessionManager._moveTabsToGroupByTGM = function(window, tabs) {
+ let sessionStore = window.TabmixSvc.ss;
+ let TGM = window.TabGroupsManager.session;
+ for (let i = 0; i < tabs.length ; i++) {
+ let tab = tabs[i];
+ let data = sessionStore.getTabValue(tab, "__tabmixTGM");
+ let [groupId, groupName] = data ? data.split(" ") : ["-1", ""];
+ sessionStore.setTabValue(tab, "TabGroupsManagerGroupId", groupId);
+ sessionStore.setTabValue(tab, "TabGroupsManagerGroupName", groupName);
+ sessionStore.deleteTabValue(tab, "__tabmixTGM");
+ TGM.moveTabToGroupBySessionStore(tab);
+ }
+ }
+
this.changeCode(sessionManager, "TabmixSessionManager.loadOneWindow")._replace(
// get saved group data and repalce ids with new one
'var lastSelectedIndex = restoreSelect ? this.getIntValue(rdfNodeWindow, "selectedIndex") : 0;',
@@ -92,22 +104,10 @@ let TMP_TabGroupsManager = {
' if (_restoreSelect && (overwrite || (!concatenate && !currentTabIsBalnk)))' +
' this.updateSelected(newIndex + _lastSelectedIndex, overwrite || caller=="firstwindowopen" || caller=="windowopenedbytabmix");' +
' $&'
- ).toCode();
-
- this.changeCode(sessionManager, "TabmixSessionManager.loadOneTab")._replace(
- 'var savedHistory = this.loadTabHistory(rdfNodeSession, webNav.sessionHistory, aTab);',
- ' $&' +
- ' try {' +
- ' let tabgroupsData = TMP_SessionStore._getAttribute({xultab: tabProperties}, "tabgroups-data");' +
- ' let [groupId, groupName] = ["", ""];' +
- ' if (tabgroupsData) {' +
- ' [groupId, groupName] = tabgroupsData.split(" ");' +
- ' }' +
- ' TabmixSvc.ss.setTabValue(aTab, "TabGroupsManagerGroupId", groupId);' +
- ' TabmixSvc.ss.setTabValue(aTab, "TabGroupsManagerGroupName", groupName);' +
- ' aTab.removeAttribute("hidden");' +
- ' TabGroupsManager.session.moveTabToGroupBySessionStore(aTab);' +
- ' } catch (ex) {Tabmix.assert(ex);}'
+ )._replace(
+ 'SessionStore.restoreTabs(window, tabs, tabsData, 0);',
+ '$&\n' +
+ ' this._moveTabsToGroupByTGM(window, tabs);'
).toCode();
// for TabGroupsManager use - don't change function name from tabmixSessionsManager
--
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