Permalink
Browse files

Bind Cu shortcuts

  • Loading branch information...
1 parent 6d726c7 commit 9ae567c278e0a6877aa45bb8d81481905d583317 @nmaier nmaier committed Mar 18, 2013
Showing with 20 additions and 28 deletions.
  1. +6 −8 components/services.js
  2. +8 −9 content/manager.js
  3. +6 −7 modules/plugins.jsm
  4. +0 −2 modules/sandboxfactories.jsm
  5. +0 −2 modules/urlcomposer.jsm
View
@@ -14,8 +14,6 @@ const {
Exception: Exception
} = Components;
-const log = Cu.reportError;
-
// Topic of dTaIFilterManager change notifications
const TOPIC_FILTERSCHANGED = 'DTA:filterschanged';
@@ -65,7 +63,7 @@ __defineGetter__("mergeRegs", function getMerge() {
return require("support/regexpmerger").merge;
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
return Cu.import("resource://dta/support/regexpmerger.jsm", {}).merge;
}
}
@@ -143,7 +141,7 @@ AutoFilter.prototype = {
prefs.setExt('anticontainer.mergeids', ids);
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
}
},
@@ -211,7 +209,7 @@ WebInstallConverter.prototype = {
this._bout = new BufferedOutputStream(this._out, SEG_SIZE);
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
throw ex;
}
},
@@ -233,7 +231,7 @@ WebInstallConverter.prototype = {
plugs.pushPlugin(chan.URI.spec, p);
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
plugs.pushPlugin(chan.URI.spec, ex.toString());
}
input.close();
@@ -245,7 +243,7 @@ WebInstallConverter.prototype = {
chrome.asyncOpen(this._listener, null);
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
throw ex;
}
},
@@ -256,7 +254,7 @@ WebInstallConverter.prototype = {
this._bout.writeFrom(input, count);
}
catch (ex) {
- log(ex);
+ Cu.reportError(ex);
throw ex;
}
},
View
@@ -6,7 +6,9 @@
(function () {
"use strict";
-const _ = Components.utils.import("chrome://dtaac-modules/content/l10n.jsm", {}).bundle("manager.properties");
+const Cu = Components.utils;
+
+const _ = Cu.import("chrome://dtaac-modules/content/l10n.jsm", {}).bundle("manager.properties");
if (!("log" in this)) {
this.LOG_DEBUG = this.LOG_ERROR = this.LOG_INFO = 0;
@@ -39,7 +41,7 @@ if (!('URL' in DTA)) {
// the sandbox
// see the _outer_* functions
let _sandboxFactories = {};
-Components.utils.import("chrome://dtaac-modules/content/sandboxfactories.jsm", _sandboxFactories);
+Cu.import("chrome://dtaac-modules/content/sandboxfactories.jsm", _sandboxFactories);
function acResolver() {}
acResolver.prototype = {
@@ -624,12 +626,9 @@ acResolver.prototype = {
};
}
};
-if (!('module' in this)) {
- this.module = Components.utils.import;
-}
-module('chrome://dtaac-modules/content/replacementgenerator.jsm', acResolver.prototype);
-module('chrome://dtaac-modules/content/urlcomposer.jsm', acResolver.prototype);
-module('chrome://dtaac-modules/content/sandboxscripts.jsm', acResolver.prototype);
+Cu.import('chrome://dtaac-modules/content/replacementgenerator.jsm', acResolver.prototype);
+Cu.import('chrome://dtaac-modules/content/urlcomposer.jsm', acResolver.prototype);
+Cu.import('chrome://dtaac-modules/content/sandboxscripts.jsm', acResolver.prototype);
function acFactory(obj) {
if (!obj.type || !obj.match || !obj.prefix) {
@@ -704,7 +703,7 @@ acFactory.prototype = {
};
let acPlugins = {};
-Components.utils.import('chrome://dtaac-modules/content/plugins.jsm', acPlugins);
+Cu.import('chrome://dtaac-modules/content/plugins.jsm', acPlugins);
function acFactoryManager() {
this._init();
View
@@ -21,7 +21,6 @@ const {
Constructor: ctor,
Exception: Exception
} = Components;
-const log = Cu.reportError;
const TOPIC_PLUGINSCHANGED = 'DTA:AC:pluginschanged';
const DEFAULT_NAMESPACE = 'nonymous';
@@ -95,7 +94,7 @@ Observer.prototype = {
if (force) {
data = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
data.data = force;
- log("forcing");
+ Cu.reportError("forcing");
}
Services.obs.notifyObservers(null, TOPIC_PLUGINSCHANGED, data);
}
@@ -241,13 +240,13 @@ function enumerate(all) {
yield o;
}
catch (ex) {
- log("Failed to load " + f.leafName);
- log(ex);
+ Cu.reportError("Failed to load " + f.leafName);
+ Cu.reportError(ex);
}
}
}
if (lastModified && lm != lastModified) {
- log('dtaac:plugins: notify because of new numPlugins');
+ Cu.reportError('dtaac:plugins: notify because of new numPlugins');
lastModified = lm;
Observer.notify(true);
}
@@ -460,8 +459,8 @@ function prettyJSON(objectOrString, initialIndent) {
__builtinPlugins__.push(o);
}
catch (ex) {
- log("Failed to load builtin: " + o.toSource());
- log(ex);
+ Cu.reportError("Failed to load builtin: " + o.toSource());
+ Cu.reportError(ex);
}
}
Observer.notify();
@@ -10,8 +10,6 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
-const module = Cu.import;
-const log = Cu.reportError;
const Exception = Components.Exception;
if (!('XMLHttpRequest' in this)) {
View
@@ -10,8 +10,6 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
-const module = Cu.import;
-const log = Cu.reportError;
const Exception = Components.Exception;
const _io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);

0 comments on commit 9ae567c

Please sign in to comment.