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/autoHide.js b/modules/autoHide.js index 4d5bf140..9f4cbd0e 100644 --- a/modules/autoHide.js +++ b/modules/autoHide.js @@ -42,6 +42,7 @@ const Ci = Components.interfaces; const Cu = Components.utils; Cu.import('resource://gre/modules/XPCOMUtils.jsm'); +Cu.import('resource://gre/modules/Services.jsm'); XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils'); @@ -700,8 +701,8 @@ AutoHideBrowser.prototype = { if ( this.expanded && this.contentAreaScreenEnabled && - this.treeStyleTab.FocusManager.activeWindow && - this.treeStyleTab.FocusManager.activeWindow.top == this.window && + Services.focus.activeWindow && + Services.focus.activeWindow.top == this.window && this.findPluginArea(this.browser.contentWindow) ) { let box = this.getContentsAreaBox(); diff --git a/modules/base.js b/modules/base.js index e4a56bff..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', @@ -108,15 +108,6 @@ var TreeStyleTabBase = { return SessionStore; }, - get FocusManager() - { - if (!this._FocusManager) { - this._FocusManager = Cc['@mozilla.org/focus-manager;1'].getService(Ci.nsIFocusManager); - } - return this._FocusManager; - }, - _FocusManager : null, - get extensions() { return extensions; }, get animationManager() { return animationManager; }, get autoScroll() { return autoScroll; }, 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) diff --git a/modules/window.js b/modules/window.js index 03d8321f..62ebdaa8 100644 --- a/modules/window.js +++ b/modules/window.js @@ -703,8 +703,7 @@ TreeStyleTabWindow.prototype = { var up = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_UP; var down = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_DOWN; if ( - this.FocusManager && - this.FocusManager.focusedElement == this.browser.selectedTab && + Services.focus.focusedElement == this.browser.selectedTab && (up || down || left || right) ) this.arrowKeyEventOnTab = {