Commit e33d7c3a authored by Arthur Edelstein's avatar Arthur Edelstein
Browse files

Bug 19459.2: Don't let Cu.import pollute namespaces

parent 6706fa37
......@@ -41,7 +41,8 @@ let torbuttonBundle = Services.strings.createBundle(
"chrome://torbutton/locale/torbutton.properties");
// Import utility functions
let { bindPrefAndInit, getEnv } = Cu.import("resource://torbutton/modules/utils.js");
let { bindPrefAndInit, getEnv, observe } =
Cu.import("resource://torbutton/modules/utils.js", {});
// __windowUtils(window)__.
// See nsIDOMWindowUtils on MDN.
......
......@@ -3,7 +3,7 @@
// Utilities
let { utils: Cu } = Components;
let { getBoolPref, getIntPref, setBoolPref, setIntPref } =
Cu.import("resource://gre/modules/Services.jsm").Services.prefs;
Cu.import("resource://gre/modules/Services.jsm", {}).Services.prefs;
// Description elements have the follow names.
const descNames =
......
......@@ -31,10 +31,10 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
// Import the controller code.
let { controller } = Cu.import("resource://torbutton/modules/tor-control-port.js");
let { controller } = Cu.import("resource://torbutton/modules/tor-control-port.js", {});
// Utility functions
let { bindPrefAndInit } = Cu.import("resource://torbutton/modules/utils.js");
let { bindPrefAndInit } = Cu.import("resource://torbutton/modules/utils.js", {});
// Make the TorButton logger available.
let logger = Cc["@torproject.org/torbutton-logger;1"]
......
......@@ -7,11 +7,11 @@
// TODO: Double-check there are no strange exploits to defeat:
// http://kb.mozillazine.org/Links_to_local_pages_don%27t_work
let { LoadContextInfo } = Cu.import('resource://gre/modules/LoadContextInfo.jsm');
let { Services } = Cu.import("resource://gre/modules/Services.jsm");
let { showDialog } = Cu.import("resource://torbutton/modules/utils.js");
let { unescapeTorString } = Cu.import("resource://torbutton/modules/utils.js");
let SecurityPrefs = Cu.import("resource://torbutton/modules/security-prefs.js");
let { LoadContextInfo } = Cu.import('resource://gre/modules/LoadContextInfo.jsm', {});
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
let { showDialog } = Cu.import("resource://torbutton/modules/utils.js", {});
let { unescapeTorString } = Cu.import("resource://torbutton/modules/utils.js", {});
let SecurityPrefs = Cu.import("resource://torbutton/modules/security-prefs.js", {});
const k_tb_last_browser_version_pref = "extensions.torbutton.lastBrowserVersion";
const k_tb_browser_update_needed_pref = "extensions.torbutton.updateNeeded";
......
......@@ -4,9 +4,9 @@
let {classes: Cc, utils: Cu } = Components;
let { getBoolPref, setBoolPref, getIntPref, setIntPref } =
Cu.import("resource://gre/modules/Services.jsm").Services.prefs;
let { bindPref } =
Cu.import("resource://torbutton/modules/utils.js");
Cu.import("resource://gre/modules/Services.jsm", {}).Services.prefs;
let { bindPref, bindPrefAndInit } =
Cu.import("resource://torbutton/modules/utils.js", {});
let logger = Components.classes["@torproject.org/torbutton-logger;1"]
.getService(Components.interfaces.nsISupports).wrappedJSObject;
let log = (level, msg) => logger.log(level, msg);
......
......@@ -7,7 +7,7 @@
//
// To import the module, use
//
// let { controller } = Components.utils.import("path/to/tor-control-port.js");
// let { controller } = Components.utils.import("path/to/tor-control-port.js", {});
//
// See the last function defined in this file:
// controller(ipcFile, host, port, password, onError)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment