Bug 1478404 - remove _xpcom_categories annotations as they're dead code, r=florian
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 31 Jul 2018 17:39:25 +0000
changeset 825065 6499bc583b573f7d4eefc3a2f1692226ce17ec60
parent 825064 cfc3d5482f79786f4726be893e5fc241a25a9994
child 825066 87886f1778cdcfeba4c3b9a535dbdb876905f121
push id118030
push userbmo:sfoster@mozilla.com
push dateTue, 31 Jul 2018 23:35:13 +0000
reviewersflorian
bugs1478404, 568691
milestone63.0a1
Bug 1478404 - remove _xpcom_categories annotations as they're dead code, r=florian Support for the _xpcom_categories property was removed in Bug 568691, but we left a bunch of consumers behind, and it's been cargo-culted a bit more. We should remove the remaining remnants. Differential Revision: https://phabricator.services.mozilla.com/D2429
browser/components/feeds/WebContentConverter.js
browser/components/newtab/aboutNewTabService.js
js/xpconnect/loader/XPCOMUtils.jsm
testing/marionette/components/marionette.js
toolkit/components/thumbnails/PageThumbsStorageService.js
toolkit/components/timermanager/nsIUpdateTimerManager.idl
--- a/browser/components/feeds/WebContentConverter.js
+++ b/browser/components/feeds/WebContentConverter.js
@@ -303,38 +303,22 @@ WebContentConverterRegistrar.prototype =
    */
   _getBrowserForContentWindow(aBrowserWindow, aContentWindow) {
     // This depends on pseudo APIs of browser.js and tabbrowser.xml
     aContentWindow = aContentWindow.top;
     return aBrowserWindow.gBrowser.browsers.find((browser) =>
       browser.contentWindow == aContentWindow);
   },
 
-  /**
-   * See nsIFactory
-   */
-  createInstance(outer, iid) {
-    if (outer != null)
-      throw Cr.NS_ERROR_NO_AGGREGATION;
-    return this.QueryInterface(iid);
-  },
-
   classID: WCCR_CLASSID,
 
   /**
    * See nsISupports
    */
-  QueryInterface: ChromeUtils.generateQI(
-     [Ci.nsIWebContentHandlerRegistrar,
-      Ci.nsIFactory]),
-
-  _xpcom_categories: [{
-    category: "app-startup",
-    service: true
-  }]
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIWebContentHandlerRegistrar]),
 };
 
 function WebContentConverterRegistrarContent() {
 }
 
 WebContentConverterRegistrarContent.prototype = {
   registerProtocolHandler(aProtocol, aURIString, aTitle, aBrowserOrWindow) {
     aProtocol = (aProtocol || "").toLowerCase();
@@ -350,31 +334,20 @@ WebContentConverterRegistrarContent.prot
     Utils.checkProtocolHandlerAllowed(aProtocol, aURIString, aBrowserOrWindow);
 
     messageManager.sendAsyncMessage("WCCR:registerProtocolHandler",
                                     { protocol: aProtocol,
                                       uri: uri.spec,
                                       title: aTitle });
   },
 
-  /**
-   * See nsIFactory
-   */
-  createInstance(outer, iid) {
-    if (outer != null)
-      throw Cr.NS_ERROR_NO_AGGREGATION;
-    return this.QueryInterface(iid);
-  },
-
   classID: WCCR_CLASSID,
 
   /**
    * See nsISupports
    */
-  QueryInterface: ChromeUtils.generateQI(
-                     [Ci.nsIWebContentHandlerRegistrar,
-                      Ci.nsIFactory])
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIWebContentHandlerRegistrar])
 };
 
 this.NSGetFactory =
   (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) ?
     XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrarContent]) :
     XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrar]);
--- a/browser/components/newtab/aboutNewTabService.js
+++ b/browser/components/newtab/aboutNewTabService.js
@@ -97,17 +97,16 @@ AboutNewTabService.prototype = {
   _overridden: false,
   willNotifyUser: false,
 
   classID: Components.ID("{dfcd2adc-7867-4d3a-ba70-17501f208142}"),
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIAboutNewTabService,
     Ci.nsIObserver
   ]),
