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/LoginAutoComplete.sys.mjs | 2 +- toolkit/components/passwordmgr/LoginHelper.sys.mjs | 2 +- .../components/passwordmgr/LoginManager.shared.mjs | 2 +- .../components/passwordmgr/LoginManager.sys.mjs | 2 +- .../passwordmgr/LoginManagerAuthPrompter.sys.mjs | 6 +- .../passwordmgr/LoginManagerChild.sys.mjs | 48 +++--- .../passwordmgr/LoginManagerContextMenu.sys.mjs | 4 +- .../passwordmgr/LoginManagerPrompter.sys.mjs | 183 +++++++++++---------- toolkit/components/passwordmgr/nsILoginInfo.idl | 6 - .../passwordmgr/nsILoginManagerAuthPrompter.idl | 5 - .../passwordmgr/nsILoginManagerPrompter.idl | 5 - .../passwordmgr/storage-geckoview.sys.mjs | 14 +- .../passwordmgr/test/browser/browser.toml | 49 +++--- .../browser_autocomplete_primary_password.js | 2 +- .../test/browser/browser_basicAuth_rateLimit.js | 16 +- .../test/browser/browser_deleteLoginsBackup.js | 2 +- .../test/browser/browser_doorhanger_crossframe.js | 2 +- .../browser_doorhanger_generated_password.js | 4 +- .../test/browser/browser_doorhanger_remembering.js | 52 +++--- .../test/browser/browser_doorhanger_window_open.js | 4 +- .../test/browser/browser_entry_point_telemetry.js | 2 +- .../test/browser/browser_formless_submit_chrome.js | 10 +- .../test/browser/browser_message_onFormSubmit.js | 2 +- .../test/browser/browser_preselect_login.js | 2 +- .../test/browser/browser_proxyAuth_prompt.js | 8 +- .../test/browser/browser_relay_telemetry.js | 2 +- .../browser_username_only_form_telemetry.js | 14 +- .../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 +- ...ginManagerParent_onPasswordEditedOrGenerated.js | 11 +- .../passwordmgr/test/unit/test_logins_change.js | 2 +- 47 files changed, 279 insertions(+), 362 deletions(-) (limited to 'toolkit/components/passwordmgr') diff --git a/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs b/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs index 6ff96d999e..411d9249db 100644 --- a/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs +++ b/toolkit/components/passwordmgr/LoginAutoComplete.sys.mjs @@ -503,7 +503,7 @@ export class LoginAutoComplete { let searchStartTimeMS = Services.telemetry.msSystemNow(); // Show the insecure login warning in the passwords field on null principal documents. - // Avoid loading InsecurePasswordUtils.jsm in a sandboxed document (e.g. an ad. frame) if we + // Avoid loading InsecurePasswordUtils.sys.mjs in a sandboxed document (e.g. an ad. frame) if we // already know it has a null principal and will therefore get the insecure autocomplete // treatment. // InsecurePasswordUtils doesn't handle the null principal case as not secure because we don't diff --git a/toolkit/components/passwordmgr/LoginHelper.sys.mjs b/toolkit/components/passwordmgr/LoginHelper.sys.mjs index a63654c8f2..5626312f17 100644 --- a/toolkit/components/passwordmgr/LoginHelper.sys.mjs +++ b/toolkit/components/passwordmgr/LoginHelper.sys.mjs @@ -1371,7 +1371,7 @@ export const LoginHelper = { * @returns {boolean} True if any of the rules matches */ isInferredLoginForm(formElement) { - // This is copied from 'loginFormAttrRegex' in NewPasswordModel.jsm + // This is copied from 'loginFormAttrRegex' in NewPasswordModel.sys.mjs const loginExpr = /login|log in|log on|log-on|sign in|sigin|sign\/in|sign-in|sign on|sign-on/i; diff --git a/toolkit/components/passwordmgr/LoginManager.shared.mjs b/toolkit/components/passwordmgr/LoginManager.shared.mjs index d50c53cbad..b0122f7126 100644 --- a/toolkit/components/passwordmgr/LoginManager.shared.mjs +++ b/toolkit/components/passwordmgr/LoginManager.shared.mjs @@ -34,7 +34,7 @@ class Logic { /** * Test whether associated labels of the element have the keyword. - * This is a simplified rule of hasLabelMatchingRegex in NewPasswordModel.jsm + * This is a simplified rule of hasLabelMatchingRegex in NewPasswordModel.sys.mjs */ static hasLabelMatchingRegex(element, regex) { return regex.test(element.labels?.[0]?.textContent); diff --git a/toolkit/components/passwordmgr/LoginManager.sys.mjs b/toolkit/components/passwordmgr/LoginManager.sys.mjs index b95f3ada8b..538d7c63e1 100644 --- a/toolkit/components/passwordmgr/LoginManager.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManager.sys.mjs @@ -21,7 +21,7 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => { const MS_PER_DAY = 24 * 60 * 60 * 1000; if (Services.appinfo.processType !== Services.appinfo.PROCESS_TYPE_DEFAULT) { - throw new Error("LoginManager.jsm should only run in the parent process"); + throw new Error("LoginManager.sys.mjs should only run in the parent process"); } export function LoginManager() { diff --git a/toolkit/components/passwordmgr/LoginManagerAuthPrompter.sys.mjs b/toolkit/components/passwordmgr/LoginManagerAuthPrompter.sys.mjs index 8c39cf09b9..f56ec80d5e 100644 --- a/toolkit/components/passwordmgr/LoginManagerAuthPrompter.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerAuthPrompter.sys.mjs @@ -86,7 +86,7 @@ XPCOMUtils.defineLazyPreferenceGetter( /** * Implements nsIPromptFactory * - * Invoked by [toolkit/components/prompts/src/Prompter.jsm] + * Invoked by [toolkit/components/prompts/src/Prompter.sys.mjs] */ export function LoginManagerAuthPromptFactory() { Services.obs.addObserver(this, "passwordmgr-crypto-login", true); @@ -114,7 +114,7 @@ LoginManagerAuthPromptFactory.prototype = { _uiBusyPromise: null, _uiBusyResolve: null, - observe(subject, topic, data) { + observe(_subject, topic, _data) { this.log(`Observed topic: ${topic}.`); if (topic == "passwordmgr-crypto-login") { // Show the deferred prompters. @@ -795,7 +795,7 @@ LoginManagerAuthPrompter.prototype = { .then(ok => (result = ok)) .finally(() => (closed = true)); Services.tm.spinEventLoopUntilOrQuit( - "LoginManagerAuthPrompter.jsm:promptAuth", + "LoginManagerAuthPrompter.sys.mjs:promptAuth", () => closed ); return result; diff --git a/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs b/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs index 94be604d02..c89852b56c 100644 --- a/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerChild.sys.mjs @@ -16,10 +16,6 @@ const PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS = 1; const AUTOCOMPLETE_AFTER_RIGHT_CLICK_THRESHOLD_MS = 400; const AUTOFILL_STATE = "autofill"; -const SUBMIT_FORM_SUBMIT = 1; -const SUBMIT_PAGE_NAVIGATION = 2; -const SUBMIT_FORM_IS_REMOVED = 3; - const LOG_MESSAGE_FORM_SUBMISSION = "form submission"; const LOG_MESSAGE_FIELD_EDIT = "field edit"; @@ -53,6 +49,7 @@ ChromeUtils.defineESModuleGetters(lazy, { DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", FormLikeFactory: "resource://gre/modules/FormLikeFactory.sys.mjs", FormScenarios: "resource://gre/modules/FormScenarios.sys.mjs", + FORM_SUBMISSION_REASON: "resource://gre/actors/FormHandlerChild.sys.mjs", InsecurePasswordUtils: "resource://gre/modules/InsecurePasswordUtils.sys.mjs", LoginFormFactory: "resource://gre/modules/LoginFormFactory.sys.mjs", LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", @@ -117,7 +114,7 @@ const observer = { LoginManagerChild.forWindow(window)._onNavigation(window.document); }, - onStateChange(aWebProgress, aRequest, aState, aStatus) { + onStateChange(aWebProgress, aRequest, aState, _aStatus) { const window = aWebProgress.DOMWindow; const loginManagerChild = () => LoginManagerChild.forWindow(window); @@ -161,7 +158,7 @@ const observer = { }, // nsIObserver - observe(subject, topic, data) { + observe(subject, topic, _data) { switch (topic) { case "autocomplete-did-enter-text": { let input = subject.QueryInterface(Ci.nsIAutoCompleteInput); @@ -1602,10 +1599,6 @@ export class LoginManagerChild extends JSWindowActorChild { this.#onDOMDocFetchSuccess(event); break; } - case "DOMFormBeforeSubmit": { - this.#onDOMFormBeforeSubmit(event); - break; - } case "DOMFormHasPassword": { this.#onDOMFormHasPassword(event, this.document.defaultView); let formLike = lazy.LoginFormFactory.createFromForm( @@ -1631,6 +1624,14 @@ export class LoginManagerChild extends JSWindowActorChild { lazy.InsecurePasswordUtils.reportInsecurePasswords(formLike); break; } + case "form-submission-detected": { + if (lazy.LoginHelper.enabled) { + const form = event.detail.form; + const reason = event.detail.reason; + this.#onFormSubmission(form, reason); + } + break; + } } } @@ -1772,7 +1773,10 @@ export class LoginManagerChild extends JSWindowActorChild { } lazy.log("Form is removed."); - this._onFormSubmit(formLike, SUBMIT_FORM_IS_REMOVED); + this._onFormSubmit( + formLike, + lazy.FORM_SUBMISSION_REASON.FORM_REMOVAL_AFTER_FETCH + ); docState.formLikeByObservedNode.delete(event.target); let weakObserveredNodes = ChromeUtils.nondeterministicGetWeakMapKeys( @@ -1792,15 +1796,17 @@ export class LoginManagerChild extends JSWindowActorChild { } } - #onDOMFormBeforeSubmit(event) { - if (!event.isTrusted) { - return; - } - + /** + * Handle form-submission-detected event (dispatched by FormHandlerChild) + * + * @param {HTMLFormElement} form that is being submitted + * @param {String} reason form submission reason (heuristic that detected the form submission) + */ + #onFormSubmission(form, reason) { // We're invoked before the content's |submit| event handlers, so we // can grab form data before it might be modified (see bug 257781). - let formLike = lazy.LoginFormFactory.createFromForm(event.target); - this._onFormSubmit(formLike, SUBMIT_FORM_SUBMIT); + let formLike = lazy.LoginFormFactory.createFromForm(form); + this._onFormSubmit(formLike, reason); } onDocumentVisibilityChange(event) { @@ -2310,7 +2316,7 @@ export class LoginManagerChild extends JSWindowActorChild { } let formLike = lazy.LoginFormFactory.getForRootElement(formRoot); - this._onFormSubmit(formLike, SUBMIT_PAGE_NAVIGATION); + this._onFormSubmit(formLike, lazy.FORM_SUBMISSION_REASON.PAGE_NAVIGATION); } } @@ -2333,7 +2339,8 @@ export class LoginManagerChild extends JSWindowActorChild { isSubmission: true, // When this is trigger by inferring from form removal, the form is not // connected anymore, skip checking isConnected in this case. - ignoreConnect: reason == SUBMIT_FORM_IS_REMOVED, + ignoreConnect: + reason == lazy.FORM_SUBMISSION_REASON.FORM_REMOVAL_AFTER_FETCH, } ); } @@ -2452,7 +2459,6 @@ export class LoginManagerChild extends JSWindowActorChild { usernameField, newPasswordField, oldPasswordField, - confirmPasswordField, isSubmission, triggeredByFillingGenerated, } diff --git a/toolkit/components/passwordmgr/LoginManagerContextMenu.sys.mjs b/toolkit/components/passwordmgr/LoginManagerContextMenu.sys.mjs index fc87f5cf58..473594bafa 100644 --- a/toolkit/components/passwordmgr/LoginManagerContextMenu.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerContextMenu.sys.mjs @@ -55,7 +55,7 @@ export const LoginManagerContextMenu = { // login is bound so we can keep the reference to each object. item.addEventListener( "command", - function (login, event) { + function (login, _event) { this._fillTargetField( login, inputElementIdentifier, @@ -87,7 +87,7 @@ export const LoginManagerContextMenu = { /** * Show the password autocomplete UI with the generation option forced to appear. */ - async useGeneratedPassword(inputElementIdentifier, documentURI, browser) { + async useGeneratedPassword(inputElementIdentifier) { let browsingContextId = inputElementIdentifier.browsingContextId; let browsingContext = BrowsingContext.get(browsingContextId); let actor = browsingContext.currentWindowGlobal.getActor("LoginManager"); diff --git a/toolkit/components/passwordmgr/LoginManagerPrompter.sys.mjs b/toolkit/components/passwordmgr/LoginManagerPrompter.sys.mjs index 2637e8a52f..ddaef0728c 100644 --- a/toolkit/components/passwordmgr/LoginManagerPrompter.sys.mjs +++ b/toolkit/components/passwordmgr/LoginManagerPrompter.sys.mjs @@ -73,7 +73,7 @@ const observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), // nsIObserver - observe(subject, topic, data) { + observe(subject, topic, _data) { switch (topic) { case "autocomplete-did-enter-text": { const input = subject.QueryInterface(Ci.nsIAutoCompleteInput); @@ -636,103 +636,104 @@ export class LoginManagerPrompter { eventCallback(topic) { switch (topic) { case "showing": - lazy.log.debug("showing"); - currentNotification = this; - - // Record the first time this instance of the doorhanger is shown. - if (!this.timeShown) { - histogram.add(PROMPT_DISPLAYED); - Services.obs.notifyObservers( - null, - "weave:telemetry:histogram", - histogramName - ); - } - - chromeDoc - .getElementById("password-notification-password") - .removeAttribute("focused"); - chromeDoc - .getElementById("password-notification-username") - .removeAttribute("focused"); - chromeDoc - .getElementById("password-notification-username") - .addEventListener("input", onUsernameInput); - chromeDoc - .getElementById("password-notification-username") - .addEventListener("keyup", onKeyUp); - chromeDoc - .getElementById("password-notification-password") - .addEventListener("keyup", onKeyUp); - chromeDoc - .getElementById("password-notification-password") - .addEventListener("input", onPasswordInput); - chromeDoc - .getElementById("password-notification-username-dropmarker") - .addEventListener("click", togglePopup); - - LoginManagerPrompter._getUsernameSuggestions( - login, - possibleValues?.usernames - ).then(usernameSuggestions => { - const dropmarker = chromeDoc?.getElementById( - "password-notification-username-dropmarker" - ); - if (dropmarker) { - dropmarker.hidden = !usernameSuggestions.length; - } - - const usernameField = chromeDoc?.getElementById( - "password-notification-username" - ); - if (usernameField) { - usernameField.classList.toggle( - "ac-has-end-icon", - !!usernameSuggestions.length + { + lazy.log.debug("showing"); + currentNotification = this; + + // Record the first time this instance of the doorhanger is shown. + if (!this.timeShown) { + histogram.add(PROMPT_DISPLAYED); + Services.obs.notifyObservers( + null, + "weave:telemetry:histogram", + histogramName ); } - }); - const toggleBtn = chromeDoc.getElementById( - "password-notification-visibilityToggle" - ); + chromeDoc + .getElementById("password-notification-password") + .removeAttribute("focused"); + chromeDoc + .getElementById("password-notification-username") + .removeAttribute("focused"); + chromeDoc + .getElementById("password-notification-username") + .addEventListener("input", onUsernameInput); + chromeDoc + .getElementById("password-notification-username") + .addEventListener("keyup", onKeyUp); + chromeDoc + .getElementById("password-notification-password") + .addEventListener("keyup", onKeyUp); + chromeDoc + .getElementById("password-notification-password") + .addEventListener("input", onPasswordInput); + chromeDoc + .getElementById("password-notification-username-dropmarker") + .addEventListener("click", togglePopup); + + LoginManagerPrompter._getUsernameSuggestions( + login, + possibleValues?.usernames + ).then(usernameSuggestions => { + const dropmarker = chromeDoc?.getElementById( + "password-notification-username-dropmarker" + ); + if (dropmarker) { + dropmarker.hidden = !usernameSuggestions.length; + } - if ( - Services.prefs.getBoolPref( - "signon.rememberSignons.visibilityToggle" - ) - ) { - toggleBtn.addEventListener("command", onVisibilityToggle); - - toggleBtn.setAttribute("label", togglePassword.label); - toggleBtn.setAttribute("accesskey", togglePassword.accessKey); - - const hideToggle = - lazy.LoginHelper.isPrimaryPasswordSet() || - // Don't show the toggle when the login was autofilled - !!autoFilledLoginGuid || - // Dismissed-by-default prompts should still show the toggle. - (this.timeShown && this.wasDismissed) || - // If we are only adding a username then the password is - // one that is already saved and we don't want to reveal - // it as the submitter of this form may not be the account - // owner, they may just be using the saved password. - (messageStringID == - "password-manager-update-login-add-username" && - login.timePasswordChanged < - Date.now() - VISIBILITY_TOGGLE_MAX_PW_AGE_MS); - toggleBtn.hidden = hideToggle; - } + const usernameField = chromeDoc?.getElementById( + "password-notification-username" + ); + if (usernameField) { + usernameField.classList.toggle( + "ac-has-end-icon", + !!usernameSuggestions.length + ); + } + }); + + const toggleBtn = chromeDoc.getElementById( + "password-notification-visibilityToggle" + ); - let popup = chromeDoc.getElementById("PopupAutoComplete"); - popup.onUsernameSelect = onUsernameSelect; - popup.onPasswordSelect = onPasswordSelect; + if ( + Services.prefs.getBoolPref( + "signon.rememberSignons.visibilityToggle" + ) + ) { + toggleBtn.addEventListener("command", onVisibilityToggle); + + toggleBtn.setAttribute("label", togglePassword.label); + toggleBtn.setAttribute("accesskey", togglePassword.accessKey); + + const hideToggle = + lazy.LoginHelper.isPrimaryPasswordSet() || + // Don't show the toggle when the login was autofilled + !!autoFilledLoginGuid || + // Dismissed-by-default prompts should still show the toggle. + (this.timeShown && this.wasDismissed) || + // If we are only adding a username then the password is + // one that is already saved and we don't want to reveal + // it as the submitter of this form may not be the account + // owner, they may just be using the saved password. + (messageStringID == + "password-manager-update-login-add-username" && + login.timePasswordChanged < + Date.now() - VISIBILITY_TOGGLE_MAX_PW_AGE_MS); + toggleBtn.hidden = hideToggle; + } - LoginManagerPrompter._setUsernameAutocomplete( - login, - possibleValues?.usernames - ); + let popup = chromeDoc.getElementById("PopupAutoComplete"); + popup.onUsernameSelect = onUsernameSelect; + popup.onPasswordSelect = onPasswordSelect; + LoginManagerPrompter._setUsernameAutocomplete( + login, + possibleValues?.usernames + ); + } break; case "shown": { lazy.log.debug("shown"); diff --git a/toolkit/components/passwordmgr/nsILoginInfo.idl b/toolkit/components/passwordmgr/nsILoginInfo.idl index 93f4e2808d..d1e8526b27 100644 --- a/toolkit/components/passwordmgr/nsILoginInfo.idl +++ b/toolkit/components/passwordmgr/nsILoginInfo.idl @@ -152,9 +152,3 @@ interface nsILoginInfo : nsISupports { */ nsILoginInfo clone(); }; - -%{C++ - -#define NS_LOGININFO_CONTRACTID "@mozilla.org/login-manager/loginInfo;1" - -%} diff --git a/toolkit/components/passwordmgr/nsILoginManagerAuthPrompter.idl b/toolkit/components/passwordmgr/nsILoginManagerAuthPrompter.idl index 422981a0a3..e92cf4b5b5 100644 --- a/toolkit/components/passwordmgr/nsILoginManagerAuthPrompter.idl +++ b/toolkit/components/passwordmgr/nsILoginManagerAuthPrompter.idl @@ -37,8 +37,3 @@ interface nsILoginManagerAuthPrompter : nsISupports { */ attribute Element browser; }; -%{C++ - -#define NS_LOGINMANAGERAUTHPROMPTER_CONTRACTID "@mozilla.org/login-manager/authprompter/;1" - -%} diff --git a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl index 4f244258c0..9ebdd05e91 100644 --- a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl +++ b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl @@ -96,8 +96,3 @@ interface nsILoginManagerPrompter : nsISupports { in Array logins, in nsILoginInfo aNewLogin); }; -%{C++ - -#define NS_LOGINMANAGERPROMPTER_CONTRACTID "@mozilla.org/login-manager/prompter/;1" - -%} diff --git a/toolkit/components/passwordmgr/storage-geckoview.sys.mjs b/toolkit/components/passwordmgr/storage-geckoview.sys.mjs index db2ef6d61b..d68faa32e9 100644 --- a/toolkit/components/passwordmgr/storage-geckoview.sys.mjs +++ b/toolkit/components/passwordmgr/storage-geckoview.sys.mjs @@ -49,15 +49,15 @@ export class LoginManagerStorage extends LoginManagerStorage_json { */ terminate() {} - async addLoginsAsync(logins, continueOnDuplicates = false) { + async addLoginsAsync(_logins, _continueOnDuplicates = false) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } - removeLogin(login) { + removeLogin(_login) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } - modifyLogin(oldLogin, newLoginData) { + modifyLogin(_oldLogin, _newLoginData) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } @@ -180,7 +180,7 @@ export class LoginManagerStorage extends LoginManagerStorage_json { /** * Use `searchLoginsAsync` instead. */ - searchLogins(matchData) { + searchLogins(_matchData) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } @@ -191,7 +191,7 @@ export class LoginManagerStorage extends LoginManagerStorage_json { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } - countLogins(origin, formActionOrigin, httpRealm) { + countLogins(_origin, _formActionOrigin, _httpRealm) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } @@ -226,7 +226,7 @@ export class LoginManagerStorage extends LoginManagerStorage_json { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } - async setSyncID(syncID) { + async setSyncID(_syncID) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } @@ -234,7 +234,7 @@ export class LoginManagerStorage extends LoginManagerStorage_json { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } - async setLastSync(timestamp) { + async setLastSync(_timestamp) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); } } diff --git a/toolkit/components/passwordmgr/test/browser/browser.toml b/toolkit/components/passwordmgr/test/browser/browser.toml index 53066c92d4..77c107c6f3 100644 --- a/toolkit/components/passwordmgr/test/browser/browser.toml +++ b/toolkit/components/passwordmgr/test/browser/browser.toml @@ -36,8 +36,9 @@ support-files = [ ["browser_DOMInputPasswordAdded.js"] skip-if = [ - "os == 'linux'", # Bug 1337606 - "os == 'mac'", # Bug 1337606 + "os == 'linux' && os_version == '18.04'", # Bug 1337606 + "apple_catalina", # Bug 1337606 + "apple_silicon", # Bug 1337606 ] ["browser_autocomplete_autofocus_with_frame.js"] @@ -47,15 +48,17 @@ support-files = ["form_autofocus_frame.html"] support-files = ["form_disabled_readonly_passwordField.html"] ["browser_autocomplete_footer.js"] -skip-if = ["!debug && os == 'linux' && bits == 64 && os_version == '18.04'"] # Bug 1591126 +skip-if = ["os == 'linux' && os_version == '18.04' && bits == 64 && !debug"] # Bug 1591126 ["browser_autocomplete_generated_password_private_window.js"] ["browser_autocomplete_import.js"] https_first_disabled = true skip-if = [ - "os == 'mac'", # Bug 1775902 - "os == 'win' && !debug", # Bug 1775902 + "apple_catalina", # Bug 1775902 + "apple_silicon", # Bug 1775902 + "win10_2009 && !debug", # Bug 1775902 + "win11_2009 && !debug", # Bug 1775902 ] ["browser_autocomplete_insecure_warning.js"] @@ -64,8 +67,7 @@ skip-if = [ ["browser_autofill_hidden_document.js"] skip-if = [ - "os == 'win' && os_version == '10.0' && debug", # bug 1530935 - "apple_catalina && fission && !debug", # high frequency intermittent, Bug 1716486 + "apple_catalina && !debug", # high frequency intermittent, Bug 1716486 ] ["browser_autofill_http.js"] @@ -81,7 +83,10 @@ skip-if = ["os == 'android'"] ["browser_basicAuth_rateLimit.js"] ["browser_basicAuth_switchTab.js"] -skip-if = ["debug && os == 'mac'"] # Bug 1530566 +skip-if = [ + "apple_catalina && debug", # Bug 1530566 + "apple_silicon && debug", # Bug 1530566 +] ["browser_context_menu.js"] @@ -121,9 +126,10 @@ support-files = [ "form_password_change.html", ] skip-if = [ - "os == 'linux'", # Bug 1729196 + "os == 'linux' && os_version == '18.04'", # Bug 1729196 "win11_2009 && bits == 64", # Bug 1729196 - "os == 'mac' && debug", # Bug 1729196 + "apple_catalina && debug", # Bug 1729196 + "apple_silicon && debug", # Bug 1729196 ] ["browser_doorhanger_httpsUpgrade.js"] @@ -149,8 +155,8 @@ skip-if = ["a11y_checks"] # Bugs 1858041, 1854454 and 1824058 for causing interm fail-if = ["a11y_checks"] # Bug 1854452 clicked dropmaker may not be focusable skip-if = [ "tsan", # Bug 1661305 - "os == 'linux' && debug", # Bug 1658056 - "os == 'linux' && asan", # Bug 1695395 + "os == 'linux' && os_version == '18.04' && debug", # Bug 1658056 + "os == 'linux' && os_version == '18.04' && asan", # Bug 1695395 ] ["browser_doorhanger_target_blank.js"] @@ -165,7 +171,7 @@ support-files = [ "subtst_notifications_11.html", "subtst_notifications_11_popup.html", ] -skip-if = ["os == 'linux'"] # Bug 1312981, bug 1313136 +skip-if = ["os == 'linux' && os_version == '18.04'"] # Bug 1312981, bug 1313136 ["browser_entry_point_telemetry.js"] @@ -178,7 +184,7 @@ support-files = ["file_focus_before_DOMContentLoaded.sjs"] ["browser_form_history_fallback.js"] https_first_disabled = true # TODO remove that line and move test to HTTPS, see Bug 1776350 -skip-if = ["os == 'linux' && debug"] # Bug 1334336 +skip-if = ["os == 'linux' && os_version == '18.04' && debug"] # Bug 1334336 support-files = [ "subtst_notifications_1.html", "subtst_notifications_2.html", @@ -208,8 +214,9 @@ support-files = ["form_signup_detection.html"] ["browser_localip_frame.js"] skip-if = [ - "os == 'mac' && bits == 64", # Bug 1683848 - "os == 'linux' && !debug && bits == 64", # Bug 1683848 + "apple_catalina", # Bug 1683848 + "apple_silicon", # Bug 1683848 + "os == 'linux' && os_version == '18.04' && bits == 64 && !debug", # Bug 1683848 ] ["browser_message_onFormSubmit.js"] @@ -219,8 +226,11 @@ skip-if = [ ["browser_preselect_login.js"] fail-if = ["a11y_checks"] # Bug 1854452 clicked ac-secondary-action may not be labeled skip-if = [ - "os == 'linux' && (asan || tsan || debug)", # Bug 1840479 - "os == 'win' && (asan || debug)", # Bug 1840479 + "asan", + "tsan", + "os == 'linux' && os_version == '18.04' && debug", # Bug 1840479 + "win10_2009 && debug", # Bug 1840479 + "win11_2009 && debug", # Bug 1840479 ] ["browser_private_window.js"] @@ -229,8 +239,7 @@ support-files = [ "form_password_change.html", ] skip-if = [ - "os == 'linux' && bits == 64 && os_version == '18.04' && !debug", # Bug 1744976 - "os == 'win' && os_version == '10.0' && debug", # Bug 1782656 + "os == 'linux' && os_version == '18.04' && bits == 64 && !debug", # Bug 1744976 ] ["browser_proxyAuth_prompt.js"] diff --git a/toolkit/components/passwordmgr/test/browser/browser_autocomplete_primary_password.js b/toolkit/components/passwordmgr/test/browser/browser_autocomplete_primary_password.js index c3152740cd..8d6956a018 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_autocomplete_primary_password.js +++ b/toolkit/components/passwordmgr/test/browser/browser_autocomplete_primary_password.js @@ -105,7 +105,7 @@ add_task(async function test_mpAutocompleteUIBusy() { isProbablyANewPasswordField: true, }; - function dialogObserver(subject, topic, data) { + function dialogObserver(_subject, topic, _data) { Assert.ok(false, "A second dialog shouldn't have been shown"); Services.obs.removeObserver(dialogObserver, topic); } diff --git a/toolkit/components/passwordmgr/test/browser/browser_basicAuth_rateLimit.js b/toolkit/components/passwordmgr/test/browser/browser_basicAuth_rateLimit.js index 1c12a8fec5..b0a5b8b335 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_basicAuth_rateLimit.js +++ b/toolkit/components/passwordmgr/test/browser/browser_basicAuth_rateLimit.js @@ -85,13 +85,7 @@ add_task(async function test() { let iframe = doc.createElement("iframe"); doc.body.appendChild(iframe); let loaded = new Promise(resolve => { - iframe.addEventListener( - "load", - function (e) { - resolve(); - }, - { once: true } - ); + iframe.addEventListener("load", _e => resolve(), { once: true }); }); iframe.src = "https://example.com/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs"; @@ -113,13 +107,7 @@ add_task(async function test() { let iframe = doc.createElement("iframe"); doc.body.appendChild(iframe); let loaded = new Promise(resolve => { - iframe.addEventListener( - "load", - function (e) { - resolve(); - }, - { once: true } - ); + iframe.addEventListener("load", () => resolve(), { once: true }); }); iframe.src = "https://example.org/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs"; diff --git a/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js b/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js index a122f52845..db762ca118 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js +++ b/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js @@ -50,7 +50,7 @@ const loginBackupPath = PathUtils.join( async function waitForBackupUpdate() { return new Promise(resolve => { - Services.obs.addObserver(function observer(subject, topic) { + Services.obs.addObserver(function observer(_subject, _topic, _data) { Services.obs.removeObserver(observer, "logins-backup-updated"); resolve(); }, "logins-backup-updated"); diff --git a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_crossframe.js b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_crossframe.js index 8c4770d510..ca50715a1f 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_crossframe.js +++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_crossframe.js @@ -7,7 +7,7 @@ async function acceptPasswordSave() { let notif = await getCaptureDoorhangerThatMayOpen("password-save"); let promiseNewSavedPassword = TestUtils.topicObserved( "LoginStats:NewSavedPassword", - (subject, data) => subject == gBrowser.selectedBrowser + (subject, _topic, _data) => subject == gBrowser.selectedBrowser ); clickDoorhangerButton(notif, REMEMBER_BUTTON); await promiseNewSavedPassword; diff --git a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js index 3740dad1b9..798337ddda 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js +++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_generated_password.js @@ -901,8 +901,8 @@ add_task(async function contextmenu_fill_generated_password_and_set_username() { ); await SpecialPowers.spawn( browser, - [[passwordInputSelector, usernameInputSelector]], - function checkEmptyPasswordField([passwordSelector, usernameSelector]) { + [passwordInputSelector], + function checkEmptyPasswordField(passwordSelector) { Assert.equal( content.document.querySelector(passwordSelector).value, "", diff --git a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_remembering.js b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_remembering.js index 93a16c2e3c..c3fb7656de 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_remembering.js +++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_remembering.js @@ -68,7 +68,7 @@ add_setup(async function () { add_task(async function test_remember_opens() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -90,7 +90,7 @@ add_task(async function test_remember_opens() { add_task(async function test_clickNever() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -162,7 +162,7 @@ add_task(async function test_clickRemember() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -186,7 +186,7 @@ add_task(async function test_clickRemember() { await checkDoorhangerUsernamePassword("notifyu1", "notifyp1"); let promiseNewSavedPassword = TestUtils.topicObserved( "LoginStats:NewSavedPassword", - (subject, data) => subject == gBrowser.selectedBrowser + (subject, _topic, _data) => subject == gBrowser.selectedBrowser ); clickDoorhangerButton(notif, REMEMBER_BUTTON); await promiseNewSavedPassword; @@ -283,7 +283,7 @@ add_task(async function test_rememberSignonsTrue() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -317,7 +317,7 @@ add_task(async function test_autocompleteOffUsername() { await testSubmittingLoginFormHTTP( "subtst_notifications_2.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -349,7 +349,7 @@ add_task(async function test_autocompleteOffPassword() { await testSubmittingLoginFormHTTP( "subtst_notifications_3.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -379,7 +379,7 @@ add_task(async function test_autocompleteOffForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_4.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -434,7 +434,7 @@ add_task(async function test_pwOnlyNewLoginMatchesUPForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -501,7 +501,7 @@ add_task(async function test_pwOnlyOldLoginMatchesUPForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -588,7 +588,7 @@ add_task(async function test_pwOnlyFormDoesntMatchExisting() { await testSubmittingLoginFormHTTP( "subtst_notifications_6.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -618,7 +618,7 @@ add_task(async function test_changeUPLoginOnUPForm_dont() { await testSubmittingLoginFormHTTP( "subtst_notifications_8.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -704,7 +704,7 @@ add_task(async function test_changeUPLoginOnUPForm_change() { await testSubmittingLoginFormHTTP( "subtst_notifications_8.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -727,7 +727,7 @@ add_task(async function test_changeUPLoginOnUPForm_change() { await checkDoorhangerUsernamePassword("notifyu1", "pass2"); let promiseLoginUpdateSaved = TestUtils.topicObserved( "LoginStats:LoginUpdateSaved", - (subject, data) => subject == gBrowser.selectedBrowser + (subject, _topic, _data) => subject == gBrowser.selectedBrowser ); clickDoorhangerButton(notif, CHANGE_BUTTON); await promiseLoginUpdateSaved; @@ -760,7 +760,7 @@ add_task(async function test_changePLoginOnUPForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_9.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -801,7 +801,7 @@ add_task(async function test_changePLoginOnPForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_10.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -842,7 +842,7 @@ add_task(async function test_checkUPSaveText() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -880,7 +880,7 @@ add_task(async function test_checkPSaveText() { await testSubmittingLoginFormHTTP( "subtst_notifications_6.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -917,7 +917,7 @@ add_task(async function test_capture2pw0un() { await testSubmittingLoginFormHTTP( "subtst_notifications_2pw_0un.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -948,7 +948,7 @@ add_task(async function test_change2pw0unExistingDifferentUP() { await testSubmittingLoginFormHTTP( "subtst_notifications_2pw_0un.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -982,7 +982,7 @@ add_task(async function test_change2pw0unExistingDifferentP() { await testSubmittingLoginFormHTTP( "subtst_notifications_2pw_0un.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -1046,7 +1046,7 @@ add_task(async function test_changeUPLoginOnPUpdateForm() { await testSubmittingLoginFormHTTP( "subtst_notifications_change_p.html", - async function (fieldValues) { + async fieldValues => { Assert.equal(fieldValues.username, "null", "Checking submitted username"); Assert.equal( fieldValues.password, @@ -1094,7 +1094,7 @@ add_task(async function test_recipeCaptureFields_NewLogin() { await testSubmittingLoginFormHTTP( "subtst_notifications_2pw_1un_1text.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -1175,7 +1175,7 @@ add_task(async function test_saveUsingEnter() { info("Waiting for form submit and doorhanger interaction"); await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async fieldValues => { Assert.equal( fieldValues.username, "notifyu1", @@ -1231,7 +1231,7 @@ add_task(async function test_noShowPasswordOnDismissal() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async function (_fieldValues) { info("Opening popup"); let notif = await getCaptureDoorhangerThatMayOpen("password-save"); Assert.ok(!notif.dismissed, "doorhanger is not dismissed"); @@ -1265,7 +1265,7 @@ add_task(async function test_showPasswordOn1stOpenOfDismissedByDefault() { await testSubmittingLoginFormHTTP( "subtst_notifications_1.html", - async function (fieldValues) { + async function (_fieldValues) { info("Opening popup"); let notif = await getCaptureDoorhangerThatMayOpen("password-save"); Assert.ok(!notif.dismissed, "doorhanger is not dismissed"); diff --git a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_window_open.js b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_window_open.js index ea0437955d..6224f027a4 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_doorhanger_window_open.js +++ b/toolkit/components/passwordmgr/test/browser/browser_doorhanger_window_open.js @@ -27,7 +27,7 @@ let login2 = new nsLoginInfo( ); function withTestTabUntilStorageChange(aPageFile, aTaskFn) { - function storageChangedObserved(subject, data) { + function storageChangedObserved(_subject, data) { // Watch for actions triggered from a doorhanger (not cleanup tasks with removeLogin) if (data == "removeLogin") { return false; @@ -44,7 +44,7 @@ function withTestTabUntilStorageChange(aPageFile, aTaskFn) { gBrowser, url: "http://mochi.test:8888" + DIRECTORY_PATH + aPageFile, }, - async function (browser) { + async function (_browser) { Assert.ok(true, "loaded " + aPageFile); info("running test case task"); await aTaskFn(); diff --git a/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js b/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js index e400dc4637..9241f18612 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js +++ b/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js @@ -66,7 +66,7 @@ add_task(async function pageInfo_entryPoint() { gBrowser, url: TEST_ORIGIN, }, - async function (browser) { + async function (_browser) { info("pageInfo_entryPoint, opening pageinfo"); let pageInfo = BrowserPageInfo(TEST_ORIGIN, "securityTab", {}); await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); diff --git a/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js b/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js index bb7e973db6..8a625fd86f 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js +++ b/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js @@ -50,7 +50,7 @@ add_setup(async function () { }); add_task(async function test_urlbar_new_URL() { - await withTestPage(async function (aBrowser) { + await withTestPage(async aBrowser => { gURLBar.value = ""; let focusPromise = BrowserTestUtils.waitForEvent(gURLBar, "focus"); gURLBar.focus(); @@ -67,7 +67,7 @@ add_task(async function test_urlbar_new_URL() { }); add_task(async function test_urlbar_fragment_enter() { - await withTestPage(function (aBrowser) { + await withTestPage(_browser => { gURLBar.focus(); gURLBar.select(); EventUtils.synthesizeKey("KEY_ArrowRight"); @@ -77,7 +77,7 @@ add_task(async function test_urlbar_fragment_enter() { }); add_task(async function test_backButton_forwardButton() { - await withTestPage(async function (aBrowser) { + await withTestPage(async aBrowser => { info("Loading formless_basic.html?second"); // Load a new page in the tab so we can test going back BrowserTestUtils.startLoadingURIString( @@ -120,7 +120,7 @@ add_task(async function test_backButton_forwardButton() { }); add_task(async function test_reloadButton() { - await withTestPage(async function (aBrowser) { + await withTestPage(async aBrowser => { let reloadButton = document.getElementById("reload-button"); let loadPromise = BrowserTestUtils.browserLoaded( aBrowser, @@ -137,7 +137,7 @@ add_task(async function test_reloadButton() { }); add_task(async function test_back_keyboard_shortcut() { - await withTestPage(async function (aBrowser) { + await withTestPage(async aBrowser => { // Load a new page in the tab so we can test going back BrowserTestUtils.startLoadingURIString( aBrowser, diff --git a/toolkit/components/passwordmgr/test/browser/browser_message_onFormSubmit.js b/toolkit/components/passwordmgr/test/browser/browser_message_onFormSubmit.js index 5e611a7384..eca5f6818a 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_message_onFormSubmit.js +++ b/toolkit/components/passwordmgr/test/browser/browser_message_onFormSubmit.js @@ -5,7 +5,7 @@ async function waitForFormSubmissionDetected() { return new Promise(resolve => { - Services.obs.addObserver(function observer(subject, topic) { + Services.obs.addObserver(function observer(_subject, _topic, _data) { Services.obs.removeObserver( observer, "passwordmgr-form-submission-detected" diff --git a/toolkit/components/passwordmgr/test/browser/browser_preselect_login.js b/toolkit/components/passwordmgr/test/browser/browser_preselect_login.js index 5847e84282..e8a405cbca 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_preselect_login.js +++ b/toolkit/components/passwordmgr/test/browser/browser_preselect_login.js @@ -154,7 +154,7 @@ add_task( gBrowser, url: TEST_URL_PATH, }, - async function (browser) { + async function (_browser) { await waitForAppMenu(); const appMenuPasswordsButton = document.getElementById( diff --git a/toolkit/components/passwordmgr/test/browser/browser_proxyAuth_prompt.js b/toolkit/components/passwordmgr/test/browser/browser_proxyAuth_prompt.js index 478f204581..dfa78ff28e 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_proxyAuth_prompt.js +++ b/toolkit/components/passwordmgr/test/browser/browser_proxyAuth_prompt.js @@ -13,12 +13,12 @@ function initProxy() { let proxyCallback = { QueryInterface: ChromeUtils.generateQI(["nsIProtocolProxyCallback"]), - onProxyAvailable(req, uri, pi, status) { + onProxyAvailable(_req, _uri, _pi, _status) { class ProxyChannelListener { - onStartRequest(request) { + onStartRequest(_request) { resolve(proxyChannel); } - onStopRequest(request, status) {} + onStopRequest(_request, _status) {} } // I'm cheating a bit here... We should probably do some magic foo to get // something implementing nsIProxiedProtocolHandler and then call @@ -81,7 +81,7 @@ function getAuthPromptCallback() { callbackResolver = resolve; }); let callback = { - onAuthAvailable(context, authInfo) { + onAuthAvailable(_context, authInfo) { callbackResolver(authInfo); }, }; diff --git a/toolkit/components/passwordmgr/test/browser/browser_relay_telemetry.js b/toolkit/components/passwordmgr/test/browser/browser_relay_telemetry.js index ea5a25db79..31d294e01d 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_relay_telemetry.js +++ b/toolkit/components/passwordmgr/test/browser/browser_relay_telemetry.js @@ -203,7 +203,7 @@ add_task(async function test_pref_toggle() { gBrowser, url: "about:preferences#privacy", }, - async function (browser) { + async _browser => { const relayIntegrationCheckbox = content.document.querySelector( "checkbox#relayIntegration" ); diff --git a/toolkit/components/passwordmgr/test/browser/browser_username_only_form_telemetry.js b/toolkit/components/passwordmgr/test/browser/browser_username_only_form_telemetry.js index 54304c24ac..0824745bfd 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_username_only_form_telemetry.js +++ b/toolkit/components/passwordmgr/test/browser/browser_username_only_form_telemetry.js @@ -5,7 +5,7 @@ "use strict"; -async function setupForms(numUsernameOnly, numBasic, numOther) { +async function setupForms(numUsernameOnly, numBasic) { const TEST_HOSTNAME = "https://example.com"; let tab = await BrowserTestUtils.openNewForegroundTab( gBrowser, @@ -88,9 +88,7 @@ add_task(async function test_oneUsernameOnlyForm() { const numUsernameOnlyForms = 1; const numBasicForms = 0; - // number of "other" forms doesn't change the outcome, set it to 2 here and - // in the following testcase just to ensure it doesn't affect the result. - let tab = await setupForms(numUsernameOnlyForms, numBasicForms, 2); + let tab = await setupForms(numUsernameOnlyForms, numBasicForms); await checkChildHistogram( "PWMGR_IS_USERNAME_ONLY_FORM", @@ -111,7 +109,7 @@ add_task(async function test_multipleUsernameOnlyForms() { const numUsernameOnlyForms = 3; const numBasicForms = 2; - let tab = await setupForms(numUsernameOnlyForms, numBasicForms, 2); + let tab = await setupForms(numUsernameOnlyForms, numBasicForms); await checkChildHistogram( "PWMGR_IS_USERNAME_ONLY_FORM", @@ -133,7 +131,7 @@ add_task(async function test_multipleDocument() { let numUsernameOnlyForms1 = 2; let numBasicForms1 = 2; - let tab1 = await setupForms(numUsernameOnlyForms1, numBasicForms1, 2); + let tab1 = await setupForms(numUsernameOnlyForms1, numBasicForms1); await checkChildHistogram( "PWMGR_IS_USERNAME_ONLY_FORM", @@ -150,7 +148,7 @@ add_task(async function test_multipleDocument() { let numUsernameOnlyForms2 = 15; let numBasicForms2 = 3; - let tab2 = await setupForms(numUsernameOnlyForms2, numBasicForms2, 2); + let tab2 = await setupForms(numUsernameOnlyForms2, numBasicForms2); await checkChildHistogram( "PWMGR_IS_USERNAME_ONLY_FORM", @@ -180,7 +178,7 @@ add_task(async function test_tooManyUsernameOnlyForms() { const numUsernameOnlyForms = 25; const numBasicForms = 2; - let tab = await setupForms(numUsernameOnlyForms, numBasicForms, 2); + let tab = await setupForms(numUsernameOnlyForms, numBasicForms); await checkChildHistogram( "PWMGR_IS_USERNAME_ONLY_FORM", 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 @@