From 242921665f7971e4888b780668a53ed76b444199 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Tue, 1 Feb 2011 08:11:48 +0900 Subject: [PATCH] Tab Mix Plus changes its internal symbols --- content/treestyletab/hacks.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index 8cf4a73c..830ff98a 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -106,16 +106,20 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte document.documentElement.setAttribute('treestyletab-enable-compatibility-tmp', true); } // Tab Mix Plus, SessionStore API - if (this.getTreePref('compatibility.TMP') && - 'SessionData' in window && - 'getTabProperties' in SessionData && - 'setTabProperties' in SessionData) { - var prefix = this.kTMP_SESSION_DATA_PREFIX; + if ( + this.getTreePref('compatibility.TMP') && + ('SessionData' in window || 'TabmixSessionData' in window) && + ('getTabProperties' in SessionData || 'getTabProperties' in TabmixSessionData) && + ('setTabProperties' in SessionData || 'setTabProperties' in TabmixSessionData) + ) { + let prefix = this.kTMP_SESSION_DATA_PREFIX; + let sessionData = window.TabmixSessionData || window.SessionData; + let sessionManager = window.TabmixSessionManager || window.SessionManager; SessionData.tabTSTProperties = this.extraProperties.map(function(aProperty) { return prefix+aProperty; }); - eval('SessionData.getTabProperties = '+ - SessionData.getTabProperties.toSource().replace( + eval('sessionData.getTabProperties = '+ + sessionData.getTabProperties.toSource().replace( 'return tabProperties;', ) ); - eval('SessionData.setTabProperties = '+ - SessionData.setTabProperties.toSource().replace( + eval('sessionData.setTabProperties = '+ + sessionData.setTabProperties.toSource().replace( '{', ) ); - eval('SessionManager.loadOneTab = '+ - SessionManager.loadOneTab.toSource().replace( + eval('sessionManager.loadOneTab = '+ + sessionManager.loadOneTab.toSource().replace( /(\}\))?$/, ) ); - var source = tablib.init.toSource().split('gBrowser.restoreTab = '); + let source = tablib.init.toSource().split('gBrowser.restoreTab = '); source[1] = source[1].replace( 'return newTab;', ); eval('tablib.init = '+source.join('gBrowser.restoreTab = ')); - eval('SessionManager.loadOneWindow = '+ - SessionManager.loadOneWindow.toSource().replace( + eval('sessionManager.loadOneWindow = '+ + sessionManager.loadOneWindow.toSource().replace( 'gBrowser.tabsToLoad = ',