-  _xpcom_categories: [{service: true}],
 
   observe(subject, topic, data) {
     switch (topic) {
       case "nsPref:changed":
         if (data === PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS) {
           this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
         } else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) {
           this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);
--- a/js/xpconnect/loader/XPCOMUtils.jsm
+++ b/js/xpconnect/loader/XPCOMUtils.jsm
@@ -49,38 +49,16 @@
  *
  *    // The following properties were used prior to Mozilla 2, but are no
  *    // longer supported. They may still be included for compatibility with
  *    // prior versions of XPCOMUtils. In Mozilla 2, this information is
  *    // included in the .manifest file which registers this JS component.
  *    classDescription: "unique text description",
  *    contractID:       "@example.com/xxx;1",
  *
- *    // [optional] an array of categories to register this component in.
- *    _xpcom_categories: [{
- *      // Each object in the array specifies the parameters to pass to
- *      // nsICategoryManager.addCategoryEntry(). 'true' is passed for
- *      // both aPersist and aReplace params.
- *      category: "some-category",
- *      // optional, defaults to the object's classDescription
- *      entry: "entry name",
- *      // optional, defaults to the object's contractID (unless
- *      // 'service' is specified)
- *      value: "...",
- *      // optional, defaults to false. When set to true, and only if 'value'
- *      // is not specified, the concatenation of the string "service," and the
- *      // object's contractID is passed as aValue parameter of addCategoryEntry.
- *      service: true,
- *      // optional, it can be an array of applications' IDs in the form:
- *      // [ "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", ... ]
- *      // If defined the component will be registered in this category only for
- *      // the provided applications.
- *      apps: [...]
- *    }],
- *
  *    // ...component implementation...
  *  };
  *
  * 2. Create an array of component constructors (like the one
  * created in step 1):
  *  var components = [MyComponent];
  *
  * 3. Define the NSGetFactory entry point:
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -527,21 +527,15 @@ const MarionetteFactory = {
 
 function Marionette() {}
 
 Marionette.prototype = {
   classDescription: "Marionette component",
   classID: Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}"),
   contractID: "@mozilla.org/remote/marionette;1",
 
-  /* eslint-disable camelcase */
+  /* eslint-disable-next-line camelcase */
   _xpcom_factory: MarionetteFactory,
 
-  _xpcom_categories: [
-    {category: "command-line-handler", entry: "b-marionette"},
-    {category: "profile-after-change", service: true},
-  ],
-  /* eslint-enable camelcase */
-
   helpInfo: "  --marionette       Enable remote control server.\n",
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Marionette]);
--- a/toolkit/components/thumbnails/PageThumbsStorageService.js
+++ b/toolkit/components/thumbnails/PageThumbsStorageService.js
@@ -13,19 +13,16 @@ XPCOMUtils.defineLazyGetter(this, "gUnic
   converter.charset = "utf8";
   return converter;
 });
 function PageThumbsStorageService() {}
 
 PageThumbsStorageService.prototype = {
     classID: Components.ID("{97943eec-0e48-49ef-b7b7-cf4aa0109bb6}"),
     QueryInterface: ChromeUtils.generateQI([Ci.nsIPageThumbsStorageService]),
-    _xpcom_categories: [{
-      service: true
-    }],
     // The path for the storage
     _path: null,
     get path() {
       if (!this._path) {
         this._path = OS.Path.join(OS.Constants.Path.localProfileDir, THUMBNAIL_DIRECTORY);
       }
       return this._path;
     },
--- a/toolkit/components/timermanager/nsIUpdateTimerManager.idl
+++ b/toolkit/components/timermanager/nsIUpdateTimerManager.idl
@@ -25,25 +25,21 @@ interface nsIUpdateTimerManager : nsISup
    * @param   callback
    *          A nsITimerCallback object that is notified when the interval
    *          expires
    * @param   interval
    *          The length of time, in seconds, of the interval
    *
    * Note: to avoid having to instantiate a component to call registerTimer
    * the component can intead register an update-timer category with comma
-   * separated values as a single string representing the timer as follows.
+   * separated values as a single string:
    *
-   * _xpcom_categories: [{ category: "update-timer",
-   *                       value: "contractID," +
-   *                              "method," +
-   *                              "id," +
-   *                              "preference," +
-   *                              "interval" }],
-   * the values are as follows
+   * contractID,method,id,preference,interval
+   *
+   * via a manifest entry. The values are as follows:
    *   contractID : the contract ID for the component.
    *   method     : the method used to instantiate the interface. This should be
    *                either getService or createInstance depending on your
    *                component.
    *   id         : the id that identifies the interval, used for persistence.
    *   preference : the preference to for timer interval. This value can be
    *                optional by specifying an empty string for the value.
    *   interval   : the default interval in seconds for the timer.