summaryrefslogtreecommitdiffstats
path: root/toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js')
-rw-r--r--toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js b/toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js
deleted file mode 100644
index f3bc62b0a..000000000
--- a/toolkit/components/passwordmgr/test/browser/browser_master_password_autocomplete.js
+++ /dev/null
@@ -1,59 +0,0 @@
-const HOST = "https://example.com";
-const URL = HOST + "/browser/toolkit/components/passwordmgr/test/browser/form_basic.html";
-const TIMEOUT_PREF = "signon.masterPasswordReprompt.timeout_ms";
-
-// Waits for the master password prompt and cancels it.
-function waitForDialog() {
- let dialogShown = TestUtils.topicObserved("common-dialog-loaded");
- return dialogShown.then(function([subject]) {
- let dialog = subject.Dialog;
- is(dialog.args.title, "Password Required");
- dialog.ui.button1.click();
- });
-}
-
-// Test that autocomplete does not trigger a master password prompt
-// for a certain time after it was cancelled.
-add_task(function* test_mpAutocompleteTimeout() {
- let login = LoginTestUtils.testData.formLogin({
- hostname: "https://example.com",
- formSubmitURL: "https://example.com",
- username: "username",
- password: "password",
- });
- Services.logins.addLogin(login);
- LoginTestUtils.masterPassword.enable();
-
- registerCleanupFunction(function() {
- LoginTestUtils.masterPassword.disable();
- Services.logins.removeAllLogins();
- });
-
- // Set master password prompt timeout to 3s.
- // If this test goes intermittent, you likely have to increase this value.
- yield SpecialPowers.pushPrefEnv({set: [[TIMEOUT_PREF, 3000]]});
-
- // Wait for initial master password dialog after opening the tab.
- let dialogShown = waitForDialog();
-
- yield BrowserTestUtils.withNewTab(URL, function*(browser) {
- yield dialogShown;
-
- yield ContentTask.spawn(browser, null, function*() {
- // Focus the password field to trigger autocompletion.
- content.document.getElementById("form-basic-password").focus();
- });
-
- // Wait 4s, dialog should not have been shown
- // (otherwise the code below will not work).
- yield new Promise((c) => setTimeout(c, 4000));
-
- dialogShown = waitForDialog();
- yield ContentTask.spawn(browser, null, function*() {
- // Re-focus the password field to trigger autocompletion.
- content.document.getElementById("form-basic-username").focus();
- content.document.getElementById("form-basic-password").focus();
- });
- yield dialogShown;
- });
-});