From 97637256a80a0a224aeeb6e69b804664d5abbc4f Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Wed, 6 Nov 2013 22:46:25 +0900 Subject: [PATCH] Use SessionStore.jsm only. --- content/treestyletab/res/tabsDragUtils.js | 16 ++++------------ modules/base.js | 4 ++-- modules/utils.js | 16 +++------------- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/content/treestyletab/res/tabsDragUtils.js b/content/treestyletab/res/tabsDragUtils.js index a6164a0b..2e51758e 100644 --- a/content/treestyletab/res/tabsDragUtils.js +++ b/content/treestyletab/res/tabsDragUtils.js @@ -32,8 +32,11 @@ const Cc = Components.classes; const Ci = Components.interfaces; + const Cu = Components.utils; const TAB_DROP_TYPE = 'application/x-moz-tabbrowser-tab'; + Cu.import('resource:///modules/sessionstore/SessionStore.jsm'); + var tabsDragUtils = { revision : currentRevision, @@ -59,18 +62,7 @@ return data; }, get TabRestoreStates() { - return this.SessionStoreNS.TabRestoreStates; - }, - get SessionStoreNS() { - delete this.SessionStoreNS; - try { - // resource://app/modules/sessionstore/SessionStore.jsm ? - this.SessionStoreNS = Components.utils.import('resource:///modules/sessionstore/SessionStore.jsm', {}); - } - catch(e) { - this.SessionStoreNS = {}; - } - return this.SessionStoreNS; + return SessionStore.TabRestoreStates; }, init : function TDU_init() diff --git a/modules/base.js b/modules/base.js index e2a92db1..e3334e27 100644 --- a/modules/base.js +++ b/modules/base.js @@ -71,8 +71,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Deferred', XPCOMUtils.defineLazyModuleGetter(this, 'confirmWithPopup', 'resource://treestyletab-modules/lib/confirmWithPopup.js'); XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils'); -XPCOMUtils.defineLazyServiceGetter(this, 'SessionStore', - '@mozilla.org/browser/sessionstore;1', 'nsISessionStore'); +XPCOMUtils.defineLazyModuleGetter(this, 'SessionStore', + 'resource:///modules/sessionstore/SessionStore.jsm'); if (Services.appinfo.OS === 'WINNT') { XPCOMUtils.defineLazyModuleGetter(this, 'AeroPeek', diff --git a/modules/utils.js b/modules/utils.js index 84d3a43c..d74a78b0 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -59,6 +59,8 @@ XPCOMUtils.defineLazyGetter(this, 'stringBundle', function() { XPCOMUtils.defineLazyModuleGetter(this, 'Task', 'resource://gre/modules/Task.jsm'); +XPCOMUtils.defineLazyModuleGetter(this, 'SessionStore', + 'resource:///modules/sessionstore/SessionStore.jsm'); XPCOMUtils.defineLazyModuleGetter(this, 'TreeStyleTabConstants', 'resource://treestyletab-modules/constants.js', 'TreeStyleTabConstants'); @@ -262,19 +264,7 @@ let TreeStyleTabUtils = { return browser.__SS_restoreState == 1; }, get TabRestoreStates() { - return this.SessionStoreNS.TabRestoreStates; - }, - get SessionStoreNS() { - if (!this._SessionStoreNS) { - try { - // resource://app/modules/sessionstore/SessionStore.jsm ? - this._SessionStoreNS = Components.utils.import('resource:///modules/sessionstore/SessionStore.jsm', {}); - } - catch(e) { - this._SessionStoreNS = {}; - } - } - return this._SessionStoreNS; + return SessionStore.TabRestoreStates; }, getShortcutOrURI : function utils_getShortcutOrURI(aBrowserWindow, aURI)