From d7b92ec19c0f36a486fab10139ace7cede70c2cf Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 29 Jan 2019 18:02:04 -0800 Subject: [PATCH] Bug 1524688: Part 5 - Convert Places components to static registration r=mak --HG-- rename : toolkit/components/places/ColorAnalyzer.js => toolkit/components/places/ColorAnalyzer.jsm rename : toolkit/components/places/PageIconProtocolHandler.js => toolkit/components/places/PageIconProtocolHandler.jsm rename : toolkit/components/places/PlacesCategoriesStarter.js => toolkit/components/places/PlacesCategoriesStarter.jsm rename : toolkit/components/places/nsPlacesExpiration.js => toolkit/components/places/PlacesExpiration.jsm rename : toolkit/components/places/nsTaggingService.js => toolkit/components/places/TaggingService.jsm rename : toolkit/components/places/UnifiedComplete.js => toolkit/components/places/UnifiedComplete.jsm extra : rebase_source : 9359cab414a24df31b287b9d980639ab560b8cf4 --- browser/installer/package-manifest.in | 7 --- .../{ColorAnalyzer.js => ColorAnalyzer.jsm} | 3 +- ...Handler.js => PageIconProtocolHandler.jsm} | 3 +- ...Starter.js => PlacesCategoriesStarter.jsm} | 5 +- ...acesExpiration.js => PlacesExpiration.jsm} | 5 +- ...nsTaggingService.js => TaggingService.jsm} | 4 +- ...UnifiedComplete.js => UnifiedComplete.jsm} | 9 ++-- toolkit/components/places/components.conf | 50 +++++++++++++++++++ toolkit/components/places/moz.build | 16 +++--- .../components/places/toolkitplaces.manifest | 27 ---------- 10 files changed, 64 insertions(+), 65 deletions(-) rename toolkit/components/places/{ColorAnalyzer.js => ColorAnalyzer.jsm} (95%) rename toolkit/components/places/{PageIconProtocolHandler.js => PageIconProtocolHandler.jsm} (96%) rename toolkit/components/places/{PlacesCategoriesStarter.js => PlacesCategoriesStarter.jsm} (89%) rename toolkit/components/places/{nsPlacesExpiration.js => PlacesExpiration.jsm} (99%) rename toolkit/components/places/{nsTaggingService.js => TaggingService.jsm} (98%) rename toolkit/components/places/{UnifiedComplete.js => UnifiedComplete.jsm} (99%) delete mode 100644 toolkit/components/places/toolkitplaces.manifest diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 1cafe61f9989..9fcedc2e66ef 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -235,13 +235,6 @@ @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 diff --git a/toolkit/components/places/ColorAnalyzer.js b/toolkit/components/places/ColorAnalyzer.jsm similarity index 95% rename from toolkit/components/places/ColorAnalyzer.js rename to toolkit/components/places/ColorAnalyzer.jsm index d9c124abefbc..3147e6184a7a 100644 --- a/toolkit/components/places/ColorAnalyzer.js +++ b/toolkit/components/places/ColorAnalyzer.jsm @@ -4,7 +4,6 @@ "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"; @@ -82,4 +81,4 @@ ColorAnalyzer.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.mozIColorAnalyzer]), }; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ColorAnalyzer]); +var EXPORTED_SYMBOLS = ["ColorAnalyzer"]; diff --git a/toolkit/components/places/PageIconProtocolHandler.js b/toolkit/components/places/PageIconProtocolHandler.jsm similarity index 96% rename from toolkit/components/places/PageIconProtocolHandler.js rename to toolkit/components/places/PageIconProtocolHandler.jsm index 459e6695da74..47770d96c323 100644 --- a/toolkit/components/places/PageIconProtocolHandler.js +++ b/toolkit/components/places/PageIconProtocolHandler.jsm @@ -4,7 +4,6 @@ "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"); @@ -130,4 +129,4 @@ PageIconProtocolHandler.prototype = { ]), }; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PageIconProtocolHandler]); +var EXPORTED_SYMBOLS = ["PageIconProtocolHandler"]; diff --git a/toolkit/components/places/PlacesCategoriesStarter.js b/toolkit/components/places/PlacesCategoriesStarter.jsm similarity index 89% rename from toolkit/components/places/PlacesCategoriesStarter.js rename to toolkit/components/places/PlacesCategoriesStarter.jsm index 6c9c85920d10..b2453b8b3087 100644 --- a/toolkit/components/places/PlacesCategoriesStarter.js +++ b/toolkit/components/places/PlacesCategoriesStarter.jsm @@ -10,7 +10,6 @@ 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"); @@ -54,11 +53,9 @@ PlacesCategoriesStarter.prototype = { }, 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"]; diff --git a/toolkit/components/places/nsPlacesExpiration.js b/toolkit/components/places/PlacesExpiration.jsm similarity index 99% rename from toolkit/components/places/nsPlacesExpiration.js rename to toolkit/components/places/PlacesExpiration.jsm index 687c6ed66c60..e1ad56e2766b 100644 --- a/toolkit/components/places/nsPlacesExpiration.js +++ b/toolkit/components/places/PlacesExpiration.jsm @@ -935,8 +935,6 @@ nsPlacesExpiration.prototype = { classID: Components.ID("705a423f-2f69-42f3-b9fe-1517e0dee56f"), - _xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration), - QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsINavHistoryObserver, @@ -948,5 +946,4 @@ nsPlacesExpiration.prototype = { // Module Registration -var components = [nsPlacesExpiration]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); +var EXPORTED_SYMBOLS = ["nsPlacesExpiration"]; diff --git a/toolkit/components/places/nsTaggingService.js b/toolkit/components/places/TaggingService.jsm similarity index 98% rename from toolkit/components/places/nsTaggingService.js rename to toolkit/components/places/TaggingService.jsm index a854f767c8ec..5e7a0b56fac7 100644 --- a/toolkit/components/places/nsTaggingService.js +++ b/toolkit/components/places/TaggingService.jsm @@ -501,11 +501,9 @@ TagAutoCompleteSearch.prototype = { }, 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"]; diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.jsm similarity index 99% rename from toolkit/components/places/UnifiedComplete.js rename to toolkit/components/places/UnifiedComplete.jsm index 0a7987ed270e..a29a9873cd3e 100644 --- a/toolkit/components/places/UnifiedComplete.js +++ b/toolkit/components/places/UnifiedComplete.jsm @@ -61,8 +61,8 @@ 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; @@ -320,7 +320,6 @@ XPCOMUtils.defineLazyModuleGetters(this, { 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", @@ -2726,8 +2725,6 @@ UnifiedComplete.prototype = { classID: Components.ID("f964a319-397a-4d21-8be6-5cdd1ee3e3ae"), - _xpcom_factory: XPCOMUtils.generateSingletonFactory(UnifiedComplete), - QueryInterface: ChromeUtils.generateQI([ Ci.nsIAutoCompleteSearch, Ci.nsIAutoCompleteSearchDescriptor, @@ -2737,4 +2734,4 @@ UnifiedComplete.prototype = { ]), }; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UnifiedComplete]); +var EXPORTED_SYMBOLS = ["UnifiedComplete"]; diff --git a/toolkit/components/places/components.conf b/toolkit/components/places/components.conf index 815031f4c608..2c94be39839f 100644 --- a/toolkit/components/places/components.conf +++ b/toolkit/components/places/components.conf @@ -52,4 +52,54 @@ Classes = [ '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', + }, ] diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build index 9c30c17658c0..05db20f0f564 100644 --- a/toolkit/components/places/moz.build +++ b/toolkit/components/places/moz.build @@ -59,28 +59,24 @@ if CONFIG['MOZ_PLACES']: '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 += [ diff --git a/toolkit/components/places/toolkitplaces.manifest b/toolkit/components/places/toolkitplaces.manifest deleted file mode 100644 index 9b9360d1115f..000000000000 --- 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}