diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
commit | 39dac57259cff8b61db0b22cb2ad0a8adb02692e (patch) | |
tree | 52a026cc8c22793eb17fd0f5e22adce1ae08a1dd /toolkit/components/passwordmgr/test/unit/test_legacy_validation.js | |
parent | a1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff) | |
parent | c2d9ab62f3d097c9e0e00184cab1f546554f5eaa (diff) | |
download | UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.gz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.lz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.xz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.zip |
Merge branch 'redwood' into 28.9-platform
Diffstat (limited to 'toolkit/components/passwordmgr/test/unit/test_legacy_validation.js')
-rw-r--r-- | toolkit/components/passwordmgr/test/unit/test_legacy_validation.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/toolkit/components/passwordmgr/test/unit/test_legacy_validation.js b/toolkit/components/passwordmgr/test/unit/test_legacy_validation.js deleted file mode 100644 index 709bc9818..000000000 --- a/toolkit/components/passwordmgr/test/unit/test_legacy_validation.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests the legacy validation made when storing nsILoginInfo or disabled hosts. - * - * These rules exist because of limitations of the "signons.txt" storage file, - * that is not used anymore. They are still enforced by the Login Manager - * service, despite these values can now be safely stored in the back-end. - */ - -"use strict"; - -// Tests - -/** - * Tests legacy validation with addLogin. - */ -add_task(function test_addLogin_invalid_characters_legacy() -{ - // Test newlines and carriage returns in properties that contain URLs. - for (let testValue of ["http://newline\n.example.com", - "http://carriagereturn.example.com\r"]) { - let loginInfo = TestData.formLogin({ hostname: testValue }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't contain newlines/); - - loginInfo = TestData.formLogin({ formSubmitURL: testValue }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't contain newlines/); - - loginInfo = TestData.authLogin({ httpRealm: testValue }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't contain newlines/); - } - - // Test newlines and carriage returns in form field names. - for (let testValue of ["newline_field\n", "carriagereturn\r_field"]) { - let loginInfo = TestData.formLogin({ usernameField: testValue }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't contain newlines/); - - loginInfo = TestData.formLogin({ passwordField: testValue }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't contain newlines/); - } - - // Test a single dot as the value of usernameField and formSubmitURL. - let loginInfo = TestData.formLogin({ usernameField: "." }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't be periods/); - - loginInfo = TestData.formLogin({ formSubmitURL: "." }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /login values can't be periods/); - - // Test the sequence " (" inside the value of the "hostname" property. - loginInfo = TestData.formLogin({ hostname: "http://parens (.example.com" }); - Assert.throws(() => Services.logins.addLogin(loginInfo), - /bad parens in hostname/); -}); - -/** - * Tests legacy validation with setLoginSavingEnabled. - */ -add_task(function test_setLoginSavingEnabled_invalid_characters_legacy() -{ - for (let hostname of ["http://newline\n.example.com", - "http://carriagereturn.example.com\r", - "."]) { - Assert.throws(() => Services.logins.setLoginSavingEnabled(hostname, false), - /Invalid hostname/); - } -}); |