Backed out 2 changesets (bug 1147563) for perma-failures in test_insecure_form_field_autocomplete.html a=backout

Backed out changeset 53c71a1d9183 (bug 1147563)
Backed out changeset fef0ddcd6bba (bug 1147563)
This commit is contained in:
Noemi Erli 2019-03-28 06:52:07 +02:00
Родитель 84e3d0f067
Коммит 0f4ebab469
26 изменённых файлов: 252 добавлений и 588 удалений

Просмотреть файл

@ -272,7 +272,6 @@ var LoginHelper = {
*/
isOriginMatching(aLoginOrigin, aSearchOrigin, aOptions = {
schemeUpgrades: false,
acceptWildcardMatch: false,
}) {
if (aLoginOrigin == aSearchOrigin) {
return true;
@ -282,10 +281,6 @@ var LoginHelper = {
return false;
}
if (aOptions.acceptWildcardMatch && aLoginOrigin == "") {
return true;
}
if (aOptions.schemeUpgrades) {
try {
let loginURI = Services.io.newURI(aLoginOrigin);
@ -485,17 +480,12 @@ var LoginHelper = {
* String representing the origin to use for preferring one login over
* another when they are dupes. This is used with "scheme" for
* `resolveBy` so the scheme from this origin will be preferred.
* @param {string} [preferredFormActionOrigin = undefined]
* String representing the action origin to use for preferring one login over
* another when they are dupes. This is used with "actionOrigin" for
* `resolveBy` so the scheme from this action origin will be preferred.
*
* @returns {nsILoginInfo[]} list of unique logins.
*/
dedupeLogins(logins, uniqueKeys = ["username", "password"],
resolveBy = ["timeLastUsed"],
preferredOrigin = undefined,
preferredFormActionOrigin = undefined) {
preferredOrigin = undefined) {
const KEY_DELIMITER = ":";
if (!preferredOrigin && resolveBy.includes("scheme")) {
@ -540,16 +530,6 @@ var LoginHelper = {
for (let preference of resolveBy) {
switch (preference) {
case "actionOrigin": {
if (!preferredFormActionOrigin) {
break;
}
if (LoginHelper.isOriginMatching(existingLogin.formSubmitURL, preferredFormActionOrigin, {schemeUpgrades: LoginHelper.schemeUpgrades}) &&
!LoginHelper.isOriginMatching(login.formSubmitURL, preferredFormActionOrigin, {schemeUpgrades: LoginHelper.schemeUpgrades})) {
return false;
}
break;
}
case "scheme": {
if (!preferredOriginScheme) {
break;

Просмотреть файл

@ -1174,10 +1174,9 @@ var LoginManagerContent = {
*
* @param {LoginForm} form
* @param {nsILoginInfo[]} foundLogins an array of nsILoginInfo that could be
* used for the form, including ones with a different form action origin
* which are only used when the fill is userTriggered
used for the form
* @param {Set} recipes a set of recipes that could be used to affect how the
* form is filled
form is filled
* @param {Object} [options = {}] a list of options for this method
* @param {HTMLInputElement} [options.inputElement = null] an optional target
* input element we want to fill
@ -1225,9 +1224,8 @@ var LoginManagerContent = {
};
try {
// Nothing to do if we have no matching (excluding form action
// checks) logins available, and there isn't a need to show
// the insecure form warning.
// Nothing to do if we have no matching logins available,
// and there isn't a need to show the insecure form warning.
if (foundLogins.length == 0 &&
(InsecurePasswordUtils.isFormSecure(form) ||
!LoginHelper.showInsecureFieldWarning)) {
@ -1283,19 +1281,6 @@ var LoginManagerContent = {
usernameField.addEventListener("keydown", observer);
}
if (!userTriggered) {
// Only autofill logins that match the form's action. In the above code
// we have attached autocomplete for logins that don't match the form action.
foundLogins = foundLogins.filter(l => {
return LoginHelper.isOriginMatching(l.formSubmitURL,
LoginHelper.getFormActionOrigin(form),
{
schemeUpgrades: LoginHelper.schemeUpgrades,
acceptWildcardMatch: true,
});
});
}
// Nothing to do if we have no matching logins available.
// Only insecure pages reach this block and logs the same
// telemetry flag.

Просмотреть файл

@ -40,17 +40,14 @@ var LoginManagerParent = {
// to avoid spamming master password prompts on autocomplete searches.
_lastMPLoginCancelled: Math.NEGATIVE_INFINITY,
_searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch} = {}) {
_searchAndDedupeLogins(formOrigin, actionOrigin) {
let logins;
let matchData = {
hostname: formOrigin,
schemeUpgrades: LoginHelper.schemeUpgrades,
};
if (!looseActionOriginMatch) {
matchData.formSubmitURL = actionOrigin;
}
try {
logins = LoginHelper.searchLoginsWithObject(matchData);
logins = LoginHelper.searchLoginsWithObject({
hostname: formOrigin,
formSubmitURL: actionOrigin,
schemeUpgrades: LoginHelper.schemeUpgrades,
});
} catch (e) {
// Record the last time the user cancelled the MP prompt
// to avoid spamming them with MP prompts for autocomplete.
@ -64,11 +61,10 @@ var LoginManagerParent = {
// Dedupe so the length checks below still make sense with scheme upgrades.
let resolveBy = [
"actionOrigin",
"scheme",
"timePasswordChanged",
];
return LoginHelper.dedupeLogins(logins, ["username"], resolveBy, formOrigin, actionOrigin);
return LoginHelper.dedupeLogins(logins, ["username"], resolveBy, formOrigin);
},
// Listeners are added in BrowserGlue.jsm on desktop
@ -226,8 +222,7 @@ var LoginManagerParent = {
return;
}
// Autocomplete results do not need to match actionOrigin.
let logins = this._searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch: true});
let logins = this._searchAndDedupeLogins(formOrigin, actionOrigin);
log("sendLoginDataToChild:", logins.length, "deduped logins");
// Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
@ -275,8 +270,7 @@ var LoginManagerParent = {
} else {
log("Creating new autocomplete search result.");
// Autocomplete results do not need to match actionOrigin.
logins = this._searchAndDedupeLogins(formOrigin, actionOrigin, {looseActionOriginMatch: true});
logins = this._searchAndDedupeLogins(formOrigin, actionOrigin);
}
let matchingLogins = logins.filter(function(fullMatch) {

Просмотреть файл

@ -35,9 +35,6 @@ skip-if = toolkit == 'android' # autocomplete
[test_autofill_autocomplete_types.html]
scheme = https
skip-if = toolkit == 'android' # bug 1533965
[test_autofill_different_formSubmitURL.html]
scheme = https
skip-if = toolkit == 'android' # Bug 1259768
[test_autofill_from_bfcache.html]
scheme = https
skip-if = toolkit == 'android' # bug 1527403
@ -60,11 +57,7 @@ skip-if = toolkit == 'android' # autocomplete
[test_basic_form_2pw_2.html]
[test_basic_form_3pw_1.html]
[test_basic_form_autocomplete.html]
skip-if = toolkit == 'android' || (webrender && os == 'linux' && debug) # android:autocomplete, linux: bug 1538955
scheme = https
[test_basic_form_autocomplete_formSubmitURL.html]
skip-if = toolkit == 'android' # android:autocomplete.
scheme = https
[test_basic_form_honor_autocomplete_off.html]
scheme = https
skip-if = toolkit == 'android' # android:autocomplete.
@ -82,7 +75,6 @@ skip-if = toolkit == 'android' # Tests desktop prompts
[test_bug_776171.html]
[test_case_differences.html]
skip-if = toolkit == 'android' # autocomplete
scheme = https
[test_form_action_1.html]
[test_form_action_2.html]
[test_form_action_javascript.html]

Просмотреть файл

@ -134,7 +134,11 @@ function checkUnmodifiedForm(formNum) {
function registerRunTests() {
return new Promise(resolve => {
function onDOMContentLoaded() {
// We provide a general mechanism for our tests to know when they can
// safely run: we add a final form that we know will be filled in, wait
// for the login manager to tell us that it's filled in and then continue
// with the rest of the tests.
window.addEventListener("DOMContentLoaded", (event) => {
var form = document.createElement("form");
form.id = "observerforcer";
var username = document.createElement("input");
@ -161,18 +165,7 @@ function registerRunTests() {
SpecialPowers.addObserver(observer, "passwordmgr-processed-form");
document.body.appendChild(form);
}
// We provide a general mechanism for our tests to know when they can
// safely run: we add a final form that we know will be filled in, wait
// for the login manager to tell us that it's filled in and then continue
// with the rest of the tests.
if (document.readyState == "complete" ||
document.readyState == "loaded" ||
document.readyState == "interactive") {
onDOMContentLoaded();
} else {
window.addEventListener("DOMContentLoaded", onDOMContentLoaded);
}
});
});
}
@ -278,31 +271,6 @@ function runInParent(aFunctionOrURL) {
return chromeScript;
}
/*
* gTestDependsOnDeprecatedLogin Set this global to true if your test relies
* on the testuser/testpass login that is created in pwmgr_common.js. New tests
* should not rely on this login.
*/
var gTestDependsOnDeprecatedLogin = false;
/**
* Replace the content innerHTML with the provided form and wait for autofill to fill in the form.
*
* @param {string} form The form to be appended to the #content element.
* @param {string} fieldSelector The CSS selector for the field to-be-filled
* @param {string} fieldValue The value expected to be filled
* @param {string} formId The ID (excluding the # character) of the form
*/
function setFormAndWaitForFieldFilled(form, {fieldSelector, fieldValue, formId}) {
// eslint-disable-next-line no-unsanitized/property
document.querySelector("#content").innerHTML = form;
return SimpleTest.promiseWaitForCondition(() => {
let ancestor = formId ? document.querySelector("#" + formId) :
document.documentElement;
return ancestor.querySelector(fieldSelector).value == fieldValue;
}, "Wait for password manager to fill form");
}
/**
* Run commonInit synchronously in the parent then run the test function after the runTests event.
*
@ -314,7 +282,7 @@ function runChecksAfterCommonInit(aFunction = null) {
window.addEventListener("runTests", aFunction);
PWMGR_COMMON_PARENT.addMessageListener("registerRunTests", () => registerRunTests());
}
PWMGR_COMMON_PARENT.sendSyncMessage("setupParent", {testDependsOnDeprecatedLogin: gTestDependsOnDeprecatedLogin});
PWMGR_COMMON_PARENT.sendSyncMessage("setupParent");
return PWMGR_COMMON_PARENT;
}

Просмотреть файл

@ -21,7 +21,7 @@ var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
* the test can start checking filled-in values. Tests that check observer
* notifications might be confused by this.
*/
function commonInit(selfFilling, testDependsOnDeprecatedLogin) {
function commonInit(selfFilling) {
var pwmgr = Services.logins;
assert.ok(pwmgr != null, "Access LoginManager");
@ -36,18 +36,16 @@ function commonInit(selfFilling, testDependsOnDeprecatedLogin) {
}
}
if (testDependsOnDeprecatedLogin) {
// Add a login that's used in multiple tests
var login = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
login.init("http://mochi.test:8888", "http://mochi.test:8888", null,
"testuser", "testpass", "uname", "pword");
pwmgr.addLogin(login);
}
// Add a login that's used in multiple tests
var login = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
login.init("http://mochi.test:8888", "http://mochi.test:8888", null,
"testuser", "testpass", "uname", "pword");
pwmgr.addLogin(login);
// Last sanity check
logins = pwmgr.getAllLogins();
assert.equal(logins.length, testDependsOnDeprecatedLogin ? 1 : 0, "Checking for successful init login");
assert.equal(logins.length, 1, "Checking for successful init login");
disabledHosts = pwmgr.getAllDisabledHosts();
assert.equal(disabledHosts.length, 0, "Checking for no disabled hosts");
@ -106,8 +104,8 @@ Services.obs.addObserver(onPrompt, "passwordmgr-prompt-save");
// Begin message listeners
addMessageListener("setupParent", ({selfFilling = false, testDependsOnDeprecatedLogin = false} = {}) => {
commonInit(selfFilling, testDependsOnDeprecatedLogin);
addMessageListener("setupParent", ({selfFilling = false} = {selfFilling: false}) => {
commonInit(selfFilling);
sendAsyncMessage("doneSetup");
});

Просмотреть файл

@ -1,78 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test autofill on an HTTPS page using upgraded HTTP logins wtih different formSubmitURL</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/AddTask.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script>
const MISSING_ACTION_PATH = TESTS_DIR + "mochitest/form_basic.html";
const chromeScript = runChecksAfterCommonInit(false);
let nsLoginInfo = SpecialPowers.wrap(SpecialPowers.Components).Constructor("@mozilla.org/login-manager/loginInfo;1",
SpecialPowers.Ci.nsILoginInfo,
"init");
</script>
<p id="display"></p>
<!-- we presumably can't hide the content for this test. -->
<div id="content">
<iframe></iframe>
</div>
<pre id="test">
<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();
let dates = Date.now();
for (let login of logins) {
SpecialPowers.do_QueryInterface(login, SpecialPowers.Ci.nsILoginMetaInfo);
// Force all dates to be the same so they don't affect things like deduping.
login.timeCreated = login.timePasswordChanged = login.timeLastUsed = dates;
LoginManager.addLogin(login);
}
iframe.src = url;
await promiseFormsProcessed();
}
add_task(async function test_formSubmitURL_wildcard_should_autofill() {
await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
new nsLoginInfo("https://example.com", "", null,
"name2", "pass2", "uname", "pword"),
]);
checkACForm("name2", "pass2");
});
add_task(async function test_formSubmitURL_different_shouldnt_autofill() {
await prepareLoginsAndProcessForm("https://example.com" + MISSING_ACTION_PATH, [
new nsLoginInfo("https://example.com", "https://another.domain", null,
"name2", "pass2", "uname", "pword"),
]);
checkACForm("", "");
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -11,22 +11,11 @@
Login Manager test: simple form fill
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(startTest);
/** Test for Login Manager: form fill, multiple forms. **/
async function startTest() {
await setFormAndWaitForFieldFilled(`
<form id="form1" action="formtest.js">
<p>This is form 1.</p>
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "testuser"});
function startTest() {
is($_(1, "uname").value, "testuser", "Checking for filled username");
is($_(1, "pword").value, "testpass", "Checking for filled password");
@ -38,6 +27,14 @@ async function startTest() {
<div id="content" style="display: none">
<form id="form1" action="formtest.js">
<p>This is form 1.</p>
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
</div>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: forms with 1 password field
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: forms with 1 password field, part 2
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: forms with 2 password fields
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: forms with 3 password fields (form filling)
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -25,48 +25,45 @@ var setupScript = runInParent(function setup() {
assert.ok(nsLoginInfo != null, "nsLoginInfo constructor");
// login0 has no username, so should be filtered out from the autocomplete list.
var login0 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login0 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"", "user0pass", "", "pword");
var login1 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login1 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"tempuser1", "temppass1", "uname", "pword");
var login2 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login2 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"testuser2", "testpass2", "uname", "pword");
var login3 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login3 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"testuser3", "testpass3", "uname", "pword");
var login4 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login4 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"zzzuser4", "zzzpass4", "uname", "pword");
// The following unused variables are referenced by `eval` in the message listeners below.
// login 5 only used in the single-user forms
/* eslint-disable no-unused-vars */
var login5 = new nsLoginInfo("https://example.com", "https://autocomplete2", null,
var login5 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete2", null,
"singleuser5", "singlepass5", "uname", "pword");
var login6A = new nsLoginInfo("https://example.com", "https://autocomplete3", null,
var login6A = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete3", null,
"form7user1", "form7pass1", "uname", "pword");
var login6B = new nsLoginInfo("https://example.com", "https://autocomplete3", null,
var login6B = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete3", null,
"form7user2", "form7pass2", "uname", "pword");
var login7 = new nsLoginInfo("https://example.com", "https://autocomplete4", null,
var login7 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete4", null,
"form8user", "form8pass", "uname", "pword");
var login8A = new nsLoginInfo("https://example.com", "https://autocomplete5", null,
var login8A = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null,
"form9userAB", "form9pass", "uname", "pword");
var login8B = new nsLoginInfo("https://example.com", "https://autocomplete5", null,
var login8B = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null,
"form9userAAB", "form9pass", "uname", "pword");
var login8C = new nsLoginInfo("https://example.com", "https://autocomplete5", null,
// Reference by `eval` in the message listeners below.
// eslint-disable-next-line no-unused-vars
var login8C = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete5", null,
"form9userAABzz", "form9pass", "uname", "pword");
var login10 = new nsLoginInfo("https://example.com", "https://autocomplete7", null,
var login10 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete7", null,
"testuser10", "testpass10", "uname", "pword");
var login11 = new nsLoginInfo("https://example.com", "https://example.com", null,
"testuser11", "testpass11", "uname", "pword");
/* eslint-enable no-unused-vars */
// try/catch in case someone runs the tests manually, twice.
try {
@ -75,6 +72,14 @@ var setupScript = runInParent(function setup() {
Services.logins.addLogin(login2);
Services.logins.addLogin(login3);
Services.logins.addLogin(login4);
Services.logins.addLogin(login5);
Services.logins.addLogin(login6A);
Services.logins.addLogin(login6B);
Services.logins.addLogin(login7);
Services.logins.addLogin(login8A);
Services.logins.addLogin(login8B);
// login8C is added later
Services.logins.addLogin(login10);
} catch (e) {
assert.ok(false, "addLogin threw: " + e);
}
@ -99,13 +104,85 @@ var setupScript = runInParent(function setup() {
<div id="content">
<!-- form1 tests multiple matching logins -->
<!-- other forms test single logins, with autocomplete=off set -->
<form id="form1" action="https://autocomplete:8888/formtest.js" onsubmit="return false;">
<form id="form1" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- other forms test single logins, with autocomplete=off set -->
<form id="form2" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>
<form id="form3" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<form id="form4" action="http://autocomplete2" onsubmit="return false;" autocomplete="off">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<form id="form5" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>
<!-- control -->
<form id="form6" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="http://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test for no autofill after onblur with blank username -->
<form id="form8" action="http://autocomplete4" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test autocomplete dropdown -->
<form id="form9" action="http://autocomplete5" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- tests <form>-less autocomplete -->
<div id="form11">
<input type="text" name="uname" id="uname">
<input type="password" name="pword" id="pword">
<button type="submit">Submit</button>
</div>
<!-- test for onUsernameInput recipe testing -->
<form id="form12" action="http://autocomplete7" onsubmit="return false;">
<input type="text" name="1">
<input type="text" name="2">
<button type="submit">Submit</button>
</form>
<!-- test not closing when the search string (.value) becomes empty -->
<form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname" value="prefilled">
<input type="password" name="pword" value="prefilled">
<button type="submit">Submit</button>
</form>
</div>
<pre id="test">
@ -168,7 +245,7 @@ add_task(async function test_form1_menuitems() {
"testuser2",
"testuser3",
"zzzuser4"];
checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
checkAutoCompleteResults(results, expectedMenuItems, "mochi.test", "Check all menuitems are displayed correctly.");
checkACForm("", ""); // value shouldn't update just by selecting
synthesizeKey("KEY_Enter");
@ -391,7 +468,7 @@ add_task(async function test_form1_delete() {
// Delete the first entry (of 4), "tempuser1"
synthesizeKey("KEY_ArrowDown");
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 5, "Correct number of logins before deleting one");
let countChangedPromise = notifyMenuChanged(4);
@ -402,7 +479,7 @@ add_task(async function test_form1_delete() {
await deletionPromise;
checkACForm("", "");
numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 4, "Correct number of logins after deleting one");
await countChangedPromise;
synthesizeKey("KEY_Enter");
@ -434,7 +511,7 @@ add_task(async function test_form1_delete_second() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 3, "Correct number of logins after deleting one");
synthesizeKey("KEY_Enter");
await promiseFormsProcessed();
@ -466,7 +543,7 @@ add_task(async function test_form1_delete_last() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 2, "Correct number of logins after deleting one");
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Enter");
@ -498,27 +575,15 @@ add_task(async function test_form1_check_only_entry_remaining() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("https://example.com", "https://autocomplete:8888", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 1, "Correct number of logins after deleting one");
// remove the logins for the previous tests
// remove the login that's not shown in the list.
setupScript.sendSyncMessage("removeLogin", "login0");
setupScript.sendSyncMessage("removeLogin", "login1");
setupScript.sendSyncMessage("removeLogin", "login2");
setupScript.sendSyncMessage("removeLogin", "login3");
setupScript.sendSyncMessage("removeLogin", "login4");
setupScript.sendSyncMessage("addLogin", "login5");
});
/* Tests for single-user forms for ignoring autocomplete=off */
add_task(async function test_form2() {
await setFormAndWaitForFieldFilled(`
<form id="form2" action="https://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
// Turn our attention to form2
uname = $_(2, "uname");
pword = $_(2, "pword");
@ -538,13 +603,6 @@ add_task(async function test_form2() {
});
add_task(async function test_form3() {
await setFormAndWaitForFieldFilled(`
<form id="form3" action="https://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(3, "uname");
pword = $_(3, "pword");
checkACForm("singleuser5", "singlepass5");
@ -562,13 +620,6 @@ add_task(async function test_form3() {
});
add_task(async function test_form4() {
await setFormAndWaitForFieldFilled(`
<form id="form4" action="https://autocomplete2" onsubmit="return false;" autocomplete="off">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(4, "uname");
pword = $_(4, "pword");
checkACForm("singleuser5", "singlepass5");
@ -586,13 +637,6 @@ add_task(async function test_form4() {
});
add_task(async function test_form5() {
await setFormAndWaitForFieldFilled(`
<form id="form5" action="https://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(5, "uname");
pword = $_(5, "pword");
checkACForm("singleuser5", "singlepass5");
@ -610,14 +654,6 @@ add_task(async function test_form5() {
});
add_task(async function test_form6() {
await setFormAndWaitForFieldFilled(`
<!-- control -->
<form id="form6" action="https://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
// (this is a control, w/o autocomplete=off, to ensure the login
// that was being suppressed would have been filled in otherwise)
uname = $_(6, "uname");
@ -635,22 +671,11 @@ add_task(async function test_form6_changeUsername() {
pword.focus();
await spinEventLoop();
checkACForm("singleuser5X", "singlepass5");
uname.focus();
setupScript.sendSyncMessage("removeLogin", "login5");
});
add_task(async function test_form7() {
setupScript.sendSyncMessage("addLogin", "login6A");
setupScript.sendSyncMessage("addLogin", "login6B");
await setFormAndWaitForFieldFilled(`
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="https://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
uname = $_(7, "uname");
pword = $_(7, "pword");
checkACForm("", "");
@ -691,21 +716,6 @@ add_task(async function test_form7_2() {
});
add_task(async function test_form8() {
setupScript.sendSyncMessage("addLogin", "login7");
await setFormAndWaitForFieldFilled(`
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="https://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test for no autofill after onblur with blank username -->
<form id="form8" action="https://autocomplete4" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "form8user", formId: "form8"});
uname = $_(8, "uname");
pword = $_(8, "pword");
checkACForm("form8user", "form8pass");
@ -726,19 +736,9 @@ add_task(async function test_form8_2() {
add_task(async function test_form8_3() {
checkACForm("", "");
setupScript.sendSyncMessage("removeLogin", "login7");
setupScript.sendSyncMessage("addLogin", "login8A");
setupScript.sendSyncMessage("addLogin", "login8B");
});
add_task(async function test_form9_filtering() {
await setFormAndWaitForFieldFilled(`
<!-- test autocomplete dropdown -->
<form id="form9" action="https://autocomplete5" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
// Turn our attention to form9 to test the dropdown - bug 497541
uname = $_(9, "uname");
pword = $_(9, "pword");
@ -755,7 +755,7 @@ add_task(async function test_form9_filtering() {
let results = await shownPromise;
checkACForm("form9userAAB", "");
checkAutoCompleteResults(results, ["form9userAAB"], "example.com", "Check dropdown is updated after inserting 'A'");
checkAutoCompleteResults(results, ["form9userAAB"], "mochi.test", "Check dropdown is updated after inserting 'A'");
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Enter");
await promiseFormsProcessed();
@ -771,28 +771,16 @@ add_task(async function test_form9_autocomplete_cache() {
let promise1 = notifyMenuChanged(1);
sendString("z");
let results = await promise1;
checkAutoCompleteResults(results, [], "example.com", "Check popup does not have any login items");
checkAutoCompleteResults(results, [], "mochi.test", "Check popup does not have any login items");
// check that empty results are cached - bug 496466
promise1 = notifyMenuChanged(1);
sendString("z");
results = await promise1;
checkAutoCompleteResults(results, [], "example.com", "Check popup only has the footer when it opens");
checkAutoCompleteResults(results, [], "mochi.test", "Check popup only has the footer when it opens");
});
add_task(async function test_form11_formless() {
setupScript.sendSyncMessage("removeLogin", "login8A");
setupScript.sendSyncMessage("removeLogin", "login8B");
setupScript.sendSyncMessage("removeLogin", "login8C");
setupScript.sendSyncMessage("addLogin", "login11");
await setFormAndWaitForFieldFilled(`
<!-- tests <form>-less autocomplete -->
<div id="form11">
<input type="text" name="uname" id="uname">
<input type="password" name="pword" id="pword">
<button type="submit">Submit</button>
</div>`, {fieldSelector: `input[name="uname"]`, fieldValue: "testuser11"});
// Test form-less autocomplete
uname = $_(11, "uname");
pword = $_(11, "pword");
@ -808,7 +796,7 @@ add_task(async function test_form11_formless() {
let processedPromise = promiseFormsProcessed();
synthesizeKey("KEY_Enter");
await processedPromise;
checkACForm("testuser11", "testpass11");
checkACForm("testuser", "testpass");
});
add_task(async function test_form11_open_on_trusted_focus() {
@ -835,23 +823,13 @@ add_task(async function test_form11_open_on_trusted_focus() {
const processedPromise = promiseFormsProcessed();
synthesizeKey("KEY_Enter");
await processedPromise;
checkACForm("testuser11", "testpass11");
setupScript.sendSyncMessage("removeLogin", "login11");
checkACForm("testuser", "testpass");
});
add_task(async function test_form12_recipes() {
setupScript.sendSyncMessage("addLogin", "login10");
await setFormAndWaitForFieldFilled(`
<!-- test for onUsernameInput recipe testing -->
<form id="form12" action="https://autocomplete7" onsubmit="return false;">
<input type="text" name="1">
<input type="text" name="2">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="1"]`, fieldValue: ""});
await loadRecipes({
siteRecipes: [{
"hosts": ["example.com"],
"hosts": ["mochi.test:8888"],
"usernameSelector": "input[name='1']",
"passwordSelector": "input[name='2']",
}],
@ -888,14 +866,6 @@ add_task(async function test_form12_recipes() {
});
add_task(async function test_form13_stays_open_upon_empty_search() {
await setFormAndWaitForFieldFilled(`
<!-- test not closing when the search string (.value) becomes empty -->
<form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname" value="prefilled">
<input type="password" name="pword" value="prefilled">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "prefilled"});
uname = $_(13, "uname");
pword = $_(13, "pword");
checkACForm("prefilled", "prefilled");

Просмотреть файл

@ -1,112 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test that logins with non-matching formSubmitURL appear in autocomplete dropdown</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/AddTask.js"></script>
<script type="text/javascript" src="../../../satchel/test/satchel_common.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Login Manager test: logins with non-matching formSubmitURL appear in autocomplete dropdown
<script>
var chromeScript = runChecksAfterCommonInit();
runInParent(function setup() {
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Create some logins just for this form, since we'll be deleting them.
var nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo, "init");
assert.ok(nsLoginInfo != null, "nsLoginInfo constructor");
var login1 = new nsLoginInfo("https://example.com", "https://differentFormSubmitURL", null,
"dfsu1", "dfsp1", "uname", "pword");
Services.logins.addLogin(login1);
});
</script>
<p id="display"></p>
<!-- we presumably can't hide the content for this test. -->
<div id="content">
<!-- form1 tests multiple matching logins -->
<form id="form1" action="https://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: multiple login autocomplete. **/
var uname = $_(1, "uname");
var pword = $_(1, "pword");
// Restore the form to the default state.
function restoreForm() {
uname.value = "";
pword.value = "";
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();
}
add_task(async function setup() {
listenForUnexpectedPopupShown();
});
add_task(async function test_form1_initial_empty() {
await SimpleTest.promiseFocus(window);
// Make sure initial form is empty.
checkACForm("", "");
let popupState = await getPopupState();
is(popupState.open, false, "Check popup is initially closed");
});
/* For this testcase, the only login that exists for this origin
* is one with a different formSubmitURL, so the login will appear
* in the autocomplete popup.
*/
add_task(async function test_form1_menu_shows_logins_for_different_formSubmitURL() {
await SimpleTest.promiseFocus(window);
// Trigger autocomplete popup
restoreForm();
let shownPromise = promiseACShown();
synthesizeKey("KEY_ArrowDown"); // open
let results = await shownPromise;
let popupState = await getPopupState();
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
let expectedMenuItems = ["dfsu1"];
checkAutoCompleteResults(results, expectedMenuItems, "example.com", "Check all menuitems are displayed correctly.");
synthesizeKey("KEY_ArrowDown"); // first item
checkACForm("", ""); // value shouldn't update just by selecting
synthesizeKey("KEY_Enter");
await promiseFormsProcessed();
checkACForm("dfsu1", "dfsp1");
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -11,8 +11,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=355063
<script type="text/javascript" src="pwmgr_common.js"></script>
<script type="application/javascript">
/** Test for Bug 355063 **/
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(async function startTest() {
runChecksAfterCommonInit(function startTest() {
info("startTest");
// Password Manager's own listener should always have been added first, so
// the test's listener should be called after the pwmgr's listener fills in
@ -23,10 +23,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=355063
var passField = $("p1");
passField.addEventListener("input", checkForm);
});
await setFormAndWaitForFieldFilled("<form id=form1>form1: <input id=u1><input type=password id=p1></form><br>",
{fieldSelector: "#u1", fieldValue: "testuser"});
addForm();
});
function addForm() {
info("addForm");
var c = document.getElementById("content");
c.innerHTML = "<form id=form1>form1: <input id=u1><input type=password id=p1></form><br>";
}
function checkForm() {
info("checkForm");
var userField = document.getElementById("u1");

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: forms and logins without a username.
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
runInParent(() => {
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -23,13 +23,13 @@ SpecialPowers.loadChromeScript(function addLogins() {
var nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo, "init");
var login0 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login0 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"name", "pass", "uname", "pword");
var login1 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login1 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"Name", "Pass", "uname", "pword");
var login2 = new nsLoginInfo("https://example.com", "https://autocomplete:8888", null,
var login2 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"USER", "PASS", "uname", "pword");
try {
@ -47,7 +47,7 @@ SpecialPowers.loadChromeScript(function addLogins() {
<div id="content">
<!-- form1 tests multiple matching logins -->
<form id="form1" action="https://autocomplete:8888/formtest.js" onsubmit="return false;">
<form id="form1" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
@ -90,7 +90,7 @@ add_task(async function test_empty_first_entry() {
let results = await shownPromise;
popupState = await getPopupState();
is(popupState.selectedIndex, -1, "Check no entries are selected");
checkAutoCompleteResults(results, ["name", "Name", "USER"], "example.com", "initial");
checkAutoCompleteResults(results, ["name", "Name", "USER"], "mochi.test", "initial");
// Check first entry
let index0Promise = notifySelectedIndex(0);

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: Bug 360493
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: Bug 360493
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -13,7 +13,7 @@
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("loginFrame").addEventListener("load", (evt) => {
// Tell the parent to setup test logins.
PWMGR_COMMON_PARENT.sendAsyncMessage("setupParent", { selfFilling: true, testDependsOnDeprecatedLogin: true });
PWMGR_COMMON_PARENT.sendAsyncMessage("setupParent", { selfFilling: true });
});
});

Просмотреть файл

@ -11,7 +11,6 @@
Login Manager test: input events should fire.
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit();
SimpleTest.requestFlakyTimeout("untriaged");

Просмотреть файл

@ -40,7 +40,6 @@ var setupScript = runInParent(function setup() {
logins.login4 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete:8888", null,
"zzzuser4", "zzzpass4", "uname", "pword");
// The following logins are added later
// login 5 only used in the single-user forms
logins.login5 = new nsLoginInfo("http://mochi.test:8888", "http://autocomplete2", null,
"singleuser5", "singlepass5", "uname", "pword");
@ -71,6 +70,14 @@ var setupScript = runInParent(function setup() {
Services.logins.addLogin(logins.login2);
Services.logins.addLogin(logins.login3);
Services.logins.addLogin(logins.login4);
Services.logins.addLogin(logins.login5);
Services.logins.addLogin(logins.login6A);
Services.logins.addLogin(logins.login6B);
Services.logins.addLogin(logins.login7);
Services.logins.addLogin(logins.login8A);
Services.logins.addLogin(logins.login8B);
// login8C is added later
Services.logins.addLogin(logins.login10);
} catch (e) {
assert.ok(false, "addLogin threw: " + e);
}
@ -99,6 +106,79 @@ var setupScript = runInParent(function setup() {
<button type="submit">Submit</button>
</form>
<!-- other forms test single logins, with autocomplete=off set -->
<form id="form2" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>
<form id="form3" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<form id="form4" action="http://autocomplete2" onsubmit="return false;" autocomplete="off">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<form id="form5" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>
<!-- control -->
<form id="form6" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="http://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test for no autofill after onblur with blank username -->
<form id="form8" action="http://autocomplete4" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test autocomplete dropdown -->
<form id="form9" action="http://autocomplete5" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test for onUsernameInput recipe testing -->
<form id="form11" action="http://autocomplete7" onsubmit="return false;">
<input type="text" name="1">
<input type="text" name="2">
<button type="submit">Submit</button>
</form>
<!-- tests <form>-less autocomplete -->
<div id="form12">
<input type="text" name="uname" id="uname">
<input type="password" name="pword" id="pword">
<button type="submit">Submit</button>
</div>
<!-- test not closing when the search string (.value) becomes empty -->
<form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname" value="prefilled">
<input type="password" name="pword" value="prefilled">
<button type="submit">Submit</button>
</form>
</div>
<pre id="test">
@ -401,7 +481,7 @@ add_task(async function test_form1_delete() {
// Delete the first entry (of 4), "tempuser1"
synthesizeKey("KEY_ArrowDown");
var numLogins;
numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 5, "Correct number of logins before deleting one");
let countChangedPromise = notifyMenuChanged(5);
@ -412,7 +492,7 @@ add_task(async function test_form1_delete() {
await deletionPromise;
checkACForm("", "");
numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 4, "Correct number of logins after deleting one");
await countChangedPromise;
synthesizeKey("KEY_Enter");
@ -446,7 +526,7 @@ add_task(async function test_form1_delete_second() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 3, "Correct number of logins after deleting one");
synthesizeKey("KEY_Enter");
await promiseFormsProcessed();
@ -480,7 +560,7 @@ add_task(async function test_form1_delete_last() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 2, "Correct number of logins after deleting one");
synthesizeKey("KEY_ArrowDown"); // skip insecure warning
synthesizeKey("KEY_ArrowDown");
@ -515,7 +595,7 @@ add_task(async function test_form1_check_only_entry_remaining() {
synthesizeKey("KEY_ArrowDown");
synthesizeKey("KEY_Delete", {shiftKey: true});
checkACForm("", "");
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "", null);
let numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
is(numLogins, 1, "Correct number of logins after deleting one");
// remove the login that's not shown in the list.
@ -524,15 +604,6 @@ add_task(async function test_form1_check_only_entry_remaining() {
// Tests for single-user forms for ignoring autocomplete=off
add_task(async function test_form2() {
setupScript.sendSyncMessage("addLogin", "login5");
await setFormAndWaitForFieldFilled(`
<!-- other forms test single logins, with autocomplete=off set -->
<form id="form2" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
// Turn our attention to form2
uname = $_(2, "uname");
pword = $_(2, "pword");
@ -553,13 +624,6 @@ add_task(async function test_form2() {
});
add_task(async function test_form3() {
await setFormAndWaitForFieldFilled(`
<form id="form3" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(3, "uname");
pword = $_(3, "pword");
checkACForm("singleuser5", "singlepass5");
@ -578,13 +642,6 @@ add_task(async function test_form3() {
});
add_task(async function test_form4() {
await setFormAndWaitForFieldFilled(`
<form id="form4" action="http://autocomplete2" onsubmit="return false;" autocomplete="off">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(4, "uname");
pword = $_(4, "pword");
checkACForm("singleuser5", "singlepass5");
@ -603,13 +660,6 @@ add_task(async function test_form4() {
});
add_task(async function test_form5() {
await setFormAndWaitForFieldFilled(`
<form id="form5" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname" autocomplete="off">
<input type="password" name="pword" autocomplete="off">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
uname = $_(5, "uname");
pword = $_(5, "pword");
checkACForm("singleuser5", "singlepass5");
@ -628,14 +678,6 @@ add_task(async function test_form5() {
});
add_task(async function test_form6() {
await setFormAndWaitForFieldFilled(`
<!-- control -->
<form id="form6" action="http://autocomplete2" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "singleuser5"});
// (this is a control, w/o autocomplete=off, to ensure the login
// that was being suppressed would have been filled in otherwise)
uname = $_(6, "uname");
@ -653,22 +695,11 @@ add_task(async function test_form6_changeUsername() {
pword.focus();
await spinEventLoop();
checkACForm("singleuser5X", "singlepass5");
uname.focus();
setupScript.sendSyncMessage("removeLogin", "login5");
});
add_task(async function test_form7() {
setupScript.sendSyncMessage("addLogin", "login6A");
setupScript.sendSyncMessage("addLogin", "login6B");
await setFormAndWaitForFieldFilled(`
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="http://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
uname = $_(7, "uname");
pword = $_(7, "pword");
checkACForm("", "");
@ -710,22 +741,6 @@ add_task(async function test_form7_2() {
});
add_task(async function test_form8() {
setupScript.sendSyncMessage("addLogin", "login7");
await setFormAndWaitForFieldFilled(`
<!-- This form will be manipulated to insert a different username field. -->
<form id="form7" action="http://autocomplete3" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
<!-- test for no autofill after onblur with blank username -->
<form id="form8" action="http://autocomplete4" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
`, {fieldSelector: `#form8 input[name="uname"]`, fieldValue: "form8user"});
uname = $_(8, "uname");
pword = $_(8, "pword");
checkACForm("form8user", "form8pass");
@ -749,16 +764,6 @@ add_task(async function test_form8_3() {
});
add_task(async function test_form9_filtering() {
setupScript.sendSyncMessage("addLogin", "login8A");
setupScript.sendSyncMessage("addLogin", "login8B");
await setFormAndWaitForFieldFilled(`
<!-- test autocomplete dropdown -->
<form id="form9" action="http://autocomplete5" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
// Turn our attention to form9 to test the dropdown - bug 497541
uname = $_(9, "uname");
pword = $_(9, "pword");
@ -809,13 +814,9 @@ add_task(async function test_form9_autocomplete_cache() {
["This connection is not secure. Logins entered here could be compromised. Learn More"],
"mochi.test",
"Check popup only has the footer and insecure warning");
setupScript.sendSyncMessage("removeLogin", "login8A");
setupScript.sendSyncMessage("removeLogin", "login8B");
setupScript.sendSyncMessage("removeLogin", "login8C");
});
add_task(async function test_form11_recipes() {
setupScript.sendSyncMessage("addLogin", "login10");
await loadRecipes({
siteRecipes: [{
"hosts": ["mochi.test:8888"],
@ -823,14 +824,6 @@ add_task(async function test_form11_recipes() {
"passwordSelector": "input[name='2']",
}],
});
await setFormAndWaitForFieldFilled(`
<!-- test for onUsernameInput recipe testing -->
<form id="form11" action="http://autocomplete7" onsubmit="return false;">
<input type="text" name="1">
<input type="text" name="2">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="1"]`, fieldValue: ""});
uname = $_(11, "1");
pword = $_(11, "2");
@ -865,14 +858,6 @@ add_task(async function test_form11_recipes() {
add_task(async function test_form12_formless() {
// Test form-less autocomplete
await setFormAndWaitForFieldFilled(`
<!-- tests <form>-less autocomplete -->
<div id="form12">
<input type="text" name="uname" id="uname">
<input type="password" name="pword" id="pword">
<button type="submit">Submit</button>
</div>`, {fieldSelector: `input[name="uname"]`, fieldValue: ""});
uname = $_(12, "uname");
pword = $_(12, "pword");
restoreForm();
@ -888,18 +873,10 @@ add_task(async function test_form12_formless() {
let processedPromise = promiseFormsProcessed();
synthesizeKey("KEY_Enter");
await processedPromise;
checkACForm("testuser10", "testpass10");
checkACForm("testuser", "testpass");
});
add_task(async function test_form13_stays_open_upon_empty_search() {
await setFormAndWaitForFieldFilled(`
<!-- test not closing when the search string (.value) becomes empty -->
<form id="form13" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname" value="prefilled">
<input type="password" name="pword" value="prefilled">
<button type="submit">Submit</button>
</form>`, {fieldSelector: `input[name="uname"]`, fieldValue: "prefilled"});
uname = $_(13, "uname");
pword = $_(13, "pword");
checkACForm("prefilled", "prefilled");

Просмотреть файл

@ -29,7 +29,6 @@ isTabModal = false;
var exampleCom = "https://example.com/tests/toolkit/components/passwordmgr/test/mochitest/";
var exampleOrg = "https://example.org/tests/toolkit/components/passwordmgr/test/mochitest/";
gTestDependsOnDeprecatedLogin = true;
var chromeScript = runChecksAfterCommonInit();
runInParent(() => {

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: Bug 391514
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
<body>
Login Manager test: Bug 242956
<script>
gTestDependsOnDeprecatedLogin = true;
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

Просмотреть файл

@ -10,7 +10,6 @@
</head>
<body>
<script>
gTestDependsOnDeprecatedLogin = true;
var chromeScript = runChecksAfterCommonInit();
let fillPromiseResolvers = [];