зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1533166 - Move getSubmitMessage function into pwmgr_common.js to avoid duplication, r=jaws
Differential Revision: https://phabricator.services.mozilla.com/D30086 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8efbd9be96
Коммит
5e6b519d3b
|
@ -142,6 +142,26 @@ function checkUnmodifiedForm(formNum) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} [aFilterFn = undefined] Function to filter out irrelevant submissions.
|
||||
* @return {Promise} resolving when a relevant form submission was processed.
|
||||
*/
|
||||
function getSubmitMessage(aFilterFn = undefined) {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
if (aFilterFn && !aFilterFn(...args)) {
|
||||
// This submission isn't the one we're waiting for.
|
||||
return;
|
||||
}
|
||||
|
||||
info("got formSubmissionProcessed");
|
||||
PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function registerRunTests() {
|
||||
return new Promise(resolve => {
|
||||
function onDOMContentLoaded() {
|
||||
|
|
|
@ -129,17 +129,6 @@ const TESTCASES = [
|
|||
},
|
||||
];
|
||||
|
||||
function getSubmitMessage() {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test() {
|
||||
let count = 0;
|
||||
let loginFrame = document.getElementById("loginFrame");
|
||||
|
|
|
@ -138,26 +138,6 @@ const TESTCASES = [
|
|||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* @param {Function} [aFilterFn = undefined] Function to filter out irrelevant submissions.
|
||||
* @return {Promise} resolving when a relevant form submission was processed.
|
||||
*/
|
||||
function getSubmitMessage(aFilterFn = undefined) {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
if (aFilterFn && !aFilterFn(...args)) {
|
||||
// This submission isn't the one we're waiting for.
|
||||
return;
|
||||
}
|
||||
|
||||
info("got formSubmissionProcessed");
|
||||
PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function filterFormSubmissions(data) {
|
||||
return data.newPasswordField.value != "ignore-form-submission";
|
||||
}
|
||||
|
|
|
@ -129,20 +129,6 @@ const TESTCASES = [
|
|||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* @return {Promise} resolving when form submission was processed.
|
||||
*/
|
||||
function getSubmitMessage() {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_new_logins() {
|
||||
for (let tc of TESTCASES) {
|
||||
info("Starting testcase: " + JSON.stringify(tc));
|
||||
|
|
|
@ -12,17 +12,6 @@
|
|||
<script>
|
||||
let chromeScript = runChecksAfterCommonInit();
|
||||
|
||||
function getSubmitMessage() {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
chromeScript.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
chromeScript.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.requestFlakyTimeout("Giving a chance for the unexpected popupshown to occur");
|
||||
</script>
|
||||
<p id="display"></p>
|
||||
|
|
|
@ -12,17 +12,6 @@ Login Manager test: input value change right after onsubmit event
|
|||
|
||||
<script>
|
||||
let chromeScript = runChecksAfterCommonInit();
|
||||
|
||||
function getSubmitMessage() {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
chromeScript.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
chromeScript.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<p id="display"></p>
|
||||
|
||||
|
|
|
@ -77,19 +77,6 @@ const TESTCASES = [
|
|||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* @return {Promise} resolving when form submission was processed.
|
||||
*/
|
||||
function getSubmitMessage() {
|
||||
return new Promise((resolve, reject) => {
|
||||
PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_password_lengths() {
|
||||
for (let tc of TESTCASES) {
|
||||
info("Starting testcase: " + tc.testName + ", " + JSON.stringify([tc.pword1, tc.pword2]));
|
||||
|
|
Загрузка…
Ссылка в новой задаче