From 05267c0d3f787afe57322921918234c23f9d958e Mon Sep 17 00:00:00 2001 From: YUKI Hiroshi Date: Tue, 6 Sep 2016 15:29:26 +0900 Subject: [PATCH] Drop support for Tab Mix Plus's custom session management system --- content/treestyletab/windowHelperHacks.js | 70 ----------------------- modules/base.js | 16 ------ modules/browser.js | 5 +- modules/window.js | 9 --- 4 files changed, 2 insertions(+), 98 deletions(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index f454e941..f466e76f 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -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/ diff --git a/modules/base.js b/modules/base.js index 78f2abb4..6fb48a7d 100644 --- a/modules/base.js +++ b/modules/base.js @@ -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 @@ -729,10 +717,6 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { this.deleteTabValue(aTabs[i], this.kCLOSED_SET_ID); } }, - - useTMPSessionAPI : false, - - kTMP_SESSION_DATA_PREFIX : 'tmp-session-data-', // tab diff --git a/modules/browser.js b/modules/browser.js index 199bacdd..ba9a6783 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -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'); diff --git a/modules/window.js b/modules/window.js index 53ebe65b..f7c260c6 100644 --- a/modules/window.js +++ b/modules/window.js @@ -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;