Bug 1524688: Part 5 - Convert Places components to static registration r=mak
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 29 Jan 2019 18:02:04 -0800
changeset 458978 56607c5a301a
parent 458977 6b3684e7d8f9
child 458979 ab64ed7388ae
push id111909
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:30:40 +0000
treeherdermozilla-inbound@81dc12cc9257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1524688
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1524688: Part 5 - Convert Places components to static registration r=mak
browser/installer/package-manifest.in
toolkit/components/places/ColorAnalyzer.js
toolkit/components/places/ColorAnalyzer.jsm
toolkit/components/places/PageIconProtocolHandler.js
toolkit/components/places/PageIconProtocolHandler.jsm
toolkit/components/places/PlacesCategoriesStarter.js
toolkit/components/places/PlacesCategoriesStarter.jsm
toolkit/components/places/PlacesExpiration.jsm
toolkit/components/places/TaggingService.jsm
toolkit/components/places/UnifiedComplete.js
toolkit/components/places/UnifiedComplete.jsm
toolkit/components/places/components.conf
toolkit/components/places/moz.build
toolkit/components/places/nsPlacesExpiration.js
toolkit/components/places/nsTaggingService.js
toolkit/components/places/toolkitplaces.manifest
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -230,23 +230,16 @@
 @RESPATH@/components/nsUpdateTimerManager.js
 @RESPATH@/components/utils.manifest
 @RESPATH@/components/simpleServices.js
 @RESPATH@/components/ProcessSingleton.manifest
 @RESPATH@/components/MainProcessSingleton.js
 @RESPATH@/components/ContentProcessSingleton.js
 @RESPATH@/components/nsURLFormatter.manifest
 @RESPATH@/components/nsURLFormatter.js
-@RESPATH@/components/toolkitplaces.manifest
-@RESPATH@/components/nsTaggingService.js
-@RESPATH@/components/UnifiedComplete.js
-@RESPATH@/components/nsPlacesExpiration.js
-@RESPATH@/components/PageIconProtocolHandler.js
-@RESPATH@/components/PlacesCategoriesStarter.js
-@RESPATH@/components/ColorAnalyzer.js
 @RESPATH@/components/PageThumbsStorageService.js
 @RESPATH@/components/mozProtocolHandler.js
 @RESPATH@/components/mozProtocolHandler.manifest
 @RESPATH@/components/nsDefaultCLH.manifest
 @RESPATH@/components/nsDefaultCLH.js
 @RESPATH@/components/ContentPrefService2.manifest
 @RESPATH@/components/ContentPrefService2.js
 @RESPATH@/components/nsContentDispatchChooser.manifest
