Merge pull request #587 from saneyuki/module

Use built-in jsm modules
This commit is contained in:
YUKI "Piro" Hiroshi 2013-11-06 06:04:08 -08:00
commit e7d6959e13
5 changed files with 13 additions and 40 deletions

View File

@ -32,8 +32,11 @@
const Cc = Components.classes; const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
const Cu = Components.utils;
const TAB_DROP_TYPE = 'application/x-moz-tabbrowser-tab'; const TAB_DROP_TYPE = 'application/x-moz-tabbrowser-tab';
Cu.import('resource:///modules/sessionstore/SessionStore.jsm');
var tabsDragUtils = { var tabsDragUtils = {
revision : currentRevision, revision : currentRevision,
@ -59,18 +62,7 @@
return data; return data;
}, },
get TabRestoreStates() { get TabRestoreStates() {
return this.SessionStoreNS.TabRestoreStates; return SessionStore.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;
}, },
init : function TDU_init() init : function TDU_init()

View File

@ -42,6 +42,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils; const Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils'); XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils');
@ -700,8 +701,8 @@ AutoHideBrowser.prototype = {
if ( if (
this.expanded && this.expanded &&
this.contentAreaScreenEnabled && this.contentAreaScreenEnabled &&
this.treeStyleTab.FocusManager.activeWindow && Services.focus.activeWindow &&
this.treeStyleTab.FocusManager.activeWindow.top == this.window && Services.focus.activeWindow.top == this.window &&
this.findPluginArea(this.browser.contentWindow) this.findPluginArea(this.browser.contentWindow)
) { ) {
let box = this.getContentsAreaBox(); let box = this.getContentsAreaBox();

View File

@ -71,8 +71,8 @@ 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', XPCOMUtils.defineLazyModuleGetter(this, 'SessionStore',
'@mozilla.org/browser/sessionstore;1', 'nsISessionStore'); 'resource:///modules/sessionstore/SessionStore.jsm');
if (Services.appinfo.OS === 'WINNT') { if (Services.appinfo.OS === 'WINNT') {
XPCOMUtils.defineLazyModuleGetter(this, 'AeroPeek', XPCOMUtils.defineLazyModuleGetter(this, 'AeroPeek',
@ -108,15 +108,6 @@ var TreeStyleTabBase = {
return SessionStore; 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 extensions() { return extensions; },
get animationManager() { return animationManager; }, get animationManager() { return animationManager; },
get autoScroll() { return autoScroll; }, get autoScroll() { return autoScroll; },

View File

@ -59,6 +59,8 @@ XPCOMUtils.defineLazyGetter(this, 'stringBundle', function() {
XPCOMUtils.defineLazyModuleGetter(this, 'Task', XPCOMUtils.defineLazyModuleGetter(this, 'Task',
'resource://gre/modules/Task.jsm'); 'resource://gre/modules/Task.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'SessionStore',
'resource:///modules/sessionstore/SessionStore.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TreeStyleTabConstants', XPCOMUtils.defineLazyModuleGetter(this, 'TreeStyleTabConstants',
'resource://treestyletab-modules/constants.js', 'TreeStyleTabConstants'); 'resource://treestyletab-modules/constants.js', 'TreeStyleTabConstants');
@ -262,19 +264,7 @@ let TreeStyleTabUtils = {
return browser.__SS_restoreState == 1; return browser.__SS_restoreState == 1;
}, },
get TabRestoreStates() { get TabRestoreStates() {
return this.SessionStoreNS.TabRestoreStates; return SessionStore.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;
}, },
getShortcutOrURI : function utils_getShortcutOrURI(aBrowserWindow, aURI) getShortcutOrURI : function utils_getShortcutOrURI(aBrowserWindow, aURI)

View File

@ -703,8 +703,7 @@ TreeStyleTabWindow.prototype = {
var up = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_UP; var up = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_UP;
var down = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_DOWN; var down = aEvent.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_DOWN;
if ( if (
this.FocusManager && Services.focus.focusedElement == this.browser.selectedTab &&
this.FocusManager.focusedElement == this.browser.selectedTab &&
(up || down || left || right) (up || down || left || right)
) )
this.arrowKeyEventOnTab = { this.arrowKeyEventOnTab = {