From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../passwordmgr/test/mochitest/pwmgr_common.js | 25 ++++-------- .../test/mochitest/pwmgr_common_parent.js | 6 +-- .../mochitest/test_autofill_https_downgrade.html | 2 +- .../test/mochitest/test_bug_627616.html | 46 ++++++---------------- .../test_dismissed_doorhanger_in_shadow_DOM.html | 8 +--- .../test_formLike_rootElement_with_Shadow_DOM.html | 8 +--- .../test/mochitest/test_formless_autofill.html | 2 +- .../test_formless_submit_form_removal.html | 14 +++---- ...test_formless_submit_form_removal_negative.html | 4 +- .../mochitest/test_formless_submit_navigation.html | 6 +-- .../test_formless_submit_navigation_negative.html | 10 ++--- .../test/mochitest/test_munged_values.html | 8 ++-- .../mochitest/test_one_doorhanger_per_un_pw.html | 5 +-- .../test/mochitest/test_password_length.html | 12 ++---- .../test/mochitest/test_prompt_async.html | 6 +-- .../mochitest/test_prompt_promptAuth_proxy.html | 6 +-- .../test_submit_without_field_modifications.html | 8 +--- .../passwordmgr/test/mochitest/test_xhr.html | 2 +- 18 files changed, 56 insertions(+), 122 deletions(-) (limited to 'toolkit/components/passwordmgr/test/mochitest') diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js index 8b125897a5..1494c60bbd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js @@ -30,15 +30,6 @@ let authPromptModalType = SpecialPowers.Services.prefs.getIntPref( "prompts.modalType.httpAuth" ); -// Whether the auth prompt is a commonDialog.xhtml or a TabModalPrompt -let authPromptIsCommonDialog = - authPromptModalType === SpecialPowers.Services.prompt.MODAL_TYPE_WINDOW || - (authPromptModalType === SpecialPowers.Services.prompt.MODAL_TYPE_TAB && - SpecialPowers.Services.prefs.getBoolPref( - "prompts.tabChromePromptSubDialog", - false - )); - /** * Recreate a DOM tree using the outerHTML to ensure that any event listeners * and internal state for the elements are removed. @@ -145,7 +136,7 @@ function setUserInputValues(parentNode, selectorValues, userInput = true) { */ function getSubmitMessage(aFilterFn = undefined) { info("getSubmitMessage"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "formSubmissionProcessed", function processed(...args) { @@ -170,7 +161,7 @@ function getSubmitMessage(aFilterFn = undefined) { */ function getPasswordEditedMessage() { info("getPasswordEditedMessage"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "passwordEditedOrGenerated", function listener(...args) { @@ -643,8 +634,8 @@ function registerRunTests(existingPasswordFieldsCount = 0, callback) { let foundForcer = false; var observer = SpecialPowers.wrapCallback(function ( - subject, - topic, + _subject, + _topic, data ) { if (data === "observerforcer") { @@ -714,8 +705,8 @@ function logoutPrimaryPassword() { */ function promiseFormsProcessedInSameProcess(expectedCount = 1) { var processedCount = 0; - return new Promise((resolve, reject) => { - function onProcessedForm(subject, topic, data) { + return new Promise(resolve => { + function onProcessedForm(subject, _topic, data) { processedCount++; if (processedCount == expectedCount) { info(`${processedCount} form(s) processed`); @@ -1068,7 +1059,7 @@ SimpleTest.registerCleanupFunction(() => { this.LoginManager = new Proxy( {}, { - get(target, prop, receiver) { + get(_target, prop, _receiver) { return (...args) => { let loginInfoIndices = []; let cloneableArgs = args.map((val, index) => { @@ -1159,7 +1150,7 @@ async function formAutofillResult(formId) { delete gPwmgrCommonCapturedAutofillResults[formId]; return autofillResult; } - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "formProcessed", ({ formId: id, autofillResult }) => { diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js index 09ad80f467..e530fddf1c 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js @@ -109,8 +109,8 @@ function dumpLogin(label, login) { } addMessageListener("storageChanged", async function ({ expectedChangeTypes }) { - return new Promise((resolve, reject) => { - function storageChanged(subject, topic, data) { + return new Promise(resolve => { + function storageChanged(_subject, _topic, data) { let changeType = expectedChangeTypes.shift(); if (data != changeType) { resolve("Unexpected change type " + data + ", expected " + changeType); @@ -129,7 +129,7 @@ addMessageListener("storageChanged", async function ({ expectedChangeTypes }) { addMessageListener("promptShown", async function () { return new Promise(resolve => { - function promptShown(subject, topic, data) { + function promptShown(_subject, topic, _data) { Services.obs.removeObserver(promptShown, "passwordmgr-prompt-change"); Services.obs.removeObserver(promptShown, "passwordmgr-prompt-save"); resolve(topic); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html b/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html index 091f9c8ad6..5d74cef106 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html @@ -30,7 +30,7 @@ let nsLoginInfo = SpecialPowers.wrap(SpecialPowers.Components).Constructor("@moz let win = window.open("about:blank"); SimpleTest.registerCleanupFunction(() => win.close()); -async function prepareAndProcessForm(url, login) { +async function prepareAndProcessForm(url) { let processedPromise = promiseFormsProcessed(); win.location = url; info("prepareAndProcessForm, assigned window location: " + url); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html b/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html index 429ec2269c..50d94dfbae 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html @@ -56,7 +56,7 @@ function runNextTest() { is(gExpectedDialogs, 0, "received expected number of auth dialogs"); mm.sendAsyncMessage("prepareForNextTest"); - mm.addMessageListener("prepareForNextTestDone", function prepared(msg) { + mm.addMessageListener("prepareForNextTestDone", function prepared(_msg) { mm.removeMessageListener("prepareForNextTestDone", prepared); if (pendingTests.length) { ({expectedDialogs: gExpectedDialogs, @@ -92,7 +92,7 @@ const pps = parentCc["@mozilla.org/network/protocol-proxy-service;1"]. getService(parentCi.nsIProtocolProxyService); pps.asyncResolve(channel, 0, { - async onProxyAvailable(req, uri, pi, status) { + async onProxyAvailable(req, uri, pi, _status) { const mozproxy = "moz-proxy://" + pi.host + ":" + pi.port; const login1 = parentCc["@mozilla.org/login-manager/loginInfo;1"]. createInstance(parentCi.nsILoginInfo); @@ -110,54 +110,32 @@ QueryInterface: ChromeUtils.generateQI([parentCi.nsIProtocolProxyCallback]), }); - addMessageListener("prepareForNextTest", message => { + addMessageListener("prepareForNextTest", _message => { parentCc["@mozilla.org/network/http-auth-manager;1"]. getService(parentCi.nsIHttpAuthManager). clearAll(); sendAsyncMessage("prepareForNextTestDone"); }); - const modalType = Services.prefs.getIntPref( - "prompts.modalType.httpAuth" - ); - const authPromptIsCommonDialog = - modalType === Services.prompt.MODAL_TYPE_WINDOW - || (modalType === Services.prompt.MODAL_TYPE_TAB - && Services.prefs.getBoolPref( - "prompts.tabChromePromptSubDialog", - false - )); - - const dialogObserverTopic = authPromptIsCommonDialog - ? "common-dialog-loaded" : "tabmodal-dialog-loaded"; - - function dialogObserver(subj, topic, data) { - if (authPromptIsCommonDialog) { - subj.Dialog.ui.prompt.document - .getElementById("commonDialog") - .acceptDialog(); - } else { - const prompt = subj.ownerGlobal.gBrowser.selectedBrowser - .tabModalPromptBox.getPrompt(subj); - prompt.Dialog.ui.button0.click(); // Accept button - } + const dialogObserverTopic = "common-dialog-loaded"; + + function dialogObserver(subj, _topic, _data) { + subj.Dialog.ui.prompt.document + .getElementById("commonDialog") + .acceptDialog(); sendAsyncMessage("promptAccepted"); } Services.obs.addObserver(dialogObserver, dialogObserverTopic); - addMessageListener("cleanup", message => { + addMessageListener("cleanup", _message => { Services.obs.removeObserver(dialogObserver, dialogObserverTopic); sendAsyncMessage("cleanupDone"); }); }); - mm.addMessageListener("promptAccepted", msg => { - gExpectedDialogs--; - }); - mm.addMessageListener("setupDone", msg => { - runNextTest(); - }); + mm.addMessageListener("promptAccepted", _message => gExpectedDialogs--); + mm.addMessageListener("setupDone", _message => runNextTest()); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html index 87638b1132..5d014124a1 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html @@ -67,13 +67,7 @@ async function editPasswordFieldInShadowDOM() { async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html index 06458893ea..722a86efc9 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html @@ -94,13 +94,7 @@ const TESTCASES = [ async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html index 4d1b7582a9..05be33e4dd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html @@ -12,7 +12,7 @@ gTestDependsOnDeprecatedLogin = true; let doneSetupPromise = new Promise(resolve => { document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", async evt => { + document.getElementById("loginFrame").addEventListener("load", async _e => { // Tell the parent to setup test logins. await runChecksAfterCommonInit(); resolve(); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html index 5512c57db2..b2ff2d8845 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html @@ -10,10 +10,8 @@