Loading toolkit/components/passwordmgr/LoginHelper.sys.mjs +1 −1 Original line number Original line Diff line number Diff line Loading @@ -965,7 +965,7 @@ export const LoginHelper = { "Can't add a login with both a httpRealm and formActionOrigin." "Can't add a login with both a httpRealm and formActionOrigin." ); ); } } } else if (newLogin.httpRealm || newLogin.httpRealm == "") { } else if (newLogin.httpRealm) { // We have a HTTP realm. Can't have a form submit URL. // We have a HTTP realm. Can't have a form submit URL. if (newLogin.formActionOrigin != null) { if (newLogin.formActionOrigin != null) { throw new Error( throw new Error( Loading toolkit/components/passwordmgr/LoginManager.sys.mjs +2 −2 Original line number Original line Diff line number Diff line Loading @@ -251,7 +251,7 @@ LoginManager.prototype = { throw new Error("Can't add a login with a null or empty password."); throw new Error("Can't add a login with a null or empty password."); } } // Duplicated from toolkit/components/passwordmgr/LoginHelper.sys.jms // Duplicated from toolkit/components/passwordmgr/LoginHelper.jsm // TODO: move all validations into this function. // TODO: move all validations into this function. // // // In theory these nulls should just be rolled up into the encrypted // In theory these nulls should just be rolled up into the encrypted Loading @@ -269,7 +269,7 @@ LoginManager.prototype = { "Can't add a login with both a httpRealm and formActionOrigin." "Can't add a login with both a httpRealm and formActionOrigin." ); ); } } } else if (login.httpRealm || login.httpRealm == "") { } else if (login.httpRealm) { // We have a HTTP realm. Can't have a form submit URL. // We have a HTTP realm. Can't have a form submit URL. if (login.formActionOrigin != null) { if (login.formActionOrigin != null) { throw new Error( throw new Error( Loading toolkit/components/passwordmgr/test/LoginTestUtils.sys.mjs +0 −8 Original line number Original line Diff line number Diff line Loading @@ -431,14 +431,6 @@ LoginTestUtils.testData = { "the username", "the username", "the password" "the password" ), ), // null formActionOrigin, empty httpRealm new LoginInfo( "http://example.net", null, "", "the username", "the password" ), // --- Examples of logins added by extensions (chrome scheme) --- // --- Examples of logins added by extensions (chrome scheme) --- Loading toolkit/components/passwordmgr/test/unit/test_logins_change.js +7 −1 Original line number Original line Diff line number Diff line Loading @@ -182,7 +182,7 @@ add_task(async function event_data_includes_plaintext_username_and_password() { * Tests invalid combinations of httpRealm and formActionOrigin. * Tests invalid combinations of httpRealm and formActionOrigin. * * * For an nsILoginInfo to be valid for storage, one of the two properties should * For an nsILoginInfo to be valid for storage, one of the two properties should * be strictly equal to null, and the other must not be null. * be strictly equal to null, and the other must not be null or an empty string. * * * The legacy case of an empty string in formActionOrigin and a null value in * The legacy case of an empty string in formActionOrigin and a null value in * httpRealm is also supported for storage at the moment. * httpRealm is also supported for storage at the moment. Loading @@ -194,6 +194,12 @@ add_task(async function test_invalid_httpRealm_formActionOrigin() { /without a httpRealm or formActionOrigin/ /without a httpRealm or formActionOrigin/ ); ); // httpRealm === "", formActionOrigin === null await checkLoginInvalid( TestData.authLogin({ httpRealm: "" }), /without a httpRealm or formActionOrigin/ ); // httpRealm === null, formActionOrigin === "" // httpRealm === null, formActionOrigin === "" // TODO: This is not enforced for now. // TODO: This is not enforced for now. // await checkLoginInvalid(TestData.formLogin({ formActionOrigin: "" }), // await checkLoginInvalid(TestData.formLogin({ formActionOrigin: "" }), Loading toolkit/components/passwordmgr/test/unit/test_logins_search.js +3 −3 Original line number Original line Diff line number Diff line Loading @@ -99,11 +99,11 @@ add_setup(async () => { */ */ add_task(function test_search_all_basic() { add_task(function test_search_all_basic() { // Find all logins, using no filters in the search functions. // Find all logins, using no filters in the search functions. checkAllSearches({}, 28); checkAllSearches({}, 27); // Find all form logins, then all authentication logins. // Find all form logins, then all authentication logins. checkAllSearches({ httpRealm: null }, 17); checkAllSearches({ httpRealm: null }, 17); checkAllSearches({ formActionOrigin: null }, 11); checkAllSearches({ formActionOrigin: null }, 10); // Find all form logins on one host, then all authentication logins. // Find all form logins on one host, then all authentication logins. checkAllSearches({ origin: "http://www4.example.com", httpRealm: null }, 3); checkAllSearches({ origin: "http://www4.example.com", httpRealm: null }, 3); Loading Loading @@ -174,7 +174,7 @@ add_task(function test_searchLogins() { checkSearchLogins({ passwordField: "form_field_password" }, 13); checkSearchLogins({ passwordField: "form_field_password" }, 13); // Find all logins with an empty usernameField, including for authentication. // Find all logins with an empty usernameField, including for authentication. checkSearchLogins({ usernameField: "" }, 16); checkSearchLogins({ usernameField: "" }, 15); // Find form logins with an empty usernameField. // Find form logins with an empty usernameField. checkSearchLogins({ httpRealm: null, usernameField: "" }, 5); checkSearchLogins({ httpRealm: null, usernameField: "" }, 5); Loading Loading
toolkit/components/passwordmgr/LoginHelper.sys.mjs +1 −1 Original line number Original line Diff line number Diff line Loading @@ -965,7 +965,7 @@ export const LoginHelper = { "Can't add a login with both a httpRealm and formActionOrigin." "Can't add a login with both a httpRealm and formActionOrigin." ); ); } } } else if (newLogin.httpRealm || newLogin.httpRealm == "") { } else if (newLogin.httpRealm) { // We have a HTTP realm. Can't have a form submit URL. // We have a HTTP realm. Can't have a form submit URL. if (newLogin.formActionOrigin != null) { if (newLogin.formActionOrigin != null) { throw new Error( throw new Error( Loading
toolkit/components/passwordmgr/LoginManager.sys.mjs +2 −2 Original line number Original line Diff line number Diff line Loading @@ -251,7 +251,7 @@ LoginManager.prototype = { throw new Error("Can't add a login with a null or empty password."); throw new Error("Can't add a login with a null or empty password."); } } // Duplicated from toolkit/components/passwordmgr/LoginHelper.sys.jms // Duplicated from toolkit/components/passwordmgr/LoginHelper.jsm // TODO: move all validations into this function. // TODO: move all validations into this function. // // // In theory these nulls should just be rolled up into the encrypted // In theory these nulls should just be rolled up into the encrypted Loading @@ -269,7 +269,7 @@ LoginManager.prototype = { "Can't add a login with both a httpRealm and formActionOrigin." "Can't add a login with both a httpRealm and formActionOrigin." ); ); } } } else if (login.httpRealm || login.httpRealm == "") { } else if (login.httpRealm) { // We have a HTTP realm. Can't have a form submit URL. // We have a HTTP realm. Can't have a form submit URL. if (login.formActionOrigin != null) { if (login.formActionOrigin != null) { throw new Error( throw new Error( Loading
toolkit/components/passwordmgr/test/LoginTestUtils.sys.mjs +0 −8 Original line number Original line Diff line number Diff line Loading @@ -431,14 +431,6 @@ LoginTestUtils.testData = { "the username", "the username", "the password" "the password" ), ), // null formActionOrigin, empty httpRealm new LoginInfo( "http://example.net", null, "", "the username", "the password" ), // --- Examples of logins added by extensions (chrome scheme) --- // --- Examples of logins added by extensions (chrome scheme) --- Loading
toolkit/components/passwordmgr/test/unit/test_logins_change.js +7 −1 Original line number Original line Diff line number Diff line Loading @@ -182,7 +182,7 @@ add_task(async function event_data_includes_plaintext_username_and_password() { * Tests invalid combinations of httpRealm and formActionOrigin. * Tests invalid combinations of httpRealm and formActionOrigin. * * * For an nsILoginInfo to be valid for storage, one of the two properties should * For an nsILoginInfo to be valid for storage, one of the two properties should * be strictly equal to null, and the other must not be null. * be strictly equal to null, and the other must not be null or an empty string. * * * The legacy case of an empty string in formActionOrigin and a null value in * The legacy case of an empty string in formActionOrigin and a null value in * httpRealm is also supported for storage at the moment. * httpRealm is also supported for storage at the moment. Loading @@ -194,6 +194,12 @@ add_task(async function test_invalid_httpRealm_formActionOrigin() { /without a httpRealm or formActionOrigin/ /without a httpRealm or formActionOrigin/ ); ); // httpRealm === "", formActionOrigin === null await checkLoginInvalid( TestData.authLogin({ httpRealm: "" }), /without a httpRealm or formActionOrigin/ ); // httpRealm === null, formActionOrigin === "" // httpRealm === null, formActionOrigin === "" // TODO: This is not enforced for now. // TODO: This is not enforced for now. // await checkLoginInvalid(TestData.formLogin({ formActionOrigin: "" }), // await checkLoginInvalid(TestData.formLogin({ formActionOrigin: "" }), Loading
toolkit/components/passwordmgr/test/unit/test_logins_search.js +3 −3 Original line number Original line Diff line number Diff line Loading @@ -99,11 +99,11 @@ add_setup(async () => { */ */ add_task(function test_search_all_basic() { add_task(function test_search_all_basic() { // Find all logins, using no filters in the search functions. // Find all logins, using no filters in the search functions. checkAllSearches({}, 28); checkAllSearches({}, 27); // Find all form logins, then all authentication logins. // Find all form logins, then all authentication logins. checkAllSearches({ httpRealm: null }, 17); checkAllSearches({ httpRealm: null }, 17); checkAllSearches({ formActionOrigin: null }, 11); checkAllSearches({ formActionOrigin: null }, 10); // Find all form logins on one host, then all authentication logins. // Find all form logins on one host, then all authentication logins. checkAllSearches({ origin: "http://www4.example.com", httpRealm: null }, 3); checkAllSearches({ origin: "http://www4.example.com", httpRealm: null }, 3); Loading Loading @@ -174,7 +174,7 @@ add_task(function test_searchLogins() { checkSearchLogins({ passwordField: "form_field_password" }, 13); checkSearchLogins({ passwordField: "form_field_password" }, 13); // Find all logins with an empty usernameField, including for authentication. // Find all logins with an empty usernameField, including for authentication. checkSearchLogins({ usernameField: "" }, 16); checkSearchLogins({ usernameField: "" }, 15); // Find form logins with an empty usernameField. // Find form logins with an empty usernameField. checkSearchLogins({ httpRealm: null, usernameField: "" }, 5); checkSearchLogins({ httpRealm: null, usernameField: "" }, 5); Loading