From f0a84cf2e407f79388b8b425715c1beae3dd5d23 Mon Sep 17 00:00:00 2001 From: Issam Mani Date: Wed, 21 Aug 2024 14:12:52 +0000 Subject: [PATCH] Bug 1913967 - Move shared modules to a shared folder. r=sylvestre,frontend-codestyle-reviewers,dimi Differential Revision: https://phabricator.services.mozilla.com/D219659 --- .prettierignore | 2 +- .../components/passwordmgr/LoginManagerChild.sys.mjs | 4 ++-- .../components/passwordmgr/LoginManagerParent.sys.mjs | 2 +- .../passwordmgr/PasswordRulesManager.sys.mjs | 5 +++-- toolkit/components/passwordmgr/moz.build | 11 +++++++---- .../passwordmgr/{ => shared}/LoginFormFactory.sys.mjs | 0 .../passwordmgr/{ => shared}/NewPasswordModel.sys.mjs | 0 .../{ => shared}/PasswordGenerator.sys.mjs | 0 .../{ => shared}/PasswordRulesParser.sys.mjs | 0 .../browser/browser_autofill_track_filled_logins.js | 2 +- .../test_formLike_rootElement_with_Shadow_DOM.html | 2 +- .../test/mochitest/test_formless_submit.html | 2 +- .../passwordmgr/test/unit/test_PasswordGenerator.js | 2 +- .../test_PasswordRulesManager_generatePassword.js | 4 ++-- .../passwordmgr/test/unit/test_getFormFields.js | 2 +- .../passwordmgr/test/unit/test_getPasswordFields.js | 2 +- toolkit/content/license.html | 4 ++-- tools/rewriting/ThirdPartyPaths.txt | 2 +- 18 files changed, 25 insertions(+), 21 deletions(-) rename toolkit/components/passwordmgr/{ => shared}/LoginFormFactory.sys.mjs (100%) rename toolkit/components/passwordmgr/{ => shared}/NewPasswordModel.sys.mjs (100%) rename toolkit/components/passwordmgr/{ => shared}/PasswordGenerator.sys.mjs (100%) rename toolkit/components/passwordmgr/{ => shared}/PasswordRulesParser.sys.mjs (100%) diff --git a/.prettierignore b/.prettierignore index f629afeebb70..3563bbb0132b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1442,7 +1442,7 @@ toolkit/components/certviewer/content/vendor/ toolkit/components/jsoncpp/ toolkit/components/ml/vendor/ toolkit/components/normandy/vendor/ -toolkit/components/passwordmgr/PasswordRulesParser.sys.mjs +toolkit/components/passwordmgr/shared/PasswordRulesParser.sys.mjs toolkit/components/protobuf/ toolkit/components/reader/readability/ toolkit/components/resistfingerprinting/content/gl-matrix.js diff --git a/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs b/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs index a7699499cd39..d192b851d639 100644 --- a/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs @@ -52,11 +52,11 @@ ChromeUtils.defineESModuleGetters(lazy, { FORM_SUBMISSION_REASON: "resource://gre/actors/FormHandlerChild.sys.mjs", InsecurePasswordUtils: "resource://gre/modules/InsecurePasswordUtils.sys.mjs", LoginAutoCompleteResult: "resource://gre/modules/LoginAutoComplete.sys.mjs", - LoginFormFactory: "resource://gre/modules/LoginFormFactory.sys.mjs", + LoginFormFactory: "resource://gre/modules/shared/LoginFormFactory.sys.mjs", LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", LoginRecipesContent: "resource://gre/modules/LoginRecipes.sys.mjs", LoginManagerTelemetry: "resource://gre/modules/LoginManagerTelemetry.sys.mjs", - NewPasswordModel: "resource://gre/modules/NewPasswordModel.sys.mjs", + NewPasswordModel: "resource://gre/modules/shared/NewPasswordModel.sys.mjs", }); XPCOMUtils.defineLazyServiceGetter( diff --git a/toolkit/components/passwordmgr/LoginManagerParent.sys.mjs b/toolkit/components/passwordmgr/LoginManagerParent.sys.mjs index d2cfec2ecd33..b1819e7cd00c 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerParent.sys.mjs @@ -34,7 +34,7 @@ ChromeUtils.defineESModuleGetters(lazy, { MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", WebAuthnFeature: "resource://gre/modules/WebAuthnFeature.sys.mjs", - PasswordGenerator: "resource://gre/modules/PasswordGenerator.sys.mjs", + PasswordGenerator: "resource://gre/modules/shared/PasswordGenerator.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); diff --git a/toolkit/components/passwordmgr/PasswordRulesManager.sys.mjs b/toolkit/components/passwordmgr/PasswordRulesManager.sys.mjs index 32757e51c141..7dc5c0073b25 100644 --- a/toolkit/components/passwordmgr/PasswordRulesManager.sys.mjs +++ b/toolkit/components/passwordmgr/PasswordRulesManager.sys.mjs @@ -6,8 +6,9 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", - PasswordGenerator: "resource://gre/modules/PasswordGenerator.sys.mjs", - PasswordRulesParser: "resource://gre/modules/PasswordRulesParser.sys.mjs", + PasswordGenerator: "resource://gre/modules/shared/PasswordGenerator.sys.mjs", + PasswordRulesParser: + "resource://gre/modules/shared/PasswordRulesParser.sys.mjs", RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", }); diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build index 16e43037027f..f86b8f24a021 100644 --- a/toolkit/components/passwordmgr/moz.build +++ b/toolkit/components/passwordmgr/moz.build @@ -31,7 +31,6 @@ EXTRA_JS_MODULES += [ "crypto-SDR.sys.mjs", "InsecurePasswordUtils.sys.mjs", "LoginAutoComplete.sys.mjs", - "LoginFormFactory.sys.mjs", "LoginHelper.sys.mjs", "LoginInfo.sys.mjs", "LoginManager.shared.mjs", @@ -43,13 +42,17 @@ EXTRA_JS_MODULES += [ "LoginManagerTelemetry.sys.mjs", "LoginRecipes.sys.mjs", "LoginRelatedRealms.sys.mjs", - "NewPasswordModel.sys.mjs", - "PasswordGenerator.sys.mjs", "PasswordRulesManager.sys.mjs", - "PasswordRulesParser.sys.mjs", "storage-json.sys.mjs", ] +EXTRA_JS_MODULES.shared += [ + "shared/LoginFormFactory.sys.mjs", + "shared/NewPasswordModel.sys.mjs", + "shared/PasswordGenerator.sys.mjs", + "shared/PasswordRulesParser.sys.mjs", +] + if CONFIG["OS_TARGET"] != "Android": EXTRA_JS_MODULES += [ "CSV.sys.mjs", diff --git a/toolkit/components/passwordmgr/LoginFormFactory.sys.mjs b/toolkit/components/passwordmgr/shared/LoginFormFactory.sys.mjs similarity index 100% rename from toolkit/components/passwordmgr/LoginFormFactory.sys.mjs rename to toolkit/components/passwordmgr/shared/LoginFormFactory.sys.mjs diff --git a/toolkit/components/passwordmgr/NewPasswordModel.sys.mjs b/toolkit/components/passwordmgr/shared/NewPasswordModel.sys.mjs similarity index 100% rename from toolkit/components/passwordmgr/NewPasswordModel.sys.mjs rename to toolkit/components/passwordmgr/shared/NewPasswordModel.sys.mjs diff --git a/toolkit/components/passwordmgr/PasswordGenerator.sys.mjs b/toolkit/components/passwordmgr/shared/PasswordGenerator.sys.mjs similarity index 100% rename from toolkit/components/passwordmgr/PasswordGenerator.sys.mjs rename to toolkit/components/passwordmgr/shared/PasswordGenerator.sys.mjs diff --git a/toolkit/components/passwordmgr/PasswordRulesParser.sys.mjs b/toolkit/components/passwordmgr/shared/PasswordRulesParser.sys.mjs similarity index 100% rename from toolkit/components/passwordmgr/PasswordRulesParser.sys.mjs rename to toolkit/components/passwordmgr/shared/PasswordRulesParser.sys.mjs diff --git a/toolkit/components/passwordmgr/test/browser/browser_autofill_track_filled_logins.js b/toolkit/components/passwordmgr/test/browser/browser_autofill_track_filled_logins.js index 8f5c2e3f45c1..993fbcbcdb97 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_autofill_track_filled_logins.js +++ b/toolkit/components/passwordmgr/test/browser/browser_autofill_track_filled_logins.js @@ -50,7 +50,7 @@ add_task(async function test() { [{ login, usernameRequested }], async ({ login: addedLogin, usernameRequested: aUsernameRequested }) => { const { LoginFormFactory } = ChromeUtils.importESModule( - "resource://gre/modules/LoginFormFactory.sys.mjs" + "resource://gre/modules/shared/LoginFormFactory.sys.mjs" ); const { LoginManagerChild } = ChromeUtils.importESModule( "resource://gre/modules/LoginManagerChild.sys.mjs" diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html index 722a86efc9b6..24864abd5cea 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html @@ -13,7 +13,7 @@