зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540828 checkACForm function r=aryx
Differential Revision: https://phabricator.services.mozilla.com/D27060 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4140aef08f
Коммит
5c8bd123af
|
@ -395,3 +395,10 @@ this.LoginManager = new Proxy({}, {
|
|||
};
|
||||
},
|
||||
});
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(usernameField, expectedUsername, passwordField, expectedPassword) {
|
||||
let formID = usernameField.parentNode.id;
|
||||
is(usernameField.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(passwordField.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
|
|
@ -68,13 +68,6 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
let formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username");
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password");
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["signon.schemeUpgrades", true]]});
|
||||
|
||||
|
@ -93,7 +86,7 @@ add_task(async function setup() {
|
|||
|
||||
add_task(async function test_empty_first_entry() {
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
// Trigger autocomplete popup
|
||||
restoreForm();
|
||||
let popupState = await getPopupState();
|
||||
|
@ -109,10 +102,10 @@ add_task(async function test_empty_first_entry() {
|
|||
let index0Promise = notifySelectedIndex(0);
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
await index0Promise;
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("name", "pass");
|
||||
checkACForm(uname, "name", pword, "pass");
|
||||
});
|
||||
|
||||
add_task(async function test_empty_second_entry() {
|
||||
|
@ -124,7 +117,7 @@ add_task(async function test_empty_second_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // second
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("name1", "pass1");
|
||||
checkACForm(uname, "name1", pword, "pass1");
|
||||
});
|
||||
|
||||
add_task(async function test_search() {
|
||||
|
@ -141,7 +134,7 @@ add_task(async function test_search() {
|
|||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("name1", "pass1");
|
||||
checkACForm(uname, "name1", pword, "pass1");
|
||||
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is now closed");
|
||||
|
@ -163,7 +156,7 @@ add_task(async function test_delete_first_entry() {
|
|||
// On Win/Linux, shift-backspace does not work, delete and shift-delete do.
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await deletionPromise;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
|
||||
let results = await notifyMenuChanged(3, "name1");
|
||||
|
||||
|
@ -191,7 +184,7 @@ add_task(async function test_delete_duplicate_entry() {
|
|||
// On Win/Linux, shift-backspace does not work, delete and shift-delete do.
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await deletionPromise;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
|
||||
is(LoginManager.countLogins("http://example.org", "http://example.org", null), 1,
|
||||
"Check that the HTTP login remains");
|
||||
|
|
|
@ -51,16 +51,9 @@ var setupScript = runInParent(function setup() {
|
|||
let uname = document.getElementById("uname");
|
||||
let pword = document.getElementById("pword");
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
add_task(async function test_no_autofill() {
|
||||
// Make sure initial form is empty as autofill shouldn't happen in the sandboxed frame.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -83,7 +76,7 @@ add_task(async function test_two_logins() {
|
|||
];
|
||||
checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
|
||||
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let removedPromise = promiseStorageChanged(["removeAllLogins"]);
|
||||
LoginManager.removeAllLogins();
|
||||
await removedPromise;
|
||||
|
@ -104,13 +97,13 @@ add_task(async function test_zero_logins() {
|
|||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is still closed");
|
||||
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
shownPromise = promiseACShown();
|
||||
info("arrow down should still open the popup");
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
results = await shownPromise;
|
||||
checkAutoCompleteResults(results, [], "example.com", "Check only footer is displayed.");
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -55,13 +55,6 @@ let uname;
|
|||
let pword;
|
||||
let hostname;
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["security.insecure_field_warning.contextual.enabled", true],
|
||||
|
@ -80,7 +73,7 @@ add_task(async function setup() {
|
|||
|
||||
add_task(async function test_no_autofill() {
|
||||
// Make sure initial form is empty as autofill shouldn't happen in the sandboxed frame.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -99,7 +92,7 @@ add_task(async function test_autocomplete_warning_no_logins() {
|
|||
];
|
||||
checkAutoCompleteResults(results, expectedMenuItems, hostname, "Check all menuitems are displayed correctly.");
|
||||
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -30,15 +30,6 @@ let nsLoginInfo = SpecialPowers.wrap(SpecialPowers.Components).Constructor("@moz
|
|||
<script class="testbody" type="text/javascript">
|
||||
let iframe = SpecialPowers.wrap(document.getElementsByTagName("iframe")[0]);
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
let formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username");
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password");
|
||||
}
|
||||
async function prepareLoginsAndProcessForm(url, logins = []) {
|
||||
LoginManager.removeAllLogins();
|
||||
|
||||
|
@ -60,7 +51,10 @@ add_task(async function test_formSubmitURL_wildcard_should_autofill() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name2", "pass2");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name2", pword, "pass2");
|
||||
});
|
||||
|
||||
add_task(async function test_formSubmitURL_different_shouldnt_autofill() {
|
||||
|
@ -69,7 +63,10 @@ add_task(async function test_formSubmitURL_different_shouldnt_autofill() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("", "");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -31,21 +31,15 @@ runInParent(function initLogins() {
|
|||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
let win;
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
let doc = win.document;
|
||||
let uname = doc.getElementById("form-basic-username");
|
||||
let pword = doc.getElementById("form-basic-password");
|
||||
let formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username");
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password");
|
||||
}
|
||||
|
||||
add_task(async function test_crossOriginBfcacheRestore() {
|
||||
let processedPromise = promiseFormsProcessed();
|
||||
win = window.open("form_basic.html", "loginWin");
|
||||
await processedPromise;
|
||||
checkACForm("autofilled", "pass1");
|
||||
let doc = win.document;
|
||||
let uname = doc.getElementById("form-basic-username");
|
||||
let pword = doc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "autofilled", pword, "pass1");
|
||||
|
||||
let pageHidePromise = new Promise(resolve => {
|
||||
win.addEventListener("pagehide", resolve, {once: true});
|
||||
|
@ -60,7 +54,7 @@ add_task(async function test_crossOriginBfcacheRestore() {
|
|||
processedPromise = promiseFormsProcessed();
|
||||
SpecialPowers.wrap(win).history.back();
|
||||
await processedPromise;
|
||||
checkACForm("autofilled", "pass1");
|
||||
checkACForm(uname, "autofilled", pword, "pass1");
|
||||
win.close();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -31,15 +31,6 @@ let nsLoginInfo = SpecialPowers.wrap(SpecialPowers.Components).Constructor("@moz
|
|||
<script class="testbody" type="text/javascript">
|
||||
let iframe = SpecialPowers.wrap(document.getElementsByTagName("iframe")[0]);
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
let formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username");
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password");
|
||||
}
|
||||
async function prepareLoginsAndProcessForm(url, logins = []) {
|
||||
LoginManager.removeAllLogins();
|
||||
|
||||
|
@ -65,7 +56,10 @@ add_task(async function test_simpleNoDupesNoAction() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name2", "pass2");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name2", pword, "pass2");
|
||||
});
|
||||
|
||||
add_task(async function test_simpleNoDupesUpgradeOriginAndAction() {
|
||||
|
@ -74,7 +68,10 @@ add_task(async function test_simpleNoDupesUpgradeOriginAndAction() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name2", "pass2");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name2", pword, "pass2");
|
||||
});
|
||||
|
||||
add_task(async function test_simpleNoDupesUpgradeOriginOnly() {
|
||||
|
@ -83,7 +80,10 @@ add_task(async function test_simpleNoDupesUpgradeOriginOnly() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name2", "pass2");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name2", pword, "pass2");
|
||||
});
|
||||
|
||||
add_task(async function test_simpleNoDupesUpgradeActionOnly() {
|
||||
|
@ -92,7 +92,10 @@ add_task(async function test_simpleNoDupesUpgradeActionOnly() {
|
|||
"name2", "pass2", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name2", "pass2");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name2", pword, "pass2");
|
||||
});
|
||||
|
||||
add_task(async function test_dedupe() {
|
||||
|
@ -107,7 +110,10 @@ add_task(async function test_dedupe() {
|
|||
"name1", "passHTTPStoHTTP", "uname", "pword"),
|
||||
]);
|
||||
|
||||
checkACForm("name1", "passHTTPStoHTTPS");
|
||||
let iframeDoc = iframe.contentDocument;
|
||||
let uname = iframeDoc.getElementById("form-basic-username");
|
||||
let pword = iframeDoc.getElementById("form-basic-password");
|
||||
checkACForm(uname, "name1", pword, "passHTTPStoHTTPS");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -49,13 +49,6 @@ let sandboxed = document.getElementById("sandboxed");
|
|||
let uname;
|
||||
let pword;
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
function promiseExecuteSoon() {
|
||||
return new Promise(SimpleTest.executeSoon);
|
||||
}
|
||||
|
@ -90,7 +83,7 @@ add_task(async function test_no_autofill_in_form() {
|
|||
await promiseExecuteSoon();
|
||||
// Autofill shouldn't happen in the sandboxed frame but would have happened by
|
||||
// now since DOMFormHasPassword was observed above.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
|
||||
info("blurring the username field after typing the username");
|
||||
uname.focus();
|
||||
|
@ -99,7 +92,7 @@ add_task(async function test_no_autofill_in_form() {
|
|||
await promiseExecuteSoon();
|
||||
await promiseExecuteSoon();
|
||||
await promiseExecuteSoon();
|
||||
checkACForm("tempuser1", "");
|
||||
checkACForm(uname, "tempuser1", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_no_autofill_outside_form() {
|
||||
|
@ -126,7 +119,7 @@ add_task(async function test_no_autofill_outside_form() {
|
|||
await promiseExecuteSoon();
|
||||
// Autofill shouldn't happen in the sandboxed frame but would have happened by
|
||||
// now since DOMInputPasswordAdded was observed above.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, pword, "", "");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -123,13 +123,6 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
function sendFakeAutocompleteEvent(element) {
|
||||
var acEvent = document.createEvent("HTMLEvents");
|
||||
acEvent.initEvent("DOMAutoComplete", true, false);
|
||||
|
@ -148,7 +141,7 @@ add_task(async function test_form1_initial_empty() {
|
|||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -170,10 +163,10 @@ add_task(async function test_form1_menuitems() {
|
|||
"zzzuser4"];
|
||||
checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
|
||||
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
synthesizeKey("KEY_Enter");
|
||||
await spinEventLoop(); // let focus happen
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_entry() {
|
||||
|
@ -188,10 +181,10 @@ add_task(async function test_form1_first_entry() {
|
|||
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
|
||||
|
||||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_second_entry() {
|
||||
|
@ -205,7 +198,7 @@ add_task(async function test_form1_second_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // second
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_third_entry() {
|
||||
|
@ -220,7 +213,7 @@ add_task(async function test_form1_third_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // third
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser3", "testpass3");
|
||||
checkACForm(uname, "testuser3", pword, "testpass3");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fourth_entry() {
|
||||
|
@ -236,7 +229,7 @@ add_task(async function test_form1_fourth_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // fourth
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_first_entry() {
|
||||
|
@ -256,7 +249,7 @@ add_task(async function test_form1_wraparound_first_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_up_last_entry() {
|
||||
|
@ -270,7 +263,7 @@ add_task(async function test_form1_wraparound_up_last_entry() {
|
|||
synthesizeKey("KEY_ArrowUp"); // last (fourth)
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_down_up_up() {
|
||||
|
@ -286,7 +279,7 @@ add_task(async function test_form1_wraparound_down_up_up() {
|
|||
synthesizeKey("KEY_ArrowUp"); // select last entry
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_up_last() {
|
||||
|
@ -307,7 +300,7 @@ add_task(async function test_form1_wraparound_up_last() {
|
|||
synthesizeKey("KEY_ArrowUp"); // last entry
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fill_username_without_autofill_right() {
|
||||
|
@ -320,7 +313,7 @@ add_task(async function test_form1_fill_username_without_autofill_right() {
|
|||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_ArrowRight");
|
||||
await spinEventLoop();
|
||||
checkACForm("tempuser1", ""); // empty password
|
||||
checkACForm(uname, "tempuser1", pword, ""); // empty password
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fill_username_without_autofill_left() {
|
||||
|
@ -332,7 +325,7 @@ add_task(async function test_form1_fill_username_without_autofill_left() {
|
|||
// Set first entry w/o triggering autocomplete
|
||||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_ArrowLeft");
|
||||
checkACForm("tempuser1", ""); // empty password
|
||||
checkACForm(uname, "tempuser1", pword, ""); // empty password
|
||||
});
|
||||
|
||||
add_task(async function test_form1_pageup_first() {
|
||||
|
@ -347,7 +340,7 @@ add_task(async function test_form1_pageup_first() {
|
|||
synthesizeKey("KEY_PageUp"); // first
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_pagedown_last() {
|
||||
|
@ -363,7 +356,7 @@ add_task(async function test_form1_pagedown_last() {
|
|||
synthesizeKey("KEY_ArrowUp"); // last
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_untrusted_event() {
|
||||
|
@ -371,11 +364,11 @@ add_task(async function test_form1_untrusted_event() {
|
|||
await spinEventLoop();
|
||||
|
||||
// Send a fake (untrusted) event.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
uname.value = "zzzuser4";
|
||||
sendFakeAutocompleteEvent(uname);
|
||||
await spinEventLoop();
|
||||
checkACForm("zzzuser4", "");
|
||||
checkACForm(uname, "zzzuser4", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete() {
|
||||
|
@ -401,13 +394,13 @@ add_task(async function test_form1_delete() {
|
|||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await deletionPromise;
|
||||
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
|
||||
is(numLogins, 4, "Correct number of logins after deleting one");
|
||||
await countChangedPromise;
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_deletion() {
|
||||
|
@ -420,7 +413,7 @@ add_task(async function test_form1_first_after_deletion() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete_second() {
|
||||
|
@ -433,12 +426,12 @@ add_task(async function test_form1_delete_second() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
|
||||
is(numLogins, 3, "Correct number of logins after deleting one");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_deletion2() {
|
||||
|
@ -451,7 +444,7 @@ add_task(async function test_form1_first_after_deletion2() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete_last() {
|
||||
|
@ -465,13 +458,13 @@ add_task(async function test_form1_delete_last() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
|
||||
is(numLogins, 2, "Correct number of logins after deleting one");
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_3_deletions() {
|
||||
|
@ -484,7 +477,7 @@ add_task(async function test_form1_first_after_3_deletions() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_check_only_entry_remaining() {
|
||||
|
@ -498,7 +491,7 @@ add_task(async function test_form1_check_only_entry_remaining() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
let storageChanged = promiseStorageChanged(["removeLogin", "removeLogin", "addLogin"]);
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
|
||||
is(numLogins, 1, "Correct number of logins after deleting one");
|
||||
|
||||
|
@ -520,7 +513,7 @@ add_task(async function test_form2() {
|
|||
// Turn our attention to form2
|
||||
uname = $_(2, "uname");
|
||||
pword = $_(2, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
|
@ -529,10 +522,10 @@ add_task(async function test_form2() {
|
|||
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form3() {
|
||||
|
@ -545,7 +538,7 @@ add_task(async function test_form3() {
|
|||
|
||||
uname = $_(3, "uname");
|
||||
pword = $_(3, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -553,10 +546,10 @@ add_task(async function test_form3() {
|
|||
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form4() {
|
||||
|
@ -569,7 +562,7 @@ add_task(async function test_form4() {
|
|||
|
||||
uname = $_(4, "uname");
|
||||
pword = $_(4, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -577,10 +570,10 @@ add_task(async function test_form4() {
|
|||
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form5() {
|
||||
|
@ -593,7 +586,7 @@ add_task(async function test_form5() {
|
|||
|
||||
uname = $_(5, "uname");
|
||||
pword = $_(5, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -601,10 +594,10 @@ add_task(async function test_form5() {
|
|||
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form6() {
|
||||
|
@ -620,7 +613,7 @@ add_task(async function test_form6() {
|
|||
// that was being suppressed would have been filled in otherwise)
|
||||
uname = $_(6, "uname");
|
||||
pword = $_(6, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form6_changeUsername() {
|
||||
|
@ -632,7 +625,7 @@ add_task(async function test_form6_changeUsername() {
|
|||
// Trigger the 'blur' event on uname
|
||||
pword.focus();
|
||||
await spinEventLoop();
|
||||
checkACForm("singleuser5X", "singlepass5");
|
||||
checkACForm(uname, "singleuser5X", pword, "singlepass5");
|
||||
uname.focus();
|
||||
|
||||
let storageChanged = promiseStorageChanged(["removeLogin"]);
|
||||
|
@ -655,7 +648,7 @@ add_task(async function test_form7() {
|
|||
|
||||
uname = $_(7, "uname");
|
||||
pword = $_(7, "pword");
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
|
||||
// Insert a new username field into the form. We'll then make sure
|
||||
// that invoking the autocomplete doesn't try to fill the form.
|
||||
|
@ -683,16 +676,17 @@ add_task(async function test_form7_2() {
|
|||
"example.com",
|
||||
"Check dropdown is showing all logins while field is blank");
|
||||
|
||||
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
// The form changes, so we expect the old username field to get the
|
||||
// selected autocomplete value, but neither the new username field nor
|
||||
// the password field should have any values filled in.
|
||||
await SimpleTest.promiseWaitForCondition(() => uname.value == "form7user1",
|
||||
"Wait for username to get filled");
|
||||
checkACForm("form7user1", "");
|
||||
checkACForm(uname, "form7user1", pword, "");
|
||||
is($_(7, "uname2").value, "", "Verifying empty uname2");
|
||||
restoreForm(); // clear field, so reloading test doesn't fail
|
||||
|
||||
|
@ -721,23 +715,23 @@ add_task(async function test_form8() {
|
|||
|
||||
uname = $_(8, "uname");
|
||||
pword = $_(8, "pword");
|
||||
checkACForm("form8user", "form8pass");
|
||||
checkACForm(uname, "form8user", pword, "form8pass");
|
||||
restoreForm();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_blur() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
// Focus the previous form to trigger a blur.
|
||||
$_(7, "uname").focus();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_2() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
restoreForm();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_3() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let storageChanged = promiseStorageChanged(["removeLogin", "addLogin", "addLogin"]);
|
||||
setupScript.sendSyncMessage("removeLogin", "login7");
|
||||
setupScript.sendSyncMessage("addLogin", "login8A");
|
||||
|
@ -774,19 +768,19 @@ add_task(async function test_form9_filtering() {
|
|||
"example.com",
|
||||
"Check dropdown is showing login with only one 'A'");
|
||||
|
||||
checkACForm("form9userAB", "");
|
||||
checkACForm(uname, "form9userAB", pword, "");
|
||||
uname.focus();
|
||||
synthesizeKey("KEY_ArrowLeft");
|
||||
shownPromise = promiseACShown();
|
||||
synthesizeKey("A", {shiftKey: true});
|
||||
results = await shownPromise;
|
||||
|
||||
checkACForm("form9userAAB", "");
|
||||
checkACForm(uname, "form9userAAB", pword, "");
|
||||
checkAutoCompleteResults(results, ["form9userAAB"], "example.com", "Check dropdown is updated after inserting 'A'");
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("form9userAAB", "form9pass");
|
||||
checkACForm(uname, "form9userAAB", pword, "form9pass");
|
||||
});
|
||||
|
||||
add_task(async function test_form9_autocomplete_cache() {
|
||||
|
@ -828,18 +822,18 @@ add_task(async function test_form11_formless() {
|
|||
uname = $_(11, "uname");
|
||||
pword = $_(11, "pword");
|
||||
restoreForm();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
await shownPromise;
|
||||
|
||||
// Trigger autocomplete
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
let processedPromise = promiseFormsProcessed();
|
||||
synthesizeKey("KEY_Enter");
|
||||
await processedPromise;
|
||||
checkACForm("testuser11", "testpass11");
|
||||
checkACForm(uname, "testuser11", pword, "testpass11");
|
||||
});
|
||||
|
||||
add_task(async function test_form11_open_on_trusted_focus() {
|
||||
|
@ -851,7 +845,7 @@ add_task(async function test_form11_open_on_trusted_focus() {
|
|||
// Move focus to the password field so we can test the first click on the
|
||||
// username field.
|
||||
pword.focus();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
const firePrivEventPromise = new Promise((resolve) => {
|
||||
uname.addEventListener("click", (e) => {
|
||||
ok(e.isTrusted, "Ensure event is trusted");
|
||||
|
@ -866,7 +860,7 @@ add_task(async function test_form11_open_on_trusted_focus() {
|
|||
const processedPromise = promiseFormsProcessed();
|
||||
synthesizeKey("KEY_Enter");
|
||||
await processedPromise;
|
||||
checkACForm("testuser11", "testpass11");
|
||||
checkACForm(uname, "testuser11", pword, "testpass11");
|
||||
let storageChanged = promiseStorageChanged(["removeLogin"]);
|
||||
setupScript.sendSyncMessage("removeLogin", "login11");
|
||||
await storageChanged;
|
||||
|
@ -900,25 +894,25 @@ add_task(async function test_form12_recipes() {
|
|||
pword.type = "password";
|
||||
await promiseFormsProcessed();
|
||||
restoreForm();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
await shownPromise;
|
||||
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser10", "testpass10");
|
||||
checkACForm(uname, "testuser10", pword, "testpass10");
|
||||
|
||||
// Now test recipes with blur on the username field.
|
||||
restoreForm();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
uname.value = "testuser10";
|
||||
checkACForm("testuser10", "");
|
||||
checkACForm(uname, "testuser10", pword, "");
|
||||
synthesizeKey("KEY_Tab");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser10", "testpass10");
|
||||
checkACForm(uname, "testuser10", pword, "testpass10");
|
||||
await resetRecipes();
|
||||
});
|
||||
|
||||
|
@ -933,7 +927,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
|
||||
uname = $_(13, "uname");
|
||||
pword = $_(13, "pword");
|
||||
checkACForm("prefilled", "prefilled");
|
||||
checkACForm(uname, "prefilled", pword, "prefilled");
|
||||
|
||||
uname.scrollIntoView();
|
||||
let shownPromise = promiseACShown();
|
||||
|
@ -945,7 +939,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
await spinEventLoop();
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, true, "Check popup is still open");
|
||||
checkACForm("", "prefilled");
|
||||
checkACForm(uname, "", pword, "prefilled");
|
||||
|
||||
info("testing password field");
|
||||
synthesizeMouseAtCenter(pword, {});
|
||||
|
@ -955,7 +949,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_Delete");
|
||||
await shownPromise;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -57,13 +57,6 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
function spinEventLoop() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -76,7 +69,7 @@ add_task(async function test_form1_initial_empty() {
|
|||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -100,11 +93,11 @@ add_task(async function test_form1_menu_shows_logins_for_different_formSubmitURL
|
|||
checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
|
||||
|
||||
synthesizeKey("KEY_ArrowDown"); // first item
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("dfsu1", "dfsp1");
|
||||
checkACForm(uname, "dfsu1", pword, "dfsp1");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -70,17 +70,11 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username");
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password");
|
||||
}
|
||||
|
||||
add_task(async function test_empty_first_entry() {
|
||||
/* test 1 */
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
// Trigger autocomplete popup
|
||||
restoreForm();
|
||||
let popupState = await getPopupState();
|
||||
|
@ -96,10 +90,10 @@ add_task(async function test_empty_first_entry() {
|
|||
let index0Promise = notifySelectedIndex(0);
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
await index0Promise;
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("name", "pass");
|
||||
checkACForm(uname, "name", pword, "pass");
|
||||
});
|
||||
|
||||
add_task(async function test_empty_second_entry() {
|
||||
|
@ -111,7 +105,7 @@ add_task(async function test_empty_second_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // second
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("Name", "Pass");
|
||||
checkACForm(uname, "Name", pword, "Pass");
|
||||
});
|
||||
|
||||
add_task(async function test_empty_third_entry() {
|
||||
|
@ -124,7 +118,7 @@ add_task(async function test_empty_third_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // third
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("USER", "PASS");
|
||||
checkACForm(uname, "USER", pword, "PASS");
|
||||
});
|
||||
|
||||
add_task(async function test_preserve_matching_username_case() {
|
||||
|
@ -138,7 +132,7 @@ add_task(async function test_preserve_matching_username_case() {
|
|||
// (even with no autocomplete entry selected)
|
||||
synthesizeKey("KEY_Tab");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("user", "PASS");
|
||||
checkACForm(uname, "user", pword, "PASS");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -118,13 +118,6 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
var formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
function sendFakeAutocompleteEvent(element) {
|
||||
var acEvent = document.createEvent("HTMLEvents");
|
||||
acEvent.initEvent("DOMAutoComplete", true, false);
|
||||
|
@ -144,7 +137,7 @@ add_task(async function test_form1_initial_empty() {
|
|||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -168,10 +161,10 @@ add_task(async function test_form1_warning_entry() {
|
|||
checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
|
||||
|
||||
synthesizeKey("KEY_ArrowDown"); // select insecure warning
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
synthesizeKey("KEY_Enter");
|
||||
await spinEventLoop(); // let focus happen
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_entry() {
|
||||
|
@ -187,10 +180,10 @@ add_task(async function test_form1_first_entry() {
|
|||
|
||||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_second_entry() {
|
||||
|
@ -205,7 +198,7 @@ add_task(async function test_form1_second_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // second
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_third_entry() {
|
||||
|
@ -221,7 +214,7 @@ add_task(async function test_form1_third_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // third
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser3", "testpass3");
|
||||
checkACForm(uname, "testuser3", pword, "testpass3");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fourth_entry() {
|
||||
|
@ -238,7 +231,7 @@ add_task(async function test_form1_fourth_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // fourth
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_first_entry() {
|
||||
|
@ -260,7 +253,7 @@ add_task(async function test_form1_wraparound_first_entry() {
|
|||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_up_last_entry() {
|
||||
|
@ -274,7 +267,7 @@ add_task(async function test_form1_wraparound_up_last_entry() {
|
|||
synthesizeKey("KEY_ArrowUp"); // last (fourth)
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_down_up_up() {
|
||||
|
@ -290,7 +283,7 @@ add_task(async function test_form1_wraparound_down_up_up() {
|
|||
synthesizeKey("KEY_ArrowUp"); // select last entry
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_wraparound_up_last() {
|
||||
|
@ -312,7 +305,7 @@ add_task(async function test_form1_wraparound_up_last() {
|
|||
synthesizeKey("KEY_ArrowUp"); // last entry
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fill_username_without_autofill_right() {
|
||||
|
@ -326,7 +319,7 @@ add_task(async function test_form1_fill_username_without_autofill_right() {
|
|||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_ArrowRight");
|
||||
await spinEventLoop();
|
||||
checkACForm("tempuser1", ""); // empty password
|
||||
checkACForm(uname, "tempuser1", pword, ""); // empty password
|
||||
});
|
||||
|
||||
add_task(async function test_form1_fill_username_without_autofill_left() {
|
||||
|
@ -339,7 +332,7 @@ add_task(async function test_form1_fill_username_without_autofill_left() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_ArrowDown"); // first
|
||||
synthesizeKey("KEY_ArrowLeft");
|
||||
checkACForm("tempuser1", ""); // empty password
|
||||
checkACForm(uname, "tempuser1", pword, ""); // empty password
|
||||
});
|
||||
|
||||
add_task(async function test_form1_pageup_first() {
|
||||
|
@ -355,7 +348,7 @@ add_task(async function test_form1_pageup_first() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("tempuser1", "temppass1");
|
||||
checkACForm(uname, "tempuser1", pword, "temppass1");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_pagedown_last() {
|
||||
|
@ -371,7 +364,7 @@ add_task(async function test_form1_pagedown_last() {
|
|||
synthesizeKey("KEY_ArrowUp"); // skip footer
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_untrusted_event() {
|
||||
|
@ -379,11 +372,11 @@ add_task(async function test_form1_untrusted_event() {
|
|||
await spinEventLoop();
|
||||
|
||||
// Send a fake (untrusted) event.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
uname.value = "zzzuser4";
|
||||
sendFakeAutocompleteEvent(uname);
|
||||
await spinEventLoop();
|
||||
checkACForm("zzzuser4", "");
|
||||
checkACForm(uname, "zzzuser4", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete() {
|
||||
|
@ -411,13 +404,13 @@ add_task(async function test_form1_delete() {
|
|||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await deletionPromise;
|
||||
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
|
||||
is(numLogins, 4, "Correct number of logins after deleting one");
|
||||
await countChangedPromise;
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_deletion() {
|
||||
|
@ -431,7 +424,7 @@ add_task(async function test_form1_first_after_deletion() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete_second() {
|
||||
|
@ -447,12 +440,12 @@ add_task(async function test_form1_delete_second() {
|
|||
let storageChanged = promiseStorageChanged(["removeLogin"]);
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await storageChanged;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
|
||||
is(numLogins, 3, "Correct number of logins after deleting one");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("zzzuser4", "zzzpass4");
|
||||
checkACForm(uname, "zzzuser4", pword, "zzzpass4");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_deletion2() {
|
||||
|
@ -466,7 +459,7 @@ add_task(async function test_form1_first_after_deletion2() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_delete_last() {
|
||||
|
@ -483,14 +476,14 @@ add_task(async function test_form1_delete_last() {
|
|||
let storageChanged = promiseStorageChanged(["removeLogin"]);
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
await storageChanged;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
|
||||
is(numLogins, 2, "Correct number of logins after deleting one");
|
||||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_first_after_3_deletions() {
|
||||
|
@ -504,7 +497,7 @@ add_task(async function test_form1_first_after_3_deletions() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser2", "testpass2");
|
||||
checkACForm(uname, "testuser2", pword, "testpass2");
|
||||
});
|
||||
|
||||
add_task(async function test_form1_check_only_entry_remaining() {
|
||||
|
@ -519,7 +512,7 @@ add_task(async function test_form1_check_only_entry_remaining() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
let storageChanged = promiseStorageChanged(["removeLogin", "removeLogin"]);
|
||||
synthesizeKey("KEY_Delete", {shiftKey: true});
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
|
||||
is(numLogins, 1, "Correct number of logins after deleting one");
|
||||
|
||||
|
@ -544,7 +537,7 @@ add_task(async function test_form2() {
|
|||
// Turn our attention to form2
|
||||
uname = $_(2, "uname");
|
||||
pword = $_(2, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
|
@ -554,10 +547,10 @@ add_task(async function test_form2() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form3() {
|
||||
|
@ -570,7 +563,7 @@ add_task(async function test_form3() {
|
|||
|
||||
uname = $_(3, "uname");
|
||||
pword = $_(3, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -579,10 +572,10 @@ add_task(async function test_form3() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form4() {
|
||||
|
@ -595,7 +588,7 @@ add_task(async function test_form4() {
|
|||
|
||||
uname = $_(4, "uname");
|
||||
pword = $_(4, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -604,10 +597,10 @@ add_task(async function test_form4() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form5() {
|
||||
|
@ -620,7 +613,7 @@ add_task(async function test_form5() {
|
|||
|
||||
uname = $_(5, "uname");
|
||||
pword = $_(5, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
restoreForm();
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
|
@ -629,10 +622,10 @@ add_task(async function test_form5() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form6() {
|
||||
|
@ -648,7 +641,7 @@ add_task(async function test_form6() {
|
|||
// that was being suppressed would have been filled in otherwise)
|
||||
uname = $_(6, "uname");
|
||||
pword = $_(6, "pword");
|
||||
checkACForm("singleuser5", "singlepass5");
|
||||
checkACForm(uname, "singleuser5", pword, "singlepass5");
|
||||
});
|
||||
|
||||
add_task(async function test_form6_changeUsername() {
|
||||
|
@ -660,7 +653,7 @@ add_task(async function test_form6_changeUsername() {
|
|||
// Trigger the 'blur' event on uname
|
||||
pword.focus();
|
||||
await spinEventLoop();
|
||||
checkACForm("singleuser5X", "singlepass5");
|
||||
checkACForm(uname, "singleuser5X", pword, "singlepass5");
|
||||
uname.focus();
|
||||
|
||||
let storageChanged = promiseStorageChanged(["removeLogin"]);
|
||||
|
@ -683,7 +676,7 @@ add_task(async function test_form7() {
|
|||
|
||||
uname = $_(7, "uname");
|
||||
pword = $_(7, "pword");
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
|
||||
// Insert a new username field into the form. We'll then make sure
|
||||
// that invoking the autocomplete doesn't try to fill the form.
|
||||
|
@ -710,13 +703,13 @@ add_task(async function test_form7_2() {
|
|||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
// Check first entry
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
// The form changes, so we expect the old username field to get the
|
||||
// selected autocomplete value, but neither the new username field nor
|
||||
// the password field should have any values filled in.
|
||||
await spinEventLoop();
|
||||
checkACForm("form7user1", "");
|
||||
checkACForm(uname, "form7user1", pword, "");
|
||||
is($_(7, "uname2").value, "", "Verifying empty uname2");
|
||||
restoreForm(); // clear field, so reloading test doesn't fail
|
||||
|
||||
|
@ -746,23 +739,23 @@ add_task(async function test_form8() {
|
|||
|
||||
uname = $_(8, "uname");
|
||||
pword = $_(8, "pword");
|
||||
checkACForm("form8user", "form8pass");
|
||||
checkACForm(uname, "form8user", pword, "form8pass");
|
||||
restoreForm();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_blur() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
// Focus the previous form to trigger a blur.
|
||||
$_(7, "uname").focus();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_2() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
restoreForm();
|
||||
});
|
||||
|
||||
add_task(async function test_form8_3() {
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
|
||||
add_task(async function test_form9_filtering() {
|
||||
|
@ -798,14 +791,14 @@ add_task(async function test_form9_filtering() {
|
|||
"mochi.test",
|
||||
"Check dropdown is showing login with only one 'A'");
|
||||
|
||||
checkACForm("form9userAB", "");
|
||||
checkACForm(uname, "form9userAB", pword, "");
|
||||
uname.focus();
|
||||
synthesizeKey("KEY_ArrowLeft");
|
||||
shownPromise = promiseACShown();
|
||||
synthesizeKey("A", {shiftKey: true});
|
||||
results = await shownPromise;
|
||||
|
||||
checkACForm("form9userAAB", "");
|
||||
checkACForm(uname, "form9userAAB", pword, "");
|
||||
checkAutoCompleteResults(results,
|
||||
["This connection is not secure. Logins entered here could be compromised. Learn More", "form9userAAB"],
|
||||
"mochi.test",
|
||||
|
@ -814,7 +807,7 @@ add_task(async function test_form9_filtering() {
|
|||
synthesizeKey("KEY_ArrowDown");
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("form9userAAB", "form9pass");
|
||||
checkACForm(uname, "form9userAAB", pword, "form9pass");
|
||||
});
|
||||
|
||||
add_task(async function test_form9_autocomplete_cache() {
|
||||
|
@ -877,26 +870,26 @@ add_task(async function test_form11_recipes() {
|
|||
pword.type = "password";
|
||||
await promiseFormsProcessed();
|
||||
restoreForm();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_ArrowDown"); // open
|
||||
await shownPromise;
|
||||
|
||||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
synthesizeKey("KEY_Enter");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser10", "testpass10");
|
||||
checkACForm(uname, "testuser10", pword, "testpass10");
|
||||
|
||||
// Now test recipes with blur on the username field.
|
||||
restoreForm();
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
uname.value = "testuser10";
|
||||
checkACForm("testuser10", "");
|
||||
checkACForm(uname, "testuser10", pword, "");
|
||||
synthesizeKey("KEY_Tab");
|
||||
await promiseFormsProcessed();
|
||||
checkACForm("testuser10", "testpass10");
|
||||
checkACForm(uname, "testuser10", pword, "testpass10");
|
||||
await resetRecipes();
|
||||
});
|
||||
|
||||
|
@ -925,11 +918,11 @@ add_task(async function test_form12_formless() {
|
|||
checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
|
||||
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
|
||||
synthesizeKey("KEY_ArrowDown");
|
||||
checkACForm("", ""); // value shouldn't update
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update
|
||||
let processedPromise = promiseFormsProcessed();
|
||||
synthesizeKey("KEY_Enter");
|
||||
await processedPromise;
|
||||
checkACForm("testuser10", "testpass10");
|
||||
checkACForm(uname, "testuser10", pword, "testpass10");
|
||||
});
|
||||
|
||||
add_task(async function test_form13_stays_open_upon_empty_search() {
|
||||
|
@ -943,7 +936,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
|
||||
uname = $_(13, "uname");
|
||||
pword = $_(13, "pword");
|
||||
checkACForm("prefilled", "prefilled");
|
||||
checkACForm(uname, "prefilled", pword, "prefilled");
|
||||
|
||||
uname.scrollIntoView();
|
||||
let shownPromise = promiseACShown();
|
||||
|
@ -955,7 +948,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
await spinEventLoop();
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, true, "Check popup is still open");
|
||||
checkACForm("", "prefilled");
|
||||
checkACForm(uname, "", pword, "prefilled");
|
||||
|
||||
info("testing password field");
|
||||
synthesizeMouseAtCenter(pword, {});
|
||||
|
@ -965,7 +958,7 @@ add_task(async function test_form13_stays_open_upon_empty_search() {
|
|||
shownPromise = promiseACShown();
|
||||
synthesizeKey("KEY_Delete");
|
||||
await shownPromise;
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -53,13 +53,6 @@ function restoreForm() {
|
|||
uname.focus();
|
||||
}
|
||||
|
||||
// Check for expected username/password in form.
|
||||
function checkACForm(expectedUsername, expectedPassword) {
|
||||
let formID = uname.parentNode.id;
|
||||
is(uname.value, expectedUsername, "Checking " + formID + " username is: " + expectedUsername);
|
||||
is(pword.value, expectedPassword, "Checking " + formID + " password is: " + expectedPassword);
|
||||
}
|
||||
|
||||
function spinEventLoop() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -72,7 +65,7 @@ add_task(async function test_form1_initial_empty() {
|
|||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
// Make sure initial form is empty.
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
let popupState = await getPopupState();
|
||||
is(popupState.open, false, "Check popup is initially closed");
|
||||
});
|
||||
|
@ -90,10 +83,10 @@ add_task(async function test_form1_warning_entry() {
|
|||
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
|
||||
|
||||
synthesizeKey("KEY_ArrowDown"); // select insecure warning
|
||||
checkACForm("", ""); // value shouldn't update just by selecting
|
||||
checkACForm(uname, "", pword, ""); // value shouldn't update just by selecting
|
||||
synthesizeKey("KEY_Enter");
|
||||
await spinEventLoop(); // let focus happen
|
||||
checkACForm("", "");
|
||||
checkACForm(uname, "", pword, "");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче