Merge pull request #441 from saneyuki/ss

Change TreeStyleTabBase.SessionStore simply
This commit is contained in:
YUKI "Piro" Hiroshi 2013-01-05 09:06:11 -08:00
commit eebfa312d3

View File

@ -74,6 +74,9 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Deferred',
XPCOMUtils.defineLazyModuleGetter(this, 'confirmWithPopup', 'resource://treestyletab-modules/lib/confirmWithPopup.js'); XPCOMUtils.defineLazyModuleGetter(this, 'confirmWithPopup', 'resource://treestyletab-modules/lib/confirmWithPopup.js');
XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils'); XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils');
XPCOMUtils.defineLazyServiceGetter(this, 'SessionStore',
'@mozilla.org/browser/sessionstore;1', 'nsISessionStore');
if (Services.appinfo.OS === 'WINNT') { if (Services.appinfo.OS === 'WINNT') {
XPCOMUtils.defineLazyModuleGetter(this, 'AeroPeek', XPCOMUtils.defineLazyModuleGetter(this, 'AeroPeek',
'resource://gre/modules/WindowsPreviewPerTab.jsm', 'AeroPeek'); 'resource://gre/modules/WindowsPreviewPerTab.jsm', 'AeroPeek');
@ -270,14 +273,10 @@ var TreeStyleTabBase = {
counterRoleHorizontal : -1, counterRoleHorizontal : -1,
counterRoleVertical : -1, counterRoleVertical : -1,
get SessionStore() { get SessionStore() {
if (!this._SessionStore) { return SessionStore;
this._SessionStore = Cc['@mozilla.org/browser/sessionstore;1'].getService(Ci.nsISessionStore);
}
return this._SessionStore;
}, },
_SessionStore : null,
get FocusManager() get FocusManager()
{ {
@ -1166,7 +1165,7 @@ var TreeStyleTabBase = {
{ {
var value = ''; var value = '';
try { try {
value = this.SessionStore.getTabValue(aTab, aKey); value = SessionStore.getTabValue(aTab, aKey);
} }
catch(e) { catch(e) {
} }
@ -1186,7 +1185,7 @@ var TreeStyleTabBase = {
aTab.setAttribute(aKey, aValue); aTab.setAttribute(aKey, aValue);
try { try {
this.checkCachedSessionDataExpiration(aTab); this.checkCachedSessionDataExpiration(aTab);
this.SessionStore.setTabValue(aTab, aKey, aValue); SessionStore.setTabValue(aTab, aKey, aValue);
} }
catch(e) { catch(e) {
} }
@ -1202,8 +1201,8 @@ var TreeStyleTabBase = {
aTab.removeAttribute(aKey); aTab.removeAttribute(aKey);
try { try {
this.checkCachedSessionDataExpiration(aTab); this.checkCachedSessionDataExpiration(aTab);
this.SessionStore.setTabValue(aTab, aKey, ''); SessionStore.setTabValue(aTab, aKey, '');
this.SessionStore.deleteTabValue(aTab, aKey); SessionStore.deleteTabValue(aTab, aKey);
} }
catch(e) { catch(e) {
} }