Merge pull request #439 from saneyuki/fix

Add the constant to cache 'Components.utils' to modules/base.js.
This commit is contained in:
YUKI "Piro" Hiroshi 2013-01-04 19:11:47 -08:00
commit b20f662871

View File

@ -37,9 +37,10 @@ const EXPORTED_SYMBOLS = ['TreeStyleTabBase'];
const Cc = Components.classes; const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
const Cu = Components.utils;
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Components.utils.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyGetter(this, 'window', function() { XPCOMUtils.defineLazyGetter(this, 'window', function() {
Cu.import('resource://treestyletab-modules/lib/namespace.jsm'); Cu.import('resource://treestyletab-modules/lib/namespace.jsm');
@ -51,19 +52,19 @@ XPCOMUtils.defineLazyGetter(this, 'prefs', function() {
}); });
XPCOMUtils.defineLazyGetter(this, 'jstimer', function() { XPCOMUtils.defineLazyGetter(this, 'jstimer', function() {
var jstimer = {}; var jstimer = {};
Components.utils.import('resource://treestyletab-modules/lib/jstimer.jsm', jstimer); Cu.import('resource://treestyletab-modules/lib/jstimer.jsm', jstimer);
return jstimer; return jstimer;
}); });
XPCOMUtils.defineLazyGetter(this, 'extensions', function() { XPCOMUtils.defineLazyGetter(this, 'extensions', function() {
Components.utils.import('resource://treestyletab-modules/lib/extensions.js', {}); Cu.import('resource://treestyletab-modules/lib/extensions.js', {});
return window['piro.sakura.ne.jp'].extensions; return window['piro.sakura.ne.jp'].extensions;
}); });
XPCOMUtils.defineLazyGetter(this, 'animationManager', function() { XPCOMUtils.defineLazyGetter(this, 'animationManager', function() {
Components.utils.import('resource://treestyletab-modules/lib/animationManager.js', {}); Cu.import('resource://treestyletab-modules/lib/animationManager.js', {});
return window['piro.sakura.ne.jp'].animationManager; return window['piro.sakura.ne.jp'].animationManager;
}); });
XPCOMUtils.defineLazyGetter(this, 'autoScroll', function() { XPCOMUtils.defineLazyGetter(this, 'autoScroll', function() {
Components.utils.import('resource://treestyletab-modules/lib/autoScroll.js', {}); Cu.import('resource://treestyletab-modules/lib/autoScroll.js', {});
return window['piro.sakura.ne.jp'].autoScroll; return window['piro.sakura.ne.jp'].autoScroll;
}); });
XPCOMUtils.defineLazyModuleGetter(this, 'UninstallationListener', XPCOMUtils.defineLazyModuleGetter(this, 'UninstallationListener',
@ -513,7 +514,7 @@ var TreeStyleTabBase = {
// https://addons.mozilla.org/firefox/addon/scriptish/ // https://addons.mozilla.org/firefox/addon/scriptish/
if (utils.getTreePref('compatibility.Scriptish')) { if (utils.getTreePref('compatibility.Scriptish')) {
try { try {
let tabModule = Components.utils.import('resource://scriptish/utils/Scriptish_openInTab.js', {}); let tabModule = Cu.import('resource://scriptish/utils/Scriptish_openInTab.js', {});
let Scriptish_openInTab = tabModule.Scriptish_openInTab; let Scriptish_openInTab = tabModule.Scriptish_openInTab;
tabModule.Scriptish_openInTab = function(aURL, aLoadInBackground, aReuse, aChromeWin) { tabModule.Scriptish_openInTab = function(aURL, aLoadInBackground, aReuse, aChromeWin) {
aChromeWin.TreeStyleTabService.readyToOpenChildTabNow(aChromeWin.gBrowser); aChromeWin.TreeStyleTabService.readyToOpenChildTabNow(aChromeWin.gBrowser);
@ -885,9 +886,9 @@ var TreeStyleTabBase = {
defaultDeferredErrorHandler : function utils_defaultDeferredErrorHandler(aError) defaultDeferredErrorHandler : function utils_defaultDeferredErrorHandler(aError)
{ {
if (aError.stack) if (aError.stack)
Components.utils.reportError(aError.message+'\n'+aError.stack); Cu.reportError(aError.message+'\n'+aError.stack);
else else
Components.utils.reportError(aError); Cu.reportError(aError);
}, },
// event // event