rename from toolkit/components/places/ColorAnalyzer.js
rename to toolkit/components/places/ColorAnalyzer.jsm
--- a/toolkit/components/places/ColorAnalyzer.js
+++ b/toolkit/components/places/ColorAnalyzer.jsm
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const XHTML_NS = "http://www.w3.org/1999/xhtml";
 const MAXIMUM_PIXELS = Math.pow(144, 2);
 
 function ColorAnalyzer() {
   // a queue of callbacks for each job we give to the worker
   this.callbacks = [];
@@ -77,9 +76,9 @@ ColorAnalyzer.prototype = {
     Cu.reportError("ColorAnalyzer worker: " + error.message);
     this.callbacks.shift().onComplete(false);
   },
 
   classID: Components.ID("{d056186c-28a0-494e-aacc-9e433772b143}"),
   QueryInterface: ChromeUtils.generateQI([Ci.mozIColorAnalyzer]),
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ColorAnalyzer]);
+var EXPORTED_SYMBOLS = ["ColorAnalyzer"];
rename from toolkit/components/places/PageIconProtocolHandler.js
rename to toolkit/components/places/PageIconProtocolHandler.jsm
--- a/toolkit/components/places/PageIconProtocolHandler.js
+++ b/toolkit/components/places/PageIconProtocolHandler.jsm
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "PlacesUtils",
                                "resource://gre/modules/PlacesUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "NetUtil",
                                "resource://gre/modules/NetUtil.jsm");
 
 function makeDefaultFaviconChannel(uri, loadInfo) {
   let channel = Services.io.newChannelFromURIWithLoadInfo(
@@ -125,9 +124,9 @@ PageIconProtocolHandler.prototype = {
 
   classID: Components.ID("{60a1f7c6-4ff9-4a42-84d3-5a185faa6f32}"),
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIProtocolHandler,
     Ci.nsISupportsWeakReference,
   ]),
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PageIconProtocolHandler]);
+var EXPORTED_SYMBOLS = ["PageIconProtocolHandler"];
rename from toolkit/components/places/PlacesCategoriesStarter.js
rename to toolkit/components/places/PlacesCategoriesStarter.jsm
--- a/toolkit/components/places/PlacesCategoriesStarter.js
+++ b/toolkit/components/places/PlacesCategoriesStarter.jsm
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Fired by TelemetryController when async telemetry data should be collected.
 const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
 
 // Seconds between maintenance runs.
 const MAINTENANCE_INTERVAL_SECONDS = 7 * 86400;
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "PlacesUtils",
                                "resource://gre/modules/PlacesUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "PlacesDBUtils",
                                "resource://gre/modules/PlacesDBUtils.jsm");
 
 /**
  * This component can be used as a starter for modules that have to run when
@@ -49,16 +48,14 @@ PlacesCategoriesStarter.prototype = {
         }
         break;
       default:
         throw new Error("Trying to handle an unknown category.");
     }
   },
 
   classID: Components.ID("803938d5-e26d-4453-bf46-ad4b26e41114"),
-  _xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter),
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIObserver,
   ]),
 };
 
-var components = [PlacesCategoriesStarter];
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+var EXPORTED_SYMBOLS = ["PlacesCategoriesStarter"];
rename from toolkit/components/places/nsPlacesExpiration.js
rename to toolkit/components/places/PlacesExpiration.jsm
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/PlacesExpiration.jsm
@@ -930,23 +930,20 @@ nsPlacesExpiration.prototype = {
     }
     return this._timer = timer;
   },
 
   // nsISupports
 
   classID: Components.ID("705a423f-2f69-42f3-b9fe-1517e0dee56f"),
 
-  _xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration),
-
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIObserver,
     Ci.nsINavHistoryObserver,
     Ci.nsITimerCallback,
     Ci.mozIStorageStatementCallback,
     Ci.nsISupportsWeakReference,
   ]),
 };
 
 // Module Registration
 
-var components = [nsPlacesExpiration];
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+var EXPORTED_SYMBOLS = ["nsPlacesExpiration"];
rename from toolkit/components/places/nsTaggingService.js
rename to toolkit/components/places/TaggingService.jsm
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/TaggingService.jsm
@@ -496,16 +496,14 @@ TagAutoCompleteSearch.prototype = {
     if (searchOngoing) {
       resultCode += "_ONGOING";
     }
     result.setSearchResult(Ci.nsIAutoCompleteResult[resultCode]);
     listener.onSearchResult(this, result);
   },
 
   classID: Components.ID("{1dcc23b0-d4cb-11dc-9ad6-479d56d89593}"),
-  _xpcom_factory: XPCOMUtils.generateSingletonFactory(TagAutoCompleteSearch),
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIAutoCompleteSearch,
   ]),
 };
 
-var component = [TaggingService, TagAutoCompleteSearch];
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component);
+var EXPORTED_SYMBOLS = ["TaggingService", "TagAutoCompleteSearch"];
rename from toolkit/components/places/UnifiedComplete.js
rename to toolkit/components/places/UnifiedComplete.jsm
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.jsm
@@ -56,18 +56,18 @@ const NOTIFYRESULT_DELAY_MS = 16;
 
 // Sqlite result row index constants.
 const QUERYINDEX_QUERYTYPE     = 0;
 const QUERYINDEX_URL           = 1;
 const QUERYINDEX_TITLE         = 2;
 const QUERYINDEX_BOOKMARKED    = 3;
 const QUERYINDEX_BOOKMARKTITLE = 4;
 const QUERYINDEX_TAGS          = 5;
-const QUERYINDEX_VISITCOUNT    = 6;
-const QUERYINDEX_TYPED         = 7;
+//    QUERYINDEX_VISITCOUNT    = 6;
+//    QUERYINDEX_TYPED         = 7;
 const QUERYINDEX_PLACEID       = 8;
 const QUERYINDEX_SWITCHTAB     = 9;
 const QUERYINDEX_FRECENCY      = 10;
 
 // If a URL starts with one of these prefixes, then we don't provide search
 // suggestions for it.
 const DISALLOWED_URLLIKE_PREFIXES = [
   "http", "https", "ftp",
@@ -315,17 +315,16 @@ const {Services} = ChromeUtils.import("r
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   AboutPagesUtils: "resource://gre/modules/AboutPagesUtils.jsm",
   BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
   ExtensionSearchHandler: "resource://gre/modules/ExtensionSearchHandler.jsm",
   ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
-  OS: "resource://gre/modules/osfile.jsm",
   PlacesRemoteTabsAutocompleteProvider: "resource://gre/modules/PlacesRemoteTabsAutocompleteProvider.jsm",
   PlacesSearchAutocompleteProvider: "resource://gre/modules/PlacesSearchAutocompleteProvider.jsm",
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
   ProfileAge: "resource://gre/modules/ProfileAge.jsm",
   Sqlite: "resource://gre/modules/Sqlite.jsm",
   UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
   UrlbarProviderOpenTabs: "resource:///modules/UrlbarProviderOpenTabs.jsm",
   UrlbarProvidersManager: "resource:///modules/UrlbarProvidersManager.jsm",
@@ -2721,20 +2720,18 @@ UnifiedComplete.prototype = {
   get clearingAutoFillSearchesAgain() {
     return true;
   },
 
   // nsISupports
 
   classID: Components.ID("f964a319-397a-4d21-8be6-5cdd1ee3e3ae"),
 
-  _xpcom_factory: XPCOMUtils.generateSingletonFactory(UnifiedComplete),
-
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIAutoCompleteSearch,
     Ci.nsIAutoCompleteSearchDescriptor,
     Ci.mozIPlacesAutoComplete,
     Ci.nsIObserver,
     Ci.nsISupportsWeakReference,
   ]),
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UnifiedComplete]);
+var EXPORTED_SYMBOLS = ["UnifiedComplete"];
--- a/toolkit/components/places/components.conf
+++ b/toolkit/components/places/components.conf
@@ -47,9 +47,59 @@ Classes = [
         'cid': '{88cecbb7-6c63-4b3b-8cd4-84f3b8228c69}',
         'contract_ids': ['@mozilla.org/browser/nav-history-service;1'],
         'singleton': True,
         'type': 'nsNavHistory',
         'headers': ['/toolkit/components/places/nsNavHistory.h'],
         'constructor': 'nsNavHistory::GetSingleton',
         'categories': {'vacuum-participant': 'Places'},
     },
+
+    {
+        'cid': '{bbc23860-2553-479d-8b78-94d9038334f7}',
+        'contract_ids': ['@mozilla.org/browser/tagging-service;1'],
+        'jsm': 'resource://gre/modules/TaggingService.jsm',
+        'constructor': 'TaggingService',
+    },
+    {
+        'cid': '{1dcc23b0-d4cb-11dc-9ad6-479d56d89593}',
+        'contract_ids': ['@mozilla.org/autocomplete/search;1?name=places-tag-autocomplete'],
+        'jsm': 'resource://gre/modules/TaggingService.jsm',
+        'constructor': 'TagAutoCompleteSearch',
+    },
+
+    {
+        'cid': '{705a423f-2f69-42f3-b9fe-1517e0dee56f}',
+        'contract_ids': ['@mozilla.org/places/expiration;1'],
+        'jsm': 'resource://gre/modules/PlacesExpiration.jsm',
+        'constructor': 'nsPlacesExpiration',
+        'categories': {'places-init-complete': 'nsPlacesExpiration'},
+    },
+
+    {
+        'cid': '{803938d5-e26d-4453-bf46-ad4b26e41114}',
+        'contract_ids': ['@mozilla.org/places/categoriesStarter;1'],
+        'jsm': 'resource://gre/modules/PlacesCategoriesStarter.jsm',
+        'constructor': 'PlacesCategoriesStarter',
+        'categories': {'idle-daily': 'PlacesCategoriesStarter'},
+    },
+
+    {
+        'cid': '{d056186c-28a0-494e-aacc-9e433772b143}',
+        'contract_ids': ['@mozilla.org/places/colorAnalyzer;1'],
+        'jsm': 'resource://gre/modules/ColorAnalyzer.jsm',
+        'constructor': 'ColorAnalyzer',
+    },
+
+    {
+        'cid': '{f964a319-397a-4d21-8be6-5cdd1ee3e3ae}',
+        'contract_ids': ['@mozilla.org/autocomplete/search;1?name=unifiedcomplete'],
+        'jsm': 'resource://gre/modules/UnifiedComplete.jsm',
+        'constructor': 'UnifiedComplete',
+    },
+
+    {
+        'cid': '{60a1f7c6-4ff9-4a42-84d3-5a185faa6f32}',
+        'contract_ids': ['@mozilla.org/network/protocol;1?name=page-icon'],
+        'jsm': 'resource://gre/modules/PageIconProtocolHandler.jsm',
+        'constructor': 'PageIconProtocolHandler',
+    },
 ]
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -54,38 +54,34 @@ if CONFIG['MOZ_PLACES']:
         '../build',
     ]
 
     EXTRA_JS_MODULES += [
         'BookmarkHTMLUtils.jsm',
         'BookmarkJSONUtils.jsm',
         'Bookmarks.jsm',
         'ClusterLib.js',
+        'ColorAnalyzer.jsm',
         'ColorAnalyzer_worker.js',
         'ColorConversion.js',
         'ExtensionSearchHandler.jsm',
         'History.jsm',
+        'PageIconProtocolHandler.jsm',
         'PlacesBackups.jsm',
+        'PlacesCategoriesStarter.jsm',
         'PlacesDBUtils.jsm',
+        'PlacesExpiration.jsm',
         'PlacesRemoteTabsAutocompleteProvider.jsm',
         'PlacesSearchAutocompleteProvider.jsm',
         'PlacesSyncUtils.jsm',
         'PlacesTransactions.jsm',
         'PlacesUtils.jsm',
         'SyncedBookmarksMirror.jsm',
-    ]
-
-    EXTRA_COMPONENTS += [
-        'ColorAnalyzer.js',
-        'nsPlacesExpiration.js',
-        'nsTaggingService.js',
-        'PageIconProtocolHandler.js',
-        'PlacesCategoriesStarter.js',
-        'toolkitplaces.manifest',
-        'UnifiedComplete.js',
+        'TaggingService.jsm',
+        'UnifiedComplete.jsm',
     ]
 
     XPCOM_MANIFESTS += [
         'components.conf',
     ]
 
     FINAL_LIBRARY = 'xul'
 
deleted file mode 100644
--- a/toolkit/components/places/toolkitplaces.manifest
+++ /dev/null
@@ -1,27 +0,0 @@
-# nsTaggingService.js
-component {bbc23860-2553-479d-8b78-94d9038334f7} nsTaggingService.js
-contract @mozilla.org/browser/tagging-service;1 {bbc23860-2553-479d-8b78-94d9038334f7}
-component {1dcc23b0-d4cb-11dc-9ad6-479d56d89593} nsTaggingService.js
-contract @mozilla.org/autocomplete/search;1?name=places-tag-autocomplete {1dcc23b0-d4cb-11dc-9ad6-479d56d89593}
-
-# nsPlacesExpiration.js
-component {705a423f-2f69-42f3-b9fe-1517e0dee56f} nsPlacesExpiration.js
-contract @mozilla.org/places/expiration;1 {705a423f-2f69-42f3-b9fe-1517e0dee56f}
-category places-init-complete nsPlacesExpiration @mozilla.org/places/expiration;1
-
-# PlacesCategoriesStarter.js
-component {803938d5-e26d-4453-bf46-ad4b26e41114} PlacesCategoriesStarter.js
-contract @mozilla.org/places/categoriesStarter;1 {803938d5-e26d-4453-bf46-ad4b26e41114}
-category idle-daily PlacesCategoriesStarter @mozilla.org/places/categoriesStarter;1
-
-# ColorAnalyzer.js
-component {d056186c-28a0-494e-aacc-9e433772b143} ColorAnalyzer.js
-contract @mozilla.org/places/colorAnalyzer;1 {d056186c-28a0-494e-aacc-9e433772b143}
-
-# UnifiedComplete.js
-component {f964a319-397a-4d21-8be6-5cdd1ee3e3ae} UnifiedComplete.js
-contract @mozilla.org/autocomplete/search;1?name=unifiedcomplete {f964a319-397a-4d21-8be6-5cdd1ee3e3ae}
-
-# PageIconProtocolHandler.js
-component {60a1f7c6-4ff9-4a42-84d3-5a185faa6f32} PageIconProtocolHandler.js
-contract @mozilla.org/network/protocol;1?name=page-icon {60a1f7c6-4ff9-4a42-84d3-5a185faa6f32}