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 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()

View File

@ -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();

View File

@ -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; },

View File

@ -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)

View File

@ -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 = {