Drop support for Tab Mix Plus's custom session management system

This commit is contained in:
YUKI Hiroshi 2016-09-06 15:29:26 +09:00
parent 9829dc5948
commit 05267c0d3f
4 changed files with 2 additions and 98 deletions

View File

@ -22,76 +22,6 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
if (TreeStyleTabUtils.getTreePref('compatibility.TMP')) {
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
// https://addons.mozilla.org/firefox/addon/toomanytabs-saves-your-memory/

View File

@ -654,12 +654,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
catch(e) {
}
if (this.useTMPSessionAPI) {
let TMPValue = aTab.getAttribute(this.kTMP_SESSION_DATA_PREFIX+aKey);
if (TMPValue)
value = TMPValue;
}
return value;
},
@ -676,9 +670,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
catch(e) {
}
if (this.useTMPSessionAPI)
aTab.setAttribute(this.kTMP_SESSION_DATA_PREFIX+aKey, aValue);
return aValue;
},
@ -692,9 +683,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
}
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
@ -730,10 +718,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
}
},
useTMPSessionAPI : false,
kTMP_SESSION_DATA_PREFIX : 'tmp-session-data-',
// tab
getTabStrip : function TSTBase_getTabStrip(aTabBrowser)

View File

@ -4711,7 +4711,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
{
var behavior = this.undoCloseTabSetBehavior;
if (
this.useTMPSessionAPI ||
this._restoringClosedSet ||
!(behavior & this.kUNDO_CLOSE_SET || behavior & this.kUNDO_ASK)
)
@ -7357,12 +7356,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
restoreTree : function TSTBrowser_restoreTree()
{
if (!this.needRestoreTree || this.useTMPSessionAPI)
if (!this.needRestoreTree)
return;
this.needRestoreTree = false;
if (this.useTMPSessionAPI && prefs.getPref('extensions.tabmix.sessions.manager'))
if (prefs.getPref('extensions.tabmix.sessions.manager'))
return;
var level = utils.getTreePref('restoreTree.level');

View File

@ -175,15 +175,6 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
return this.base.treeViewEnabled = aValue;
},
get useTMPSessionAPI() /* PUBLIC API */
{
return this.base.useTMPSessionAPI;
},
set useTMPSessionAPI(aValue)
{
return this.base.useTMPSessionAPI = aValue;
},
get browser()
{
var w = this.window;