Tab Mix Plus changes its internal symbols

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-02-01 08:11:48 +09:00
parent 6d6aa89ec1
commit 242921665f

View File

@ -106,16 +106,20 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte
document.documentElement.setAttribute('treestyletab-enable-compatibility-tmp', true); document.documentElement.setAttribute('treestyletab-enable-compatibility-tmp', true);
} }
// Tab Mix Plus, SessionStore API // Tab Mix Plus, SessionStore API
if (this.getTreePref('compatibility.TMP') && if (
'SessionData' in window && this.getTreePref('compatibility.TMP') &&
'getTabProperties' in SessionData && ('SessionData' in window || 'TabmixSessionData' in window) &&
'setTabProperties' in SessionData) { ('getTabProperties' in SessionData || 'getTabProperties' in TabmixSessionData) &&
var prefix = this.kTMP_SESSION_DATA_PREFIX; ('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) { SessionData.tabTSTProperties = this.extraProperties.map(function(aProperty) {
return prefix+aProperty; return prefix+aProperty;
}); });
eval('SessionData.getTabProperties = '+ eval('sessionData.getTabProperties = '+
SessionData.getTabProperties.toSource().replace( sessionData.getTabProperties.toSource().replace(
'return tabProperties;', 'return tabProperties;',
<![CDATA[ <![CDATA[
this.tabTSTProperties.forEach(function(aProp) { this.tabTSTProperties.forEach(function(aProp) {
@ -124,8 +128,8 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte
$&]]> $&]]>
) )
); );
eval('SessionData.setTabProperties = '+ eval('sessionData.setTabProperties = '+
SessionData.setTabProperties.toSource().replace( sessionData.setTabProperties.toSource().replace(
'{', '{',
<![CDATA[$& <![CDATA[$&
var TSTProps = tabProperties.split('|'); var TSTProps = tabProperties.split('|');
@ -140,8 +144,8 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte
]]> ]]>
) )
); );
eval('SessionManager.loadOneTab = '+ eval('sessionManager.loadOneTab = '+
SessionManager.loadOneTab.toSource().replace( sessionManager.loadOneTab.toSource().replace(
/(\}\))?$/, /(\}\))?$/,
<![CDATA[ <![CDATA[
if (gBrowser.treeStyleTab.useTMPSessionAPI) if (gBrowser.treeStyleTab.useTMPSessionAPI)
@ -149,7 +153,7 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte
$1]]> $1]]>
) )
); );
var source = tablib.init.toSource().split('gBrowser.restoreTab = '); let source = tablib.init.toSource().split('gBrowser.restoreTab = ');
source[1] = source[1].replace( source[1] = source[1].replace(
'return newTab;', 'return newTab;',
<![CDATA[ <![CDATA[
@ -158,8 +162,8 @@ TreeStyleTabService.overrideExtensionsPreInit = function TSTService_overrideExte
$&]]> $&]]>
); );
eval('tablib.init = '+source.join('gBrowser.restoreTab = ')); eval('tablib.init = '+source.join('gBrowser.restoreTab = '));
eval('SessionManager.loadOneWindow = '+ eval('sessionManager.loadOneWindow = '+
SessionManager.loadOneWindow.toSource().replace( sessionManager.loadOneWindow.toSource().replace(
'gBrowser.tabsToLoad = ', 'gBrowser.tabsToLoad = ',
<![CDATA[ <![CDATA[
gBrowser.treeStyleTab.resetAllTabs(true, true); gBrowser.treeStyleTab.resetAllTabs(true, true);