From b4b561b027c56c80bd1efeaf0c718ac2a7ae66fe Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 29 Jan 2019 19:44:47 -0800 Subject: [PATCH] Bug 1524688: Part 10 - Convert password manager to static registration. r=MattN --HG-- rename : toolkit/components/passwordmgr/nsLoginInfo.js => toolkit/components/passwordmgr/LoginInfo.jsm rename : toolkit/components/passwordmgr/nsLoginManager.js => toolkit/components/passwordmgr/LoginManager.jsm rename : toolkit/components/passwordmgr/nsLoginManagerPrompter.js => toolkit/components/passwordmgr/LoginManagerPrompter.jsm extra : source : 25f982fd53bdbe1cf0b497fe7cc989928b9b0ac8 --- browser/installer/package-manifest.in | 6 -- mobile/android/installer/package-manifest.in | 6 -- .../{nsLoginInfo.js => LoginInfo.jsm} | 2 +- .../{nsLoginManager.js => LoginManager.jsm} | 2 +- ...erPrompter.js => LoginManagerPrompter.jsm} | 3 +- .../components/passwordmgr/components.conf | 63 +++++++++++++++++++ toolkit/components/passwordmgr/crypto-SDR.js | 3 +- toolkit/components/passwordmgr/moz.build | 25 +++----- .../passwordmgr/passwordmgr.manifest | 19 ------ .../components/passwordmgr/storage-json.js | 2 +- .../passwordmgr/storage-mozStorage.js | 3 +- 11 files changed, 79 insertions(+), 55 deletions(-) rename toolkit/components/passwordmgr/{nsLoginInfo.js => LoginInfo.jsm} (97%) rename toolkit/components/passwordmgr/{nsLoginManager.js => LoginManager.jsm} (99%) rename toolkit/components/passwordmgr/{nsLoginManagerPrompter.js => LoginManagerPrompter.jsm} (99%) create mode 100644 toolkit/components/passwordmgr/components.conf delete mode 100644 toolkit/components/passwordmgr/passwordmgr.manifest diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 19b77df0c2fd..f51100fea970 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -204,12 +204,6 @@ @RESPATH@/browser/components/payments.manifest @RESPATH@/browser/components/paymentUIService.js #endif -@RESPATH@/components/passwordmgr.manifest -@RESPATH@/components/nsLoginInfo.js -@RESPATH@/components/nsLoginManager.js -@RESPATH@/components/nsLoginManagerPrompter.js -@RESPATH@/components/storage-json.js -@RESPATH@/components/crypto-SDR.js @RESPATH@/components/TooltipTextProvider.js @RESPATH@/components/TooltipTextProvider.manifest @RESPATH@/components/WebVTT.manifest diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 3c80974b9c3f..8d517c21e88c 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -125,12 +125,6 @@ @BINPATH@/components/toolkitsearch.manifest @BINPATH@/components/nsSearchService.js @BINPATH@/components/nsSidebar.js -@BINPATH@/components/passwordmgr.manifest -@BINPATH@/components/nsLoginInfo.js -@BINPATH@/components/nsLoginManager.js -@BINPATH@/components/nsLoginManagerPrompter.js -@BINPATH@/components/storage-mozStorage.js -@BINPATH@/components/crypto-SDR.js @BINPATH@/components/TooltipTextProvider.js @BINPATH@/components/TooltipTextProvider.manifest @BINPATH@/components/NetworkGeolocationProvider.manifest diff --git a/toolkit/components/passwordmgr/nsLoginInfo.js b/toolkit/components/passwordmgr/LoginInfo.jsm similarity index 97% rename from toolkit/components/passwordmgr/nsLoginInfo.js rename to toolkit/components/passwordmgr/LoginInfo.jsm index 60882ebf1e76..392ec8eb3699 100644 --- a/toolkit/components/passwordmgr/nsLoginInfo.js +++ b/toolkit/components/passwordmgr/LoginInfo.jsm @@ -89,4 +89,4 @@ nsLoginInfo.prototype = { }; // end of nsLoginInfo implementation -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsLoginInfo]); +var EXPORTED_SYMBOLS = ["nsLoginInfo"]; diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/LoginManager.jsm similarity index 99% rename from toolkit/components/passwordmgr/nsLoginManager.js rename to toolkit/components/passwordmgr/LoginManager.jsm index 30eb4d1c6f50..5438ea432b78 100644 --- a/toolkit/components/passwordmgr/nsLoginManager.js +++ b/toolkit/components/passwordmgr/LoginManager.jsm @@ -585,4 +585,4 @@ LoginManager.prototype = { }, }; // end of LoginManager implementation -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManager]); +var EXPORTED_SYMBOLS = ["LoginManager"]; diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/LoginManagerPrompter.jsm similarity index 99% rename from toolkit/components/passwordmgr/nsLoginManagerPrompter.js rename to toolkit/components/passwordmgr/LoginManagerPrompter.jsm index 63429f9a4c81..20faa1e5f3cf 100644 --- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js +++ b/toolkit/components/passwordmgr/LoginManagerPrompter.jsm @@ -1561,5 +1561,4 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerPrompter.prototype, "log", () => { return logger.log.bind(logger); }); -var component = [LoginManagerPromptFactory, LoginManagerPrompter]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); +var EXPORTED_SYMBOLS = ["LoginManagerPromptFactory", "LoginManagerPrompter"]; diff --git a/toolkit/components/passwordmgr/components.conf b/toolkit/components/passwordmgr/components.conf new file mode 100644 index 000000000000..f6c0ddd9a1e9 --- /dev/null +++ b/toolkit/components/passwordmgr/components.conf @@ -0,0 +1,63 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +Classes = [ + { + 'cid': '{cb9e0de8-3598-4ed7-857b-827f011ad5d8}', + 'contract_ids': ['@mozilla.org/login-manager;1'], + 'jsm': 'resource://gre/modules/LoginManager.jsm', + 'constructor': 'LoginManager', + }, + { + 'cid': '{749e62f4-60ae-4569-a8a2-de78b649660e}', + 'contract_ids': ['@mozilla.org/passwordmanager/authpromptfactory;1'], + 'jsm': 'resource://gre/modules/LoginManagerPrompter.jsm', + 'constructor': 'LoginManagerPromptFactory', + }, + { + 'cid': '{8aa66d77-1bbb-45a6-991e-b8f47751c291}', + 'contract_ids': ['@mozilla.org/login-manager/prompter;1'], + 'jsm': 'resource://gre/modules/LoginManagerPrompter.jsm', + 'constructor': 'LoginManagerPrompter', + }, + { + 'cid': '{0f2f347c-1e4f-40cc-8efd-792dea70a85e}', + 'contract_ids': ['@mozilla.org/login-manager/loginInfo;1'], + 'jsm': 'resource://gre/modules/LoginInfo.jsm', + 'constructor': 'nsLoginInfo', + }, + { + 'cid': '{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}', + 'contract_ids': ['@mozilla.org/login-manager/crypto/SDR;1'], + 'jsm': 'resource://gre/modules/crypto-SDR.js', + 'constructor': 'LoginManagerCrypto_SDR', + }, +] + +if buildconfig.substs['OS_TARGET'] == 'Android': + Classes += [ + { + 'cid': '{8c2023b9-175c-477e-9761-44ae7b549756}', + 'contract_ids': [ + '@mozilla.org/login-manager/storage/mozStorage;1', + '@mozilla.org/login-manager/storage/default;1', + ], + 'jsm': 'resource://gre/modules/storage-mozStorage.js', + 'constructor': 'LoginManagerStorage_mozStorage', + }, + ] +else: + Classes += [ + { + 'cid': '{c00c432d-a0c9-46d7-bef6-9c45b4d07341}', + 'contract_ids': [ + '@mozilla.org/login-manager/storage/json;1', + '@mozilla.org/login-manager/storage/default;1', + ], + 'jsm': 'resource://gre/modules/storage-json.js', + 'constructor': 'LoginManagerStorage_json', + }, + ] diff --git a/toolkit/components/passwordmgr/crypto-SDR.js b/toolkit/components/passwordmgr/crypto-SDR.js index da44d333cbcc..4b0896b5f4a7 100644 --- a/toolkit/components/passwordmgr/crypto-SDR.js +++ b/toolkit/components/passwordmgr/crypto-SDR.js @@ -235,5 +235,4 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerCrypto_SDR.prototype, "log", () => return logger.log.bind(logger); }); -var component = [LoginManagerCrypto_SDR]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); +var EXPORTED_SYMBOLS = ["LoginManagerCrypto_SDR"]; diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build index 732160f54135..2a16b5e08fcc 100644 --- a/toolkit/components/passwordmgr/moz.build +++ b/toolkit/components/passwordmgr/moz.build @@ -28,37 +28,28 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'loginmgr' -EXTRA_COMPONENTS += [ - 'crypto-SDR.js', - 'nsLoginInfo.js', - 'nsLoginManager.js', - 'nsLoginManagerPrompter.js', -] - -EXTRA_PP_COMPONENTS += [ - 'passwordmgr.manifest', -] - EXTRA_JS_MODULES += [ + 'crypto-SDR.js', 'InsecurePasswordUtils.jsm', 'LoginHelper.jsm', + 'LoginInfo.jsm', + 'LoginManager.jsm', 'LoginManagerContent.jsm', 'LoginManagerParent.jsm', + 'LoginManagerPrompter.jsm', 'LoginRecipes.jsm', 'OSCrypto.jsm', ] if CONFIG['OS_TARGET'] == 'Android': - EXTRA_COMPONENTS += [ + EXTRA_JS_MODULES += [ 'storage-mozStorage.js', ] else: - EXTRA_COMPONENTS += [ - 'storage-json.js', - ] EXTRA_JS_MODULES += [ 'LoginImport.jsm', 'LoginStore.jsm', + 'storage-json.js', ] if CONFIG['OS_TARGET'] == 'WINNT': @@ -71,6 +62,10 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser': 'LoginManagerContextMenu.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + JAR_MANIFESTS += ['jar.mn'] with Files('**'): diff --git a/toolkit/components/passwordmgr/passwordmgr.manifest b/toolkit/components/passwordmgr/passwordmgr.manifest deleted file mode 100644 index e53977e2fb70..000000000000 --- a/toolkit/components/passwordmgr/passwordmgr.manifest +++ /dev/null @@ -1,19 +0,0 @@ -component {cb9e0de8-3598-4ed7-857b-827f011ad5d8} nsLoginManager.js -contract @mozilla.org/login-manager;1 {cb9e0de8-3598-4ed7-857b-827f011ad5d8} -component {749e62f4-60ae-4569-a8a2-de78b649660e} nsLoginManagerPrompter.js -contract @mozilla.org/passwordmanager/authpromptfactory;1 {749e62f4-60ae-4569-a8a2-de78b649660e} -component {8aa66d77-1bbb-45a6-991e-b8f47751c291} nsLoginManagerPrompter.js -contract @mozilla.org/login-manager/prompter;1 {8aa66d77-1bbb-45a6-991e-b8f47751c291} -component {0f2f347c-1e4f-40cc-8efd-792dea70a85e} nsLoginInfo.js -contract @mozilla.org/login-manager/loginInfo;1 {0f2f347c-1e4f-40cc-8efd-792dea70a85e} -#ifdef ANDROID -component {8c2023b9-175c-477e-9761-44ae7b549756} storage-mozStorage.js -contract @mozilla.org/login-manager/storage/mozStorage;1 {8c2023b9-175c-477e-9761-44ae7b549756} -contract @mozilla.org/login-manager/storage/default;1 {8c2023b9-175c-477e-9761-44ae7b549756} -#else -component {c00c432d-a0c9-46d7-bef6-9c45b4d07341} storage-json.js -contract @mozilla.org/login-manager/storage/json;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341} -contract @mozilla.org/login-manager/storage/default;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341} -#endif -component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js -contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} diff --git a/toolkit/components/passwordmgr/storage-json.js b/toolkit/components/passwordmgr/storage-json.js index fcc0c56ff21d..91fe20577d92 100644 --- a/toolkit/components/passwordmgr/storage-json.js +++ b/toolkit/components/passwordmgr/storage-json.js @@ -542,4 +542,4 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_json.prototype, "log", () = return logger.log.bind(logger); }); -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManagerStorage_json]); +var EXPORTED_SYMBOLS = ["LoginManagerStorage_json"]; diff --git a/toolkit/components/passwordmgr/storage-mozStorage.js b/toolkit/components/passwordmgr/storage-mozStorage.js index 9ed12090e124..319179f9ccd2 100644 --- a/toolkit/components/passwordmgr/storage-mozStorage.js +++ b/toolkit/components/passwordmgr/storage-mozStorage.js @@ -1279,5 +1279,4 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_mozStorage.prototype, "log" return logger.log.bind(logger); }); -var component = [LoginManagerStorage_mozStorage]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); +var EXPORTED_SYMBOLS = ["LoginManagerStorage_mozStorage"];