Bug 1261272 - Fix Cm.isCIDRegistered is undefined exception. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Fri, 01 Apr 2016 05:57:00 -0400
changeset 291459 fd4ef6fe328cfa2a77c9987b10a7e00b711cfaf6
parent 291458 6f1d7279737d7e3ad4194947f81aeaad4e2c89a4
child 291460 80bcaeaf909743f1500db6423d3de82f1e10f42b
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1261272
milestone48.0a1
Bug 1261272 - Fix Cm.isCIDRegistered is undefined exception. r=jryans
devtools/client/framework/about-devtools-toolbox.js
--- a/devtools/client/framework/about-devtools-toolbox.js
+++ b/devtools/client/framework/about-devtools-toolbox.js
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Register about:devtools-toolbox which allows to open a devtools toolbox
 // in a Firefox tab or a custom html iframe in browser.html
 
 const { Ci, Cu, Cm, components } = require("chrome");
+const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
 const Services = require("Services");
 const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
 const { nsIAboutModule } = Ci;
 
 function AboutURL() {}
 
 AboutURL.prototype = {
   uri: Services.io.newURI("chrome://devtools/content/framework/toolbox.xul",
@@ -37,24 +38,24 @@ AboutURL.prototype = {
 AboutURL.createInstance = function(outer, iid) {
   if (outer) {
     throw Cr.NS_ERROR_NO_AGGREGATION;
   }
   return new AboutURL();
 };
 
 exports.register = function () {
-  if (Cm.isCIDRegistered(AboutURL.prototype.classID)) {
+  if (registrar.isCIDRegistered(AboutURL.prototype.classID)) {
     console.error("Trying to register " + AboutURL.prototype.classDescription +
                   " more than once.");
   } else {
-    Cm.registerFactory(AboutURL.prototype.classID,
+    registrar.registerFactory(AboutURL.prototype.classID,
                        AboutURL.prototype.classDescription,
                        AboutURL.prototype.contractID,
                        AboutURL);
   }
 }
 
 exports.unregister = function () {
-  if (Cm.isCIDRegistered(AboutURL.prototype.classID)) {
-    Cm.unregisterFactory(AboutURL.prototype.classID, AboutURL);
+  if (registrar.isCIDRegistered(AboutURL.prototype.classID)) {
+    registrar.unregisterFactory(AboutURL.prototype.classID, AboutURL);
   }
 }