Drop support for Tab Mix Plus's custom session management system
This commit is contained in:
parent
9829dc5948
commit
05267c0d3f
@ -22,76 +22,6 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
|
|||||||
if (TreeStyleTabUtils.getTreePref('compatibility.TMP')) {
|
if (TreeStyleTabUtils.getTreePref('compatibility.TMP')) {
|
||||||
document.documentElement.setAttribute('treestyletab-enable-compatibility-tmp', true);
|
document.documentElement.setAttribute('treestyletab-enable-compatibility-tmp', true);
|
||||||
}
|
}
|
||||||
// Tab Mix Plus, SessionStore API
|
|
||||||
if (
|
|
||||||
TreeStyleTabUtils.getTreePref('compatibility.TMP') &&
|
|
||||||
('TabmixSessionData' in window || 'SessionData' in window)
|
|
||||||
) {
|
|
||||||
let sessionData = window.TabmixSessionData || window.SessionData;
|
|
||||||
if ('getTabProperties' in sessionData && 'setTabProperties' in sessionData) {
|
|
||||||
let prefix = sv.kTMP_SESSION_DATA_PREFIX;
|
|
||||||
let sessionManager = window.TabmixSessionManager || window.SessionManager;
|
|
||||||
sessionData.tabTSTProperties = this.extraProperties.map(function(aProperty) {
|
|
||||||
return prefix+aProperty;
|
|
||||||
});
|
|
||||||
eval('sessionData.getTabProperties = '+
|
|
||||||
sessionData.getTabProperties.toSource().replace(
|
|
||||||
'return tabProperties;',
|
|
||||||
' for (let i = 0, maxi = this.tabTSTProperties.length; i < maxi; i++)\n' +
|
|
||||||
' {\n' +
|
|
||||||
' let property = this.tabTSTProperties[i];\n' +
|
|
||||||
' tabProperties += "|" + property + "=" + encodeURIComponent(aTab.getAttribute(property));\n' +
|
|
||||||
' }\n' +
|
|
||||||
'$&'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
eval('sessionData.setTabProperties = '+
|
|
||||||
sessionData.setTabProperties.toSource().replace(
|
|
||||||
'{',
|
|
||||||
'$&\n' +
|
|
||||||
' var TSTProps = tabProperties.split("|");\n' +
|
|
||||||
' tabProperties = TSTProps.shift();\n' +
|
|
||||||
' for (let i = 0, maxi = TSTProps.length; i < maxi; i++)\n' +
|
|
||||||
' {\n' +
|
|
||||||
' let property = TSTProps[i];\n' +
|
|
||||||
' let index = property.indexOf("=");\n' +
|
|
||||||
' let name = property.substring(0, index);\n' +
|
|
||||||
' let value = decodeURIComponent(property.substring(index+1));\n' +
|
|
||||||
' if (name && value)\n' +
|
|
||||||
' aTab.setAttribute(name, value);\n' +
|
|
||||||
' }'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
eval('sessionManager.loadOneTab = '+
|
|
||||||
sessionManager.loadOneTab.toSource().replace(
|
|
||||||
/(\}\))?$/,
|
|
||||||
' if (gBrowser.treeStyleTab.useTMPSessionAPI)\n' +
|
|
||||||
' gBrowser.treeStyleTab.handleRestoredTab(aTab);\n' +
|
|
||||||
'$1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
let source = tablib.init.toSource().split('gBrowser.restoreTab = ');
|
|
||||||
source[1] = source[1].replace(
|
|
||||||
'return newTab;',
|
|
||||||
' if (this.treeStyleTab.useTMPSessionAPI)\n' +
|
|
||||||
' this.treeStyleTab.handleRestoredTab(newTab);\n' +
|
|
||||||
'$&'
|
|
||||||
);
|
|
||||||
eval('tablib.init = '+source.join('gBrowser.restoreTab = '));
|
|
||||||
eval('sessionManager.loadOneWindow = '+
|
|
||||||
sessionManager.loadOneWindow.toSource().replace(
|
|
||||||
'gBrowser.tabsToLoad = ',
|
|
||||||
' gBrowser.treeStyleTab.resetAllTabs(true, true);\n' +
|
|
||||||
' TreeStyleTabService.restoringTree = true;\n' +
|
|
||||||
'$&'
|
|
||||||
).replace(
|
|
||||||
/(\}\))?$/,
|
|
||||||
'TreeStyleTabService.restoringTree = false; $1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
sv.useTMPSessionAPI = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TooManyTabs
|
// TooManyTabs
|
||||||
// https://addons.mozilla.org/firefox/addon/toomanytabs-saves-your-memory/
|
// https://addons.mozilla.org/firefox/addon/toomanytabs-saves-your-memory/
|
||||||
|
@ -654,12 +654,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
catch(e) {
|
catch(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useTMPSessionAPI) {
|
|
||||||
let TMPValue = aTab.getAttribute(this.kTMP_SESSION_DATA_PREFIX+aKey);
|
|
||||||
if (TMPValue)
|
|
||||||
value = TMPValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -676,9 +670,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
catch(e) {
|
catch(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useTMPSessionAPI)
|
|
||||||
aTab.setAttribute(this.kTMP_SESSION_DATA_PREFIX+aKey, aValue);
|
|
||||||
|
|
||||||
return aValue;
|
return aValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -692,9 +683,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useTMPSessionAPI)
|
|
||||||
aTab.removeAttribute(this.kTMP_SESSION_DATA_PREFIX+aKey);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// workaround for http://piro.sakura.ne.jp/latest/blosxom/mozilla/extension/treestyletab/2009-09-29_debug.htm
|
// workaround for http://piro.sakura.ne.jp/latest/blosxom/mozilla/extension/treestyletab/2009-09-29_debug.htm
|
||||||
@ -729,10 +717,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
this.deleteTabValue(aTabs[i], this.kCLOSED_SET_ID);
|
this.deleteTabValue(aTabs[i], this.kCLOSED_SET_ID);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
useTMPSessionAPI : false,
|
|
||||||
|
|
||||||
kTMP_SESSION_DATA_PREFIX : 'tmp-session-data-',
|
|
||||||
|
|
||||||
// tab
|
// tab
|
||||||
|
|
||||||
|
@ -4711,7 +4711,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
{
|
{
|
||||||
var behavior = this.undoCloseTabSetBehavior;
|
var behavior = this.undoCloseTabSetBehavior;
|
||||||
if (
|
if (
|
||||||
this.useTMPSessionAPI ||
|
|
||||||
this._restoringClosedSet ||
|
this._restoringClosedSet ||
|
||||||
!(behavior & this.kUNDO_CLOSE_SET || behavior & this.kUNDO_ASK)
|
!(behavior & this.kUNDO_CLOSE_SET || behavior & this.kUNDO_ASK)
|
||||||
)
|
)
|
||||||
@ -7357,12 +7356,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
|
|
||||||
restoreTree : function TSTBrowser_restoreTree()
|
restoreTree : function TSTBrowser_restoreTree()
|
||||||
{
|
{
|
||||||
if (!this.needRestoreTree || this.useTMPSessionAPI)
|
if (!this.needRestoreTree)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.needRestoreTree = false;
|
this.needRestoreTree = false;
|
||||||
|
|
||||||
if (this.useTMPSessionAPI && prefs.getPref('extensions.tabmix.sessions.manager'))
|
if (prefs.getPref('extensions.tabmix.sessions.manager'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var level = utils.getTreePref('restoreTree.level');
|
var level = utils.getTreePref('restoreTree.level');
|
||||||
|
@ -175,15 +175,6 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
|
|||||||
return this.base.treeViewEnabled = aValue;
|
return this.base.treeViewEnabled = aValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
get useTMPSessionAPI() /* PUBLIC API */
|
|
||||||
{
|
|
||||||
return this.base.useTMPSessionAPI;
|
|
||||||
},
|
|
||||||
set useTMPSessionAPI(aValue)
|
|
||||||
{
|
|
||||||
return this.base.useTMPSessionAPI = aValue;
|
|
||||||
},
|
|
||||||
|
|
||||||
get browser()
|
get browser()
|
||||||
{
|
{
|
||||||
var w = this.window;
|
var w = this.window;
|
||||||
|
Loading…
Reference in New Issue
Block a user