summaryrefslogtreecommitdiffstats
path: root/browser/extensions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /browser/extensions
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/extensions')
-rw-r--r--browser/extensions/formautofill/api.js2
-rw-r--r--browser/extensions/formautofill/background.js2
-rw-r--r--browser/extensions/formautofill/content/autofillEditForms.js8
-rw-r--r--browser/extensions/formautofill/content/customElements.js11
-rw-r--r--browser/extensions/formautofill/content/editDialog.js6
-rw-r--r--browser/extensions/formautofill/content/manageCreditCards.xhtml1
-rw-r--r--browser/extensions/formautofill/content/manageDialog.js7
-rw-r--r--browser/extensions/formautofill/locales/en-US/formautofill.properties6
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser.toml2
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_capture_form_removal.js2
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_capture_trimmed_data.js100
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_not_shown.js2
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_state.js103
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_unsupported_region.js4
-rw-r--r--browser/extensions/formautofill/test/browser/address/browser_address_telemetry.js2
-rw-r--r--browser/extensions/formautofill/test/browser/browser.toml3
-rw-r--r--browser/extensions/formautofill/test/browser/browser_active_window_navigation.js6
-rw-r--r--browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js47
-rw-r--r--browser/extensions/formautofill/test/browser/browser_autofill_sandboxed_iframe.js31
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser.toml78
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js2
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js102
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js2
-rw-r--r--browser/extensions/formautofill/test/browser/head.js14
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser.toml4
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js159
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js131
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js2
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js11
-rw-r--r--browser/extensions/formautofill/test/fixtures/autocomplete_iframe_sandboxed.html11
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html1
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html1
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html2
-rw-r--r--browser/extensions/formautofill/test/mochitest/formautofill_common.js22
-rw-r--r--browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js34
-rw-r--r--browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html6
-rw-r--r--browser/extensions/formautofill/test/mochitest/test_form_changes.html3
-rw-r--r--browser/extensions/formautofill/test/unit/head.js18
-rw-r--r--browser/extensions/formautofill/test/unit/test_autofillFormFields.js35
-rw-r--r--browser/extensions/formautofill/test/unit/test_getFormInputDetails.js18
-rw-r--r--browser/extensions/formautofill/test/unit/test_markAsAutofillField.js32
-rw-r--r--browser/extensions/formautofill/test/unit/test_onFormSubmitted.js712
-rw-r--r--browser/extensions/formautofill/test/unit/test_phoneNumber.js4
-rw-r--r--browser/extensions/formautofill/test/unit/test_previewFormFields.js2
-rw-r--r--browser/extensions/formautofill/test/unit/test_storage_tombstones.js8
-rw-r--r--browser/extensions/formautofill/test/unit/xpcshell.toml6
-rw-r--r--browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js3
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/airmozilla.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/arte.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/bbc.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/dailymotion.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/disneyplus.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/edx.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/hbomax.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/hotstar.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/hulu.js4
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/mock-wrapper.js4
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/netflix.js8
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/nytimes.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/piped.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/primeVideo.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/sonyliv.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/tubi.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/tubilive.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/twitch.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/udemy.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/videojsWrapper.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/voot.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/washingtonpost.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/yahoo.js2
-rw-r--r--browser/extensions/pictureinpicture/video-wrappers/youtube.js4
-rw-r--r--browser/extensions/report-site-issue/.eslintrc.js3
-rw-r--r--browser/extensions/report-site-issue/background.js43
-rw-r--r--browser/extensions/report-site-issue/manifest.json4
-rw-r--r--browser/extensions/report-site-issue/test/browser/head.js2
-rw-r--r--browser/extensions/report-site-issue/test/browser/test.html1
-rw-r--r--browser/extensions/screenshots/test/browser/browser.toml6
-rw-r--r--browser/extensions/search-detection/extension/api.js4
-rw-r--r--browser/extensions/webcompat/data/injections.js95
-rw-r--r--browser/extensions/webcompat/data/shims.js11
-rw-r--r--browser/extensions/webcompat/data/ua_overrides.js124
-rw-r--r--browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css19
-rw-r--r--browser/extensions/webcompat/injections/css/bug1848716-elal.com-unsupported-banner.css16
-rw-r--r--browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css20
-rw-r--r--browser/extensions/webcompat/injections/css/bug1884842-foodora.cz-height-fix.css25
-rw-r--r--browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js22
-rw-r--r--browser/extensions/webcompat/injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js33
-rw-r--r--browser/extensions/webcompat/manifest.json3
-rw-r--r--browser/extensions/webcompat/moz.build7
-rw-r--r--browser/extensions/webcompat/shims/private-browsing-web-api-fixes.js19
90 files changed, 862 insertions, 1423 deletions
diff --git a/browser/extensions/formautofill/api.js b/browser/extensions/formautofill/api.js
index 000c393e8e..967b4a8d63 100644
--- a/browser/extensions/formautofill/api.js
+++ b/browser/extensions/formautofill/api.js
@@ -179,7 +179,7 @@ this.formautofill = class extends ExtensionAPI {
esModuleURI: "resource://autofill/FormAutofillChild.sys.mjs",
events: {
focusin: {},
- DOMFormBeforeSubmit: {},
+ "form-submission-detected": {},
},
},
allFrames: true,
diff --git a/browser/extensions/formautofill/background.js b/browser/extensions/formautofill/background.js
index fe6265415f..199d6fc20a 100644
--- a/browser/extensions/formautofill/background.js
+++ b/browser/extensions/formautofill/background.js
@@ -6,7 +6,7 @@
"use strict";
-browser.runtime.onUpdateAvailable.addListener(details => {
+browser.runtime.onUpdateAvailable.addListener(_details => {
// By listening to but ignoring this event, any updates will
// be delayed until the next browser restart.
// Note that if we ever wanted to change this, we should make
diff --git a/browser/extensions/formautofill/content/autofillEditForms.js b/browser/extensions/formautofill/content/autofillEditForms.js
index fea7a90a0a..290b436a64 100644
--- a/browser/extensions/formautofill/content/autofillEditForms.js
+++ b/browser/extensions/formautofill/content/autofillEditForms.js
@@ -112,10 +112,8 @@ class EditAutofillForm {
/**
* Handle input events
- *
- * @param {DOMEvent} event
*/
- handleInput(event) {}
+ handleInput(_e) {}
/**
* Attach event listener
@@ -140,9 +138,9 @@ class EditAutofillForm {
/**
* Run custom validity routines specific to the field and type of form.
*
- * @param {DOMElement} field The field that will be validated.
+ * @param {DOMElement} _field The field that will be validated.
*/
- updateCustomValidity(field) {}
+ updateCustomValidity(_field) {}
}
class EditAddress extends EditAutofillForm {
diff --git a/browser/extensions/formautofill/content/customElements.js b/browser/extensions/formautofill/content/customElements.js
index 0f1260634d..2f22a8173a 100644
--- a/browser/extensions/formautofill/content/customElements.js
+++ b/browser/extensions/formautofill/content/customElements.js
@@ -287,16 +287,7 @@
this._itemBox.setAttribute("no-warning", "true");
}
- // After focusing a field that was previously filled with cc information,
- // the "ac-image" is falsely set for the listitem-footer. For now it helps us
- // to distinguish between address and cc footer. In the future this false attribute
- // setting should be fixed and the "ac-image" check replaced by a different method.
- const buttonTextBundleKey = !this.getAttribute("ac-image")
- ? "autocompleteManageAddresses"
- : "autocompleteManageCreditCards";
- const buttonText =
- this._stringBundle.GetStringFromName(buttonTextBundleKey);
- this._optionButton.textContent = buttonText;
+ this._optionButton.textContent = value.manageLabel;
}
}
diff --git a/browser/extensions/formautofill/content/editDialog.js b/browser/extensions/formautofill/content/editDialog.js
index 8aad87ceb3..467acbdd07 100644
--- a/browser/extensions/formautofill/content/editDialog.js
+++ b/browser/extensions/formautofill/content/editDialog.js
@@ -8,7 +8,7 @@
"use strict";
ChromeUtils.defineESModuleGetters(this, {
- AutofillTelemetry: "resource://autofill/AutofillTelemetry.sys.mjs",
+ AutofillTelemetry: "resource://gre/modules/shared/AutofillTelemetry.sys.mjs",
formAutofillStorage: "resource://autofill/FormAutofillStorage.sys.mjs",
});
@@ -107,10 +107,8 @@ class AutofillEditDialog {
/**
* Handle input events
- *
- * @param {DOMEvent} event
*/
- handleInput(event) {
+ handleInput(_e) {
this.updateSaveButtonState();
}
diff --git a/browser/extensions/formautofill/content/manageCreditCards.xhtml b/browser/extensions/formautofill/content/manageCreditCards.xhtml
index 2b33f7750f..e7baf9d364 100644
--- a/browser/extensions/formautofill/content/manageCreditCards.xhtml
+++ b/browser/extensions/formautofill/content/manageCreditCards.xhtml
@@ -11,6 +11,7 @@
<head>
<title data-l10n-id="autofill-manage-payment-methods-title"></title>
<link rel="localization" href="browser/preferences/formAutofill.ftl" />
+ <link rel="localization" href="toolkit/formautofill/formAutofill.ftl" />
<link rel="localization" href="toolkit/payments/payments.ftl" />
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
<link
diff --git a/browser/extensions/formautofill/content/manageDialog.js b/browser/extensions/formautofill/content/manageDialog.js
index b6bcb3a77b..ad5cefbb15 100644
--- a/browser/extensions/formautofill/content/manageDialog.js
+++ b/browser/extensions/formautofill/content/manageDialog.js
@@ -17,7 +17,7 @@ const { FormAutofill } = ChromeUtils.importESModule(
"resource://autofill/FormAutofill.sys.mjs"
);
const { AutofillTelemetry } = ChromeUtils.importESModule(
- "resource://autofill/AutofillTelemetry.sys.mjs"
+ "resource://gre/modules/shared/AutofillTelemetry.sys.mjs"
);
ChromeUtils.defineESModuleGetters(this, {
@@ -197,6 +197,9 @@ class ManageRecords {
this._elements.edit.setAttribute("disabled", "disabled");
this._elements.remove.removeAttribute("disabled");
}
+ this._elements.add.disabled = !Services.prefs.getBoolPref(
+ `extensions.formautofill.${this._subStorageName}.enabled`
+ );
}
/**
@@ -265,7 +268,7 @@ class ManageRecords {
}
}
- observe(subject, topic, data) {
+ observe(_subject, topic, _data) {
switch (topic) {
case "formautofill-storage-changed": {
this.loadRecords();
diff --git a/browser/extensions/formautofill/locales/en-US/formautofill.properties b/browser/extensions/formautofill/locales/en-US/formautofill.properties
index 2447b652c8..d3add192d7 100644
--- a/browser/extensions/formautofill/locales/en-US/formautofill.properties
+++ b/browser/extensions/formautofill/locales/en-US/formautofill.properties
@@ -2,12 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# LOCALIZATION NOTE (autocompleteManageCreditCards):
-# Used as a label for the button, displayed at the bottom of the dropdown suggestion, to open Form Autofill browser preferences.
-autocompleteManageCreditCards = Manage credit cards
-# LOCALIZATION NOTE (autocompleteManageAddresses):
-# Used as a label for the button, displayed at the bottom of the dropdown suggestion, to open Form Autofill browser preferences.
-autocompleteManageAddresses = Manage addresses
# LOCALIZATION NOTE (category.address, category.name, category.organization2, category.tel, category.email):
# Used in autofill drop down suggestion to indicate what other categories Form Autofill will attempt to fill.
category.address = address
diff --git a/browser/extensions/formautofill/test/browser/address/browser.toml b/browser/extensions/formautofill/test/browser/address/browser.toml
index bff24a88b0..8b7f1ec760 100644
--- a/browser/extensions/formautofill/test/browser/address/browser.toml
+++ b/browser/extensions/formautofill/test/browser/address/browser.toml
@@ -18,6 +18,8 @@ support-files = [
["browser_address_capture_page_navigation.js"]
+["browser_address_capture_trimmed_data.js"]
+
["browser_address_doorhanger_confirmation_popup.js"]
["browser_address_doorhanger_display.js"]
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_capture_form_removal.js b/browser/extensions/formautofill/test/browser/address/browser_address_capture_form_removal.js
index f94fc8241f..fed89d4599 100644
--- a/browser/extensions/formautofill/test/browser/address/browser_address_capture_form_removal.js
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_capture_form_removal.js
@@ -118,7 +118,7 @@ add_task(async function test_address_not_captured_without_prior_fetch() {
});
info("Ensure that address doorhanger is not shown");
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
});
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_capture_trimmed_data.js b/browser/extensions/formautofill/test/browser/address/browser_address_capture_trimmed_data.js
new file mode 100644
index 0000000000..c0856dfb8d
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_capture_trimmed_data.js
@@ -0,0 +1,100 @@
+"use strict";
+
+const DEFAULT_TEST_DOC = `
+<form id="form">
+ <input id="street-address" autocomplete="street-address">
+ <select id="address-level1" autocomplete="address-level1">
+ <option value=""></option>
+ <option value="AL">Alabama</option>
+ <option value="AK">Alaska</option>
+ <option value="AP">Armed Forces Pacific</option>
+
+ <option value="ca">california</option>
+ <option value="AR">US-Arkansas</option>
+ <option value="US-CA">California</option>
+ <option value="CA">California</option>
+ <option value="US-AZ">US_Arizona</option>
+ <option value="Ariz">Arizonac</option>
+</select>
+<input id="city" autocomplete="address-level2">
+<input id="country" autocomplete="country">
+<input id="email" autocomplete="email">
+<input id="tel" autocomplete="tel">
+<input type="submit"/>
+</form>`;
+
+const TESTCASES = [
+ {
+ description: "Save address with trimmed address data",
+ document: DEFAULT_TEST_DOC,
+ targetElementId: "street-address",
+ formValue: {
+ "#street-address": "331 E. Evelyn Avenue ",
+ "#country": "US",
+ "#email": " ",
+ "#tel": "1-650-903-0800",
+ },
+ expected: [
+ {
+ "street-address": "331 E. Evelyn Avenue",
+ country: "US",
+ email: "",
+ tel: "+16509030800",
+ },
+ ],
+ },
+];
+
+async function expectSavedAddresses(expectedAddresses) {
+ const addresses = await getAddresses();
+ is(
+ addresses.length,
+ expectedAddresses.length,
+ `${addresses.length} address in the storage`
+ );
+
+ for (let i = 0; i < expectedAddresses.length; i++) {
+ for (const [key, value] of Object.entries(expectedAddresses[i])) {
+ is(addresses[i][key] ?? "", value, `field ${key} should be equal`);
+ }
+ }
+ return addresses;
+}
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["extensions.formautofill.addresses.enabled", true],
+ ["extensions.formautofill.addresses.supported", "on"],
+ ["extensions.formautofill.addresses.capture.enabled", true],
+ ],
+ });
+});
+
+add_task(async function test_address_capture_trimmed_data() {
+ for (const TEST of TESTCASES) {
+ info(`Test ${TEST.description}`);
+
+ const onChanged = waitForStorageChangedEvents("add");
+ await BrowserTestUtils.withNewTab(EMPTY_URL, async function (browser) {
+ await SpecialPowers.spawn(browser, [TEST.document], doc => {
+ content.document.body.innerHTML = doc;
+ });
+
+ await SimpleTest.promiseFocus(browser);
+
+ const onPopupShown = waitForPopupShown();
+ await focusUpdateSubmitForm(browser, {
+ focusSelector: `#${TEST.targetElementId}`,
+ newValues: TEST.formValue,
+ });
+
+ await onPopupShown;
+ await clickDoorhangerButton(MAIN_BUTTON, 0);
+ });
+ await onChanged;
+
+ await expectSavedAddresses(TEST.expected);
+ await removeAllRecords();
+ }
+});
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_not_shown.js b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_not_shown.js
index b1b8a6b9d2..84508189bd 100644
--- a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_not_shown.js
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_not_shown.js
@@ -87,7 +87,7 @@ add_task(async function test_save_doorhanger_not_shown() {
newValues: TEST.formValue,
});
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
});
if (TEST.prefs) {
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_state.js b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_state.js
index a247341fef..f3b04d7f9c 100644
--- a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_state.js
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_state.js
@@ -1,4 +1,5 @@
"use strict";
+requestLongerTimeout(3);
async function expectSavedAddresses(expectedAddresses) {
const addresses = await getAddresses();
@@ -18,7 +19,11 @@ async function expectSavedAddresses(expectedAddresses) {
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
- set: [["extensions.formautofill.addresses.capture.enabled", true]],
+ set: [
+ ["extensions.formautofill.addresses.enabled", true],
+ ["extensions.formautofill.addresses.supported", "on"],
+ ["extensions.formautofill.addresses.capture.enabled", true],
+ ],
});
});
@@ -102,6 +107,7 @@ add_task(async function test_save_doorhanger_state_valid() {
for (const TEST of TEST_CASES) {
await expectSavedAddresses([]);
+ const onChanged = waitForStorageChangedEvents("add");
await BrowserTestUtils.withNewTab(
{ gBrowser, url: ADDRESS_FORM_URL },
async function (browser) {
@@ -122,8 +128,103 @@ add_task(async function test_save_doorhanger_state_valid() {
await clickDoorhangerButton(MAIN_BUTTON, 0);
}
);
+ await onChanged;
await expectSavedAddresses([Object.assign(DEFAULT, TEST.expected)]);
await removeAllRecords();
}
});
+
+add_task(async function test_save_doorhanger_state_is_select() {
+ const DEFAULT_TEST_DOC = `
+ <form id="form">
+ <input id="name" autocomplete="name">
+ <input id="street-address" autocomplete="street-address">
+ <select id="address-level1" autocomplete="address-level1">
+ <option value=""></option>
+ <option value="AL">Alabama</option>
+ <option value="AK">Alaska</option>
+ <option value="AP">Armed Forces Pacific</option>
+
+ <option value="ca">california</option>
+ <option value="AR">US-Arkansas</option>
+ <option value="US-CA">California</option>
+ <option value="CA">California</option>
+ <option value="US-AZ">US_Arizona</option>
+ <option value="Ariz">Arizonac</option>
+ </select>
+ <input id="city" autocomplete="address-level2">
+ <input id="country" autocomplete="country">
+ <input id="submit" type="submit">
+ </form>`;
+
+ const TEST_CASES = [
+ {
+ description: "Save state with regular select option",
+ filled: { "address-level1": "CA" },
+ expected: { "address-level1": "CA" },
+ },
+ {
+ description: "Save state with lowercase value",
+ filled: { "address-level1": "ca" },
+ expected: { "address-level1": "CA" },
+ },
+ {
+ description: "Save state with a country code prefixed to the label",
+ filled: { "address-level1": "AR" },
+ expected: { "address-level1": "AR" },
+ },
+ {
+ description: "Save state with a country code prefixed to the value",
+ filled: { "address-level1": "US-CA" },
+ expected: { "address-level1": "CA" },
+ },
+ {
+ description:
+ "Save state with a country code prefixed to the value and label",
+ filled: { "address-level1": "US-AZ" },
+ expected: { "address-level1": "AZ" },
+ },
+ {
+ description: "Should not save when failed to abbreviate the value",
+ filled: { "address-level1": "Ariz" },
+ expected: { "address-level1": "" },
+ },
+ {
+ description: "Should not save select with multiple selections",
+ filled: { "address-level1": ["AL", "AK", "AP"] },
+ expected: { "address-level1": "" },
+ },
+ ];
+
+ for (const TEST of TEST_CASES) {
+ const onChanged = waitForStorageChangedEvents("add");
+ await BrowserTestUtils.withNewTab(EMPTY_URL, async function (browser) {
+ info(`Test ${TEST.description}`);
+
+ await SpecialPowers.spawn(browser, [DEFAULT_TEST_DOC], doc => {
+ content.document.body.innerHTML = doc;
+ });
+
+ await SimpleTest.promiseFocus(browser);
+
+ const onPopupShown = waitForPopupShown();
+ await focusUpdateSubmitForm(browser, {
+ focusSelector: "#name",
+ newValues: {
+ "#name": "John Doe",
+ "#street-address": "Main Street",
+ "#country": "US",
+ "#address-level1": TEST.filled["address-level1"],
+ },
+ });
+
+ await onPopupShown;
+ await clickDoorhangerButton(MAIN_BUTTON, 0);
+ });
+ await onChanged;
+
+ await expectSavedAddresses([TEST.expected]);
+ await removeAllRecords();
+ }
+});
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_unsupported_region.js b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_unsupported_region.js
index fc3d1c7cf4..243f857fbb 100644
--- a/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_unsupported_region.js
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_doorhanger_unsupported_region.js
@@ -53,7 +53,7 @@ add_task(async function test_save_doorhanger_unsupported_region_from_record() {
},
});
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
});
@@ -79,7 +79,7 @@ add_task(async function test_save_doorhanger_unsupported_region_from_pref() {
},
});
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
diff --git a/browser/extensions/formautofill/test/browser/address/browser_address_telemetry.js b/browser/extensions/formautofill/test/browser/address/browser_address_telemetry.js
index acd7a7c364..b55abd6c72 100644
--- a/browser/extensions/formautofill/test/browser/address/browser_address_telemetry.js
+++ b/browser/extensions/formautofill/test/browser/address/browser_address_telemetry.js
@@ -7,7 +7,7 @@ const { TelemetryTestUtils } = ChromeUtils.importESModule(
);
const { AddressTelemetry } = ChromeUtils.importESModule(
- "resource://autofill/AutofillTelemetry.sys.mjs"
+ "resource://gre/modules/shared/AutofillTelemetry.sys.mjs"
);
// Telemetry definitions
diff --git a/browser/extensions/formautofill/test/browser/browser.toml b/browser/extensions/formautofill/test/browser/browser.toml
index 2c9a995e67..7e7f0b8b68 100644
--- a/browser/extensions/formautofill/test/browser/browser.toml
+++ b/browser/extensions/formautofill/test/browser/browser.toml
@@ -4,6 +4,7 @@ support-files = [
"./fathom/**",
"../fixtures/autocomplete_basic.html",
"../fixtures/autocomplete_iframe.html",
+ "../fixtures/autocomplete_iframe_sandboxed.html",
"../fixtures/autocomplete_simple_basic.html",
"../fixtures/page_navigation.html",
"./empty.html",
@@ -26,6 +27,8 @@ skip-if = [
["browser_autofill_duplicate_fields.js"]
+["browser_autofill_sandboxed_iframe.js"]
+
["browser_check_installed.js"]
["browser_dropdown_layout.js"]
diff --git a/browser/extensions/formautofill/test/browser/browser_active_window_navigation.js b/browser/extensions/formautofill/test/browser/browser_active_window_navigation.js
index 17cda3137d..6c69b9d63e 100644
--- a/browser/extensions/formautofill/test/browser/browser_active_window_navigation.js
+++ b/browser/extensions/formautofill/test/browser/browser_active_window_navigation.js
@@ -69,7 +69,7 @@ add_task(
});
info("Ensure address doorhanger not shown");
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
}
@@ -124,7 +124,7 @@ add_task(
});
info("Ensure address doorhanger not shown");
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
}
@@ -238,7 +238,7 @@ add_task(
});
info("Ensure address doorhanger not shown");
- await ensureNoDoorhanger;
+ await ensureNoDoorhanger();
ok(true, "Address doorhanger is not shown");
}
diff --git a/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js b/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
index fde34a0a32..1e7ba523e8 100644
--- a/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
+++ b/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
@@ -2,12 +2,57 @@
const URL = BASE_URL + "autocomplete_basic.html";
+const l10n = new Localization(["toolkit/formautofill/formAutofill.ftl"], true);
+
add_setup(async function setup_storage() {
await setStorage(
TEST_ADDRESS_2,
TEST_ADDRESS_3,
TEST_ADDRESS_4,
- TEST_ADDRESS_5
+ TEST_ADDRESS_5,
+ TEST_CREDIT_CARD_1
+ );
+});
+
+add_task(async function test_footer_has_correct_button_text_on_address() {
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: URL },
+ async function (browser) {
+ const {
+ autoCompletePopup: { richlistbox: itemsBox },
+ } = browser;
+
+ await openPopupOn(browser, "#organization");
+ const footer = itemsBox.querySelector(
+ ".autofill-footer-row.autofill-button"
+ );
+ Assert.equal(
+ footer.innerText,
+ l10n.formatValueSync("autofill-manage-addresses-label")
+ );
+ await closePopup(browser);
+ }
+ );
+});
+
+add_task(async function test_footer_has_correct_button_text_on_credit_card() {
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: CREDITCARD_FORM_URL },
+ async function (browser) {
+ const {
+ autoCompletePopup: { richlistbox: itemsBox },
+ } = browser;
+
+ await openPopupOn(browser, "#cc-number");
+ const footer = itemsBox.querySelector(
+ ".autofill-footer-row.autofill-button"
+ );
+ Assert.equal(
+ footer.innerText,
+ l10n.formatValueSync("autofill-manage-payment-methods-label")
+ );
+ await closePopup(browser);
+ }
);
});
diff --git a/browser/extensions/formautofill/test/browser/browser_autofill_sandboxed_iframe.js b/browser/extensions/formautofill/test/browser/browser_autofill_sandboxed_iframe.js
new file mode 100644
index 0000000000..2963a06941
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/browser_autofill_sandboxed_iframe.js
@@ -0,0 +1,31 @@
+"use strict";
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["extensions.formautofill.addresses.capture.enabled", true],
+ ["extensions.formautofill.addresses.supported", "on"],
+ ],
+ });
+ await setStorage(TEST_ADDRESS_2, TEST_ADDRESS_3);
+});
+
+add_task(async function test_autocomplete_in_sandboxed_iframe() {
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: FORM_IFRAME_SANDBOXED_URL },
+ async browser => {
+ const iframeBC = browser.browsingContext.children[0];
+ await openPopupOnSubframe(browser, iframeBC, "#street-address");
+ await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, iframeBC);
+ await BrowserTestUtils.synthesizeKey("VK_RETURN", {}, iframeBC);
+ await waitForAutofill(
+ iframeBC,
+ "#street-address",
+ TEST_ADDRESS_2["street-address"]
+ );
+ Assert.ok(true, "autocomplete works in sandboxed iframe");
+ }
+ );
+
+ await removeAllRecords();
+});
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser.toml b/browser/extensions/formautofill/test/browser/creditCard/browser.toml
index 710cdbafb4..580ce936d4 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser.toml
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser.toml
@@ -17,66 +17,80 @@ support-files = [
]
["browser_anti_clickjacking.js"]
-skip-if = ["!debug && os == 'mac'"] # perma-fail see Bug 1600059
+skip-if = [
+ "apple_catalina && !debug", # perma-fail see Bug 1600059
+ "apple_silicon && !debug", # perma-fail see Bug 1600059
+]
["browser_creditCard_capture_form_removal.js"]
+["browser_creditCard_capture_multiple_cc_number.js"]
+skip-if = [
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
+]
+
["browser_creditCard_capture_page_navigation.js"]
["browser_creditCard_doorhanger_action.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_display.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_fields.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_iframe.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_logo.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_not_shown.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_sync.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_dropdown_layout.js"]
-skip-if = [
- "os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
-]
+skip-if = ["true"]
["browser_creditCard_fill_cancel_login.js"]
skip-if = [
- "!debug && os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
+ "apple_catalina && !debug",
+ "os == 'linux' && os_version == '18.04'",
+ "win10_2009",
+ "win11_2009",
]
["browser_creditCard_heuristics.js"]
@@ -100,22 +114,10 @@ skip-if = [
]
["browser_editCreditCardDialog.js"]
-skip-if = [
- "os == 'mac'", # perma-fail see Bug 1600059
- "os == 'linux'", # perma-fail see Bug 1600059
- "os == 'win'", # perma-fail see Bug 1600059
-]
+skip-if = ["true"] # perma-fail see Bug 1600059
["browser_insecure_form.js"]
-skip-if = [
- "os == 'mac'", # bug 1456284
- "os == 'linux'", # bug 1456284
- "os == 'win'", # bug 1456284
-]
+skip-if = ["true"] # perma-fail see Bug 1456284
["browser_manageCreditCardsDialog.js"]
-skip-if = [
- "os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
-]
+skip-if = ["true"]
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
index a6c76aa675..3617062fad 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
@@ -113,7 +113,7 @@ add_task(async function test_credit_card_not_captured_without_prior_fetch() {
});
info("Ensure that credit card doorhanger is not shown");
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
});
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js
new file mode 100644
index 0000000000..5668e88e74
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js
@@ -0,0 +1,102 @@
+"use strict";
+
+const TESTCASES = [
+ {
+ description: "Trigger credit card saving using multiple cc-number fields",
+ document: `<form id="form">
+ <input id="cc-name" autocomplete="cc-name">
+ <input id="cc-number1" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number2" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number3" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number4" autocomplete="cc-number" maxlength="4">
+ <input id="cc-exp-month" autocomplete="cc-exp-month">
+ <input id="cc-exp-year" autocomplete="cc-exp-year">
+ <input id="submit" type="submit">
+ </form>`,
+ targetElementId: "cc-number1",
+ formValue: {
+ "#cc-name": "John Doe",
+ "#cc-number1": "3714",
+ "#cc-number2": "4963",
+ "#cc-number3": "5398",
+ "#cc-number4": "431",
+ "#cc-exp-month": 12,
+ "#cc-exp-year": 2000,
+ },
+ expected: [
+ {
+ "cc-name": "John Doe",
+ "cc-number": "371449635398431",
+ "cc-exp-month": 12,
+ "cc-exp-year": 2000,
+ "cc-type": "amex",
+ },
+ ],
+ },
+];
+
+async function expectSavedCreditCards(expectedCreditCards) {
+ const creditcards = await getCreditCards();
+ is(
+ creditcards.length,
+ expectedCreditCards.length,
+ `${creditcards.length} credit card in the storage`
+ );
+
+ for (let i = 0; i < expectedCreditCards.length; i++) {
+ for (const [key, value] of Object.entries(expectedCreditCards[i])) {
+ if (key == "cc-number") {
+ creditcards[i]["cc-number"] = await OSKeyStore.decrypt(
+ creditcards[i]["cc-number-encrypted"]
+ );
+ }
+ is(creditcards[i][key] ?? "", value, `field ${key} should be equal`);
+ }
+ }
+ return creditcards;
+}
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["extensions.formautofill.creditCards.supported", "on"],
+ ["extensions.formautofill.creditCards.enabled", true],
+ ],
+ });
+});
+
+add_task(async function test_capture_multiple_cc_number() {
+ if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
+ todo(
+ OSKeyStoreTestUtils.canTestOSKeyStoreLogin(),
+ "Cannot test OS key store login on official builds."
+ );
+ return;
+ }
+
+ for (const TEST of TESTCASES) {
+ info(`Test ${TEST.description}`);
+
+ let onChanged = waitForStorageChangedEvents("add");
+ await BrowserTestUtils.withNewTab(EMPTY_URL, async function (browser) {
+ await SpecialPowers.spawn(browser, [TEST.document], doc => {
+ content.document.body.innerHTML = doc;
+ });
+
+ await SimpleTest.promiseFocus(browser);
+
+ const onPopupShown = waitForPopupShown();
+ await focusUpdateSubmitForm(browser, {
+ focusSelector: `#${TEST.targetElementId}`,
+ newValues: TEST.formValue,
+ });
+
+ await onPopupShown;
+ await clickDoorhangerButton(MAIN_BUTTON, 0);
+ });
+ await onChanged;
+
+ await expectSavedCreditCards(TEST.expected);
+ await removeAllRecords();
+ }
+});
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
index f0752e0c22..0056b83727 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
@@ -86,7 +86,7 @@ add_task(async function test_save_doorhanger_not_shown() {
newValues: TEST.formValue,
});
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
});
}
});
diff --git a/browser/extensions/formautofill/test/browser/head.js b/browser/extensions/formautofill/test/browser/head.js
index 7a58b8a202..8de8488f1f 100644
--- a/browser/extensions/formautofill/test/browser/head.js
+++ b/browser/extensions/formautofill/test/browser/head.js
@@ -45,6 +45,8 @@ const ADDRESS_FORM_WITH_PAGE_NAVIGATION_BUTTONS =
"https://example.org" +
HTTP_TEST_PATH +
"address/capture_address_on_page_navigation.html";
+const FORM_IFRAME_SANDBOXED_URL =
+ "https://example.org" + HTTP_TEST_PATH + "autocomplete_iframe_sandboxed.html";
const CREDITCARD_FORM_URL =
"https://example.org" +
HTTP_TEST_PATH +
@@ -253,7 +255,7 @@ async function ensureNoAutocompletePopup(browser) {
ok(!items.length, "Should not find autocomplete items");
}
-async function ensureNoDoorhanger(browser) {
+async function ensureNoDoorhanger() {
await new Promise(resolve =>
setTimeout(resolve, TIMEOUT_ENSURE_DOORHANGER_NOT_SHOWN)
);
@@ -316,7 +318,7 @@ async function waitForAutofill(target, selector, value) {
* @returns {Promise} resolves when the sub dialog is loaded
*/
function waitForSubDialogLoad(win, dialogUrl) {
- return new Promise((resolve, reject) => {
+ return new Promise(resolve => {
win.gSubDialog._dialogStack.addEventListener(
"dialogopen",
async function dialogopen(evt) {
@@ -395,6 +397,14 @@ async function focusUpdateSubmitForm(target, args, submit = true) {
element = form.querySelector(selector);
if (content.HTMLInputElement.isInstance(element)) {
element.setUserInput(value);
+ } else if (
+ content.HTMLSelectElement.isInstance(element) &&
+ Array.isArray(value)
+ ) {
+ element.multiple = true;
+ [...element.options].forEach(option => {
+ option.selected = value.includes(option.value);
+ });
} else {
element.value = value;
}
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser.toml b/browser/extensions/formautofill/test/browser/heuristics/browser.toml
index e7bbfa0283..2d0916e917 100644
--- a/browser/extensions/formautofill/test/browser/heuristics/browser.toml
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser.toml
@@ -20,8 +20,6 @@ skip-if = ["apple_silicon && !debug"]
["browser_fr_fields.js"]
-["browser_ignore_unfocusable_fields.js"]
-
["browser_label_rules.js"]
["browser_multiple_section.js"]
@@ -37,3 +35,5 @@ skip-if = ["apple_silicon && !debug"]
["browser_section_validation_address.js"]
["browser_sections_by_name.js"]
+
+["browser_sections_with_invisible_fields.js"]
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js
deleted file mode 100644
index 56f53a1e76..0000000000
--- a/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* global add_heuristic_tests */
-
-"use strict";
-
-add_heuristic_tests([
- {
- description: "All visual fields are considered focusable.",
-
- fixtureData: `
- <html>
- <body>
- <form>
- <input type="text" id="name" autocomplete="name" />
- <input type="text" id="tel" autocomplete="tel" />
- <input type="text" id="email" autocomplete="email"/>
- <select id="country" autocomplete="country">
- <option value="United States">United States</option>
- </select>
- <input type="text" id="postal-code" autocomplete="postal-code"/>
- <input type="text" id="address-line1" autocomplete="address-line1" />
- <div>
- <input type="text" id="address-line2" autocomplete="address-line2" />
- </div>
- </form>
- </form>
- </body>
- </html>
- `,
- expectedResult: [
- {
- default: {
- reason: "autocomplete",
- },
- fields: [
- { fieldName: "name" },
- { fieldName: "tel" },
- { fieldName: "email" },
- { fieldName: "country" },
- { fieldName: "postal-code" },
- { fieldName: "address-line1" },
- { fieldName: "address-line2" },
- ],
- },
- ],
- },
- {
- // ignore opacity (see Bug 1835852),
- description:
- "Invisible fields with style.opacity=0 set are considered focusable.",
-
- fixtureData: `
- <html>
- <body>
- <form>
- <input type="text" id="name" autocomplete="name" style="opacity:0" />
- <input type="text" id="tel" autocomplete="tel" />
- <input type="text" id="email" autocomplete="email" style="opacity:0"/>
- <select id="country" autocomplete="country">
- <option value="United States">United States</option>
- </select>
- <input type="text" id="postal-code" autocomplete="postal-code" />
- <input type="text" id="address-line1" autocomplete="address-line1" />
- <div>
- <input type="text" id="address-line2" autocomplete="address-line2" />
- </div>
- </form>
- </form>
- </body>
- </html>
- `,
- expectedResult: [
- {
- default: {
- reason: "autocomplete",
- },
- fields: [
- { fieldName: "name" },
- { fieldName: "tel" },
- { fieldName: "email" },
- { fieldName: "country" },
- { fieldName: "postal-code" },
- { fieldName: "address-line1" },
- { fieldName: "address-line2" },
- ],
- },
- ],
- },
- {
- description:
- "Some fields are considered unfocusable due to their invisibility.",
-
- fixtureData: `
- <html>
- <body>
- <form>
- <input type="text" id="name" autocomplete="name" />
- <input type="text" id="tel" autocomplete="tel" />
- <input type="text" id="email" autocomplete="email" />
- <input type="text" id="country" autocomplete="country" />
- <input type="text" id="postal-code" autocomplete="postal-code" hidden />
- <input type="text" id="address-line1" autocomplete="address-line1" style="display:none" />
- <div style="visibility: hidden">
- <input type="text" id="address-line2" autocomplete="address-line2" />
- </div>
- </form>
- </body>
- </html>
- `,
- expectedResult: [
- {
- default: {
- reason: "autocomplete",
- },
- fields: [
- { fieldName: "name" },
- { fieldName: "tel" },
- { fieldName: "email" },
- { fieldName: "country" },
- ],
- },
- ],
- },
- {
- description: `Disabled field and field with tabindex="-1" is considered unfocusable`,
-
- fixtureData: `
- <html>
- <body>
- <form>
- <input type="text" id="name" autocomplete="name" />
- <input type="text" id="tel" autocomplete="tel" />
- <input type="text" id="email" autocomplete="email" />
- <input type="text" id="country" autocomplete="country" disabled/>
- <input type="text" id="postal-code" autocomplete="postal-code" tabindex="-1"/>
- <input type="text" id="address-line1" autocomplete="address-line1" />
- <input type="text" id="address-line2" autocomplete="address-line2" />
- </form>
- </body>
- </html>
- `,
- expectedResult: [
- {
- default: {
- reason: "autocomplete",
- },
- fields: [
- { fieldName: "name" },
- { fieldName: "tel" },
- { fieldName: "email" },
- { fieldName: "address-line1" },
- { fieldName: "address-line2" },
- ],
- },
- ],
- },
-]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js
new file mode 100644
index 0000000000..f775d7e5fb
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js
@@ -0,0 +1,131 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description: `Create a new section when the section already has a field with the same field name`,
+ fixtureData: `
+ <html><body>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" autocomplete="cc-exp"/>
+ <input type="text" autocomplete="cc-exp"/>
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp" },
+ ],
+ },
+ {
+ fields: [{ fieldName: "cc-exp", reason: "autocomplete" }],
+ },
+ ],
+ },
+ {
+ description: `Do not create a new section for an invisible field`,
+ fixtureData: `
+ <html><body>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" autocomplete="cc-exp"/>
+ <input type="text" autocomplete="cc-exp" style="display:none"/>
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp" },
+ { fieldName: "cc-exp" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Do not create a new section when the field with the same field name is an invisible field`,
+ fixtureData: `
+ <html><body>
+ <input type="text" autocomplete="cc-number""/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" autocomplete="cc-exp" style="display:none"/>
+ <input type="text" autocomplete="cc-exp"/>
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp" },
+ { fieldName: "cc-exp" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Do not create a new section for an invisible field (match field is not adjacent)`,
+ fixtureData: `
+ <html><body>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" autocomplete="cc-exp"/>
+ <input type="text" autocomplete="cc-number" style="display:none"/>
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp" },
+ { fieldName: "cc-number" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Do not create a new section when the field with the same field name is an invisible field (match field is not adjacent)`,
+ fixtureData: `
+ <html><body>
+ <input type="text" autocomplete="cc-number" style="display:none"/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" autocomplete="cc-exp"/>
+ <input type="text" autocomplete="cc-number"/>
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp" },
+ { fieldName: "cc-number" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js
index cd9757bd35..947757ed17 100644
--- a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js
@@ -16,6 +16,8 @@ add_heuristic_tests(
//{ fieldName: "cc-cvc" },
{ fieldName: "cc-exp-month" },
{ fieldName: "cc-exp-year" },
+ { fieldName: "cc-number", reason: "regex-heuristic" }, // invisible
+ { fieldName: "cc-number", reason: "regex-heuristic" }, // invisible
],
},
{
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js
index 46e5ecef3c..34a1953157 100644
--- a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js
@@ -35,9 +35,16 @@ add_heuristic_tests(
reason: "autocomplete",
},
fields: [
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
{ fieldName: "cc-number", reason: "fathom" },
- { fieldName: "cc-exp-month", reason: "regex-heuristic" },
- { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" }, // invisible
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" }, // invisible
],
},
],
diff --git a/browser/extensions/formautofill/test/fixtures/autocomplete_iframe_sandboxed.html b/browser/extensions/formautofill/test/fixtures/autocomplete_iframe_sandboxed.html
new file mode 100644
index 0000000000..bdad6d8f76
--- /dev/null
+++ b/browser/extensions/formautofill/test/fixtures/autocomplete_iframe_sandboxed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Form Autofill With Remote IFrame Demo Page</title>
+</head>
+<body>
+ <iframe src="https://test1.example.com:443/browser/browser/extensions/formautofill/test/browser/autocomplete_basic.html" sandbox width="400" height="400">
+ </iframe>
+</body>
+</html>
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
index 3d8049f053..a1a3322c4e 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
@@ -69,7 +69,6 @@ async function checkIsFormCleared(patch = {}) {
const expectedValue = patch[elem.id] || "";
checkFieldValue(elem, expectedValue);
await checkFieldHighlighted(elem, false);
- await checkFieldPreview(elem, "");
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
index 4fc989a36e..6ebef3bba1 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
@@ -54,7 +54,6 @@ async function checkIsFormCleared(patch = {}) {
const expectedValue = patch[elem.id] || "";
checkFieldValue(elem, expectedValue);
await checkFieldHighlighted(elem, false);
- await checkFieldPreview(elem, "");
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
index 6b0d7a522c..a6d0572ac6 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
@@ -72,9 +72,7 @@ async function checkMultipleCCNumberFormStyle(profile, isPreviewing = true) {
} else {
fillableValue = profile[element.id];
}
- let previewValue = (isPreviewing && fillableValue) || "";
await checkFieldHighlighted(element, !!fillableValue);
- await checkFieldPreview(element, previewValue);
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/formautofill_common.js b/browser/extensions/formautofill/test/mochitest/formautofill_common.js
index 6dbfa7c918..6cdf9ca86b 100644
--- a/browser/extensions/formautofill/test/mochitest/formautofill_common.js
+++ b/browser/extensions/formautofill/test/mochitest/formautofill_common.js
@@ -104,27 +104,6 @@ async function checkFieldHighlighted(elem, expectedValue) {
is(isHighlightApplied, expectedValue, `Checking #${elem.id} highlight style`);
}
-async function checkFieldPreview(elem, expectedValue) {
- is(
- SpecialPowers.wrap(elem).previewValue,
- expectedValue,
- `Checking #${elem.id} previewValue`
- );
- let isTextColorApplied;
- await SimpleTest.promiseWaitForCondition(function checkPreview() {
- const computedStyle = window.getComputedStyle(elem);
- const actualColor = computedStyle.getPropertyValue("color");
- if (elem.disabled) {
- isTextColorApplied = actualColor !== defaultDisabledTextColor;
- } else {
- isTextColorApplied = actualColor !== defaultTextColor;
- }
- return isTextColorApplied === !!expectedValue;
- }, `Checking #${elem.id} preview style`);
-
- is(isTextColorApplied, !!expectedValue, `Checking #${elem.id} preview style`);
-}
-
async function checkFormFieldsStyle(profile, isPreviewing = true) {
const elems = document.querySelectorAll("input, select");
@@ -143,7 +122,6 @@ async function checkFormFieldsStyle(profile, isPreviewing = true) {
(isPreviewing && fillableValue?.toString().replaceAll("*", "•")) || "";
}
await checkFieldHighlighted(elem, !!fillableValue);
- await checkFieldPreview(elem, previewValue);
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js b/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
index c133e535f5..97e62657d3 100644
--- a/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
+++ b/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
@@ -129,11 +129,11 @@ var ParentUtils = {
},
async operateAddress(type, msgData) {
- await this._operateRecord(ADDRESSES_COLLECTION_NAME, ...arguments);
+ await this._operateRecord(ADDRESSES_COLLECTION_NAME, type, msgData);
},
async operateCreditCard(type, msgData) {
- await this._operateRecord(CREDITCARDS_COLLECTION_NAME, ...arguments);
+ await this._operateRecord(CREDITCARDS_COLLECTION_NAME, type, msgData);
},
async cleanUpAddresses() {
@@ -145,11 +145,7 @@ var ParentUtils = {
return;
}
- await this.operateAddress(
- "remove",
- { guids },
- "FormAutofillTest:AddressesCleanedUp"
- );
+ await this.operateAddress("remove", { guids });
},
async cleanUpCreditCards() {
@@ -164,11 +160,7 @@ var ParentUtils = {
return;
}
- await this.operateCreditCard(
- "remove",
- { guids },
- "FormAutofillTest:CreditCardsCleanedUp"
- );
+ await this.operateCreditCard("remove", { guids });
},
setup() {
@@ -268,7 +260,7 @@ addMessageListener("FormAutofillTest:CheckAddresses", msg => {
return ParentUtils.checkAddresses(msg);
});
-addMessageListener("FormAutofillTest:CleanUpAddresses", msg => {
+addMessageListener("FormAutofillTest:CleanUpAddresses", _msg => {
return ParentUtils.cleanUpAddresses();
});
@@ -284,23 +276,21 @@ addMessageListener("FormAutofillTest:CheckCreditCards", msg => {
return ParentUtils.checkCreditCards(msg);
});
-addMessageListener("FormAutofillTest:CleanUpCreditCards", msg => {
+addMessageListener("FormAutofillTest:CleanUpCreditCards", _msg => {
return ParentUtils.cleanUpCreditCards();
});
-addMessageListener("FormAutofillTest:CanTestOSKeyStoreLogin", msg => {
+addMessageListener("FormAutofillTest:CanTestOSKeyStoreLogin", _msg => {
return { canTest: OSKeyStoreTestUtils.canTestOSKeyStoreLogin() };
});
-addMessageListener("FormAutofillTest:OSKeyStoreLogin", async msg => {
- await OSKeyStoreTestUtils.waitForOSKeyStoreLogin(msg.login);
-});
+addMessageListener("FormAutofillTest:OSKeyStoreLogin", msg =>
+ OSKeyStoreTestUtils.waitForOSKeyStoreLogin(msg.login)
+);
-addMessageListener("setup", async () => {
- ParentUtils.setup();
-});
+addMessageListener("setup", async _msg => ParentUtils.setup());
-addMessageListener("cleanup", async () => {
+addMessageListener("cleanup", async _msg => {
destroyed = true;
await ParentUtils.cleanup();
});
diff --git a/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html b/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
index 54efc83359..ab3c08e89a 100644
--- a/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
+++ b/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
@@ -47,9 +47,8 @@ add_task(async function check_switch_autofill_form_popup() {
checkMenuEntries(
[
`{"primary":"+13453453456","secondary":"123 Sesame Street."}`,
- `{"primary":"","secondary":"","categories":["organization","address","tel","name"],"focusedCategory":"tel"}`,
],
- false
+ true
);
await testMenuEntry(0, "!(el instanceof MozElements.MozAutocompleteRichlistitem)");
@@ -75,9 +74,8 @@ add_task(async function check_switch_autofill_form_popup_back() {
checkMenuEntries(
[
`{"primary":"+13453453456","secondary":"123 Sesame Street."}`,
- `{"primary":"","secondary":"","categories":["organization","address","tel","name"],"focusedCategory":"tel"}`,
],
- false
+ true
);
await testMenuEntry(0, "!(el instanceof MozElements.MozAutocompleteRichlistitem)");
diff --git a/browser/extensions/formautofill/test/mochitest/test_form_changes.html b/browser/extensions/formautofill/test/mochitest/test_form_changes.html
index 2eace91a53..1bfc655328 100644
--- a/browser/extensions/formautofill/test/mochitest/test_form_changes.html
+++ b/browser/extensions/formautofill/test/mochitest/test_form_changes.html
@@ -77,8 +77,7 @@ async function checkFormChangeHappened(formId) {
// Click on an autofilled field would show an autocomplete popup with "clear form" entry
checkMenuEntries([
JSON.stringify({primary: "", secondary: ""}), // Clear Autofill Form
- JSON.stringify({primary: "", secondary: ""}) // FormAutofill Preferemce
- ], false);
+ ], true);
// This is for checking the changes of element removed and added then.
document.querySelector(`#${formId} input[name=address-level2]`).remove();
diff --git a/browser/extensions/formautofill/test/unit/head.js b/browser/extensions/formautofill/test/unit/head.js
index 2448c7efff..efb9a65c19 100644
--- a/browser/extensions/formautofill/test/unit/head.js
+++ b/browser/extensions/formautofill/test/unit/head.js
@@ -71,24 +71,6 @@ region-name-tw = Taiwan
L10nRegistry.getInstance().registerSources([mockSource]);
}
-/**
- * Mock the return value of Services.focus.elementIsFocusable
- * since a field's focusability can't be tested in a unit test.
- */
-(function ignoreAFieldsFocusability() {
- let stub = sinon.stub(Services, "focus").get(() => {
- return {
- elementIsFocusable() {
- return true;
- },
- };
- });
-
- registerCleanupFunction(() => {
- stub.restore();
- });
-})();
-
do_get_profile();
const EXTENSION_ID = "formautofill@mozilla.org";
diff --git a/browser/extensions/formautofill/test/unit/test_autofillFormFields.js b/browser/extensions/formautofill/test/unit/test_autofillFormFields.js
index 49ffb0083a..be6b142195 100644
--- a/browser/extensions/formautofill/test/unit/test_autofillFormFields.js
+++ b/browser/extensions/formautofill/test/unit/test_autofillFormFields.js
@@ -423,6 +423,39 @@ const TESTCASES = [
},
{
description:
+ "Form with hidden input and visible input that share the same autocomplete attribute",
+ document: `<form>
+ <input id="hidden-cc" autocomplete="cc-number" hidden>
+ <input id="hidden-cc-2" autocomplete="cc-number" style="display:none">
+ <input id="visible-cc" autocomplete="cc-number">
+ <input id="hidden-name" autocomplete="cc-name" hidden>
+ <input id="hidden-name-2" autocomplete="cc-name" style="display:none">
+ <input id="visible-name" autocomplete="cc-name">
+ <input id="cc-exp-month" autocomplete="cc-exp-month">
+ <input id="cc-exp-year" autocomplete="cc-exp-year">
+ </form>`,
+ focusedInputId: "visible-cc",
+ profileData: {
+ guid: "123",
+ "cc-number": "4111111111111111",
+ "cc-name": "test name",
+ "cc-exp-month": 6,
+ "cc-exp-year": 25,
+ },
+ expectedResult: {
+ guid: "123",
+ "visible-cc": "4111111111111111",
+ "visible-name": "test name",
+ "cc-exp-month": "06",
+ "cc-exp-year": "25",
+ "hidden-cc": "4111111111111111",
+ "hidden-cc-2": "4111111111111111",
+ "hidden-name": "test name",
+ "hidden-name-2": "test name",
+ },
+ },
+ {
+ description:
"Fill credit card fields in a form where the value property is being used as a placeholder for cardholder name",
document: `<form>
<input id="cc-number" autocomplete="cc-number">
@@ -862,7 +895,7 @@ function do_test(testcases, testFn) {
// Replace the internal decrypt method with OSKeyStore API,
// but don't pass the reauth parameter to avoid triggering
// reauth login dialog in these tests.
- let decryptHelper = async (cipherText, reauth) => {
+ let decryptHelper = async (cipherText, _reauth) => {
return OSKeyStore.decrypt(cipherText, false);
};
handler.collectFormFields();
diff --git a/browser/extensions/formautofill/test/unit/test_getFormInputDetails.js b/browser/extensions/formautofill/test/unit/test_getFormInputDetails.js
index 18bd18b74a..cfcae8935d 100644
--- a/browser/extensions/formautofill/test/unit/test_getFormInputDetails.js
+++ b/browser/extensions/formautofill/test/unit/test_getFormInputDetails.js
@@ -1,11 +1,8 @@
"use strict";
-var FormAutofillContent;
-add_task(async function () {
- ({ FormAutofillContent } = ChromeUtils.importESModule(
- "resource://autofill/FormAutofillContent.sys.mjs"
- ));
-});
+const { FormStateManager } = ChromeUtils.importESModule(
+ "resource://gre/modules/shared/FormStateManager.sys.mjs"
+);
const TESTCASES = [
{
@@ -168,15 +165,16 @@ TESTCASES.forEach(testcase => {
for (let i in testcase.targetInput) {
let input = doc.getElementById(testcase.targetInput[i]);
- FormAutofillContent.identifyAutofillFields(input);
- FormAutofillContent.updateActiveInput(input);
+ const fsm = new FormStateManager();
+ fsm.updateActiveInput(input);
+ fsm.identifyAutofillFields(input);
// Put the input element reference to `element` to make sure the result of
// `activeFieldDetail` contains the same input element.
testcase.expectedResult[i].input.elementWeakRef = new WeakRef(input);
inputDetailAssertion(
- FormAutofillContent.activeFieldDetail,
+ fsm.activeFieldDetail,
testcase.expectedResult[i].input
);
@@ -193,7 +191,7 @@ TESTCASES.forEach(testcase => {
formDetail.elementWeakRef = new WeakRef(doc.querySelector(queryString));
}
- FormAutofillContent.activeFormDetails.forEach((detail, index) => {
+ fsm.activeFormDetails.forEach((detail, index) => {
inputDetailAssertion(detail, formDetails[index]);
});
}
diff --git a/browser/extensions/formautofill/test/unit/test_markAsAutofillField.js b/browser/extensions/formautofill/test/unit/test_markAsAutofillField.js
index 72960fcaf2..a170ff59a9 100644
--- a/browser/extensions/formautofill/test/unit/test_markAsAutofillField.js
+++ b/browser/extensions/formautofill/test/unit/test_markAsAutofillField.js
@@ -1,5 +1,9 @@
"use strict";
+const { FormStateManager } = ChromeUtils.importESModule(
+ "resource://gre/modules/shared/FormStateManager.sys.mjs"
+);
+
const TESTCASES = [
{
description: "Form containing 8 fields with autocomplete attribute.",
@@ -158,19 +162,6 @@ const TESTCASES = [
},
];
-let markedFieldId = [];
-
-var FormAutofillContent;
-add_setup(async () => {
- ({ FormAutofillContent } = ChromeUtils.importESModule(
- "resource://autofill/FormAutofillContent.sys.mjs"
- ));
-
- FormAutofillContent._markAsAutofillField = function (field) {
- markedFieldId.push(field.id);
- };
-});
-
TESTCASES.forEach(testcase => {
add_task(async function () {
info("Starting testcase: " + testcase.description);
@@ -179,17 +170,20 @@ TESTCASES.forEach(testcase => {
testcase.prefs.forEach(pref => SetPref(pref[0], pref[1]));
}
- markedFieldId = [];
-
- let doc = MockDocument.createTestDocument(
+ const doc = MockDocument.createTestDocument(
"http://localhost:8080/test/",
testcase.document
);
- let element = doc.getElementById(testcase.targetElementId);
- FormAutofillContent.identifyAutofillFields(element);
+ const element = doc.getElementById(testcase.targetElementId);
+
+ const fsm = new FormStateManager();
+ fsm.updateActiveInput(element);
+
+ const identifiedFields = fsm.identifyAutofillFields(element);
+ const identifiedFieldIds = identifiedFields.map(x => x.element.id);
Assert.deepEqual(
- markedFieldId,
+ identifiedFieldIds,
testcase.expectedResult,
"Check the fields were marked correctly."
);
diff --git a/browser/extensions/formautofill/test/unit/test_onFormSubmitted.js b/browser/extensions/formautofill/test/unit/test_onFormSubmitted.js
deleted file mode 100644
index 484112cc86..0000000000
--- a/browser/extensions/formautofill/test/unit/test_onFormSubmitted.js
+++ /dev/null
@@ -1,712 +0,0 @@
-"use strict";
-
-var FormAutofillContent;
-add_setup(async () => {
- ({ FormAutofillContent } = ChromeUtils.importESModule(
- "resource://autofill/FormAutofillContent.sys.mjs"
- ));
-});
-
-const DEFAULT_TEST_DOC = `<form id="form1">
- <input id="street-addr" autocomplete="street-address">
- <select id="address-level1" autocomplete="address-level1">
- <option value=""></option>
- <option value="AL">Alabama</option>
- <option value="AK">Alaska</option>
- <option value="AP">Armed Forces Pacific</option>
-
- <option value="ca">california</option>
- <option value="AR">US-Arkansas</option>
- <option value="US-CA">California</option>
- <option value="CA">California</option>
- <option value="US-AZ">US_Arizona</option>
- <option value="Ariz">Arizonac</option>
- </select>
- <input id="city" autocomplete="address-level2">
- <input id="country" autocomplete="country">
- <input id="email" autocomplete="email">
- <input id="tel" autocomplete="tel">
- <input id="cc-name" autocomplete="cc-name">
- <input id="cc-number" autocomplete="cc-number">
- <input id="cc-exp-month" autocomplete="cc-exp-month">
- <input id="cc-exp-year" autocomplete="cc-exp-year">
- <select id="cc-type">
- <option value="">Select</option>
- <option value="visa">Visa</option>
- <option value="mastercard">Master Card</option>
- <option value="amex">American Express</option>
- </select>
- <input id="submit" type="submit">
- </form>`;
-const TARGET_ELEMENT_ID = "street-addr";
-
-const TESTCASES = [
- {
- description:
- "Should not trigger address saving if the number of fields is less than 3",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "street-addr": "331 E. Evelyn Avenue",
- tel: "1-650-903-0800",
- },
- expectedResult: {
- formSubmission: false,
- },
- },
- {
- description: "Should not trigger credit card saving if number is empty",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "cc-name": "John Doe",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- },
- expectedResult: {
- formSubmission: false,
- },
- },
- {
- description:
- "Should not trigger credit card saving if there is more than one cc-number field but less than four fields",
- document: `<form id="form1">
- <input id="cc-type" autocomplete="cc-type">
- <input id="cc-name" autocomplete="cc-name">
- <input id="cc-number1" maxlength="4">
- <input id="cc-number2" maxlength="4">
- <input id="cc-number3" maxlength="4">
- <input id="cc-exp-month" autocomplete="cc-exp-month">
- <input id="cc-exp-year" autocomplete="cc-exp-year">
- <input id="submit" type="submit">
- </form>
- `,
- targetElementId: "cc-name",
- formValue: {
- "cc-name": "John Doe",
- "cc-number1": "3714",
- "cc-number2": "4963",
- "cc-number3": "5398",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "amex",
- },
- expectedResult: {
- formSubmission: false,
- },
- },
- {
- description: "Trigger address saving",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- tel: "1-650-903-0800",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- email: "",
- tel: "1-650-903-0800",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Trigger credit card saving",
- document: DEFAULT_TEST_DOC,
- targetElementId: "cc-type",
- formValue: {
- "cc-name": "John Doe",
- "cc-number": "5105105105105100",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "amex",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [],
- creditCard: [
- {
- guid: null,
- record: {
- "cc-name": "John Doe",
- "cc-number": "5105105105105100",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "amex",
- },
- untouchedFields: [],
- },
- ],
- },
- },
- },
- {
- description: "Trigger credit card saving using multiple cc-number fields",
- document: `<form id="form1">
- <input id="cc-type" autocomplete="cc-type">
- <input id="cc-name" autocomplete="cc-name">
- <input id="cc-number1" maxlength="4">
- <input id="cc-number2" maxlength="4">
- <input id="cc-number3" maxlength="4">
- <input id="cc-number4" maxlength="4">
- <input id="cc-exp-month" autocomplete="cc-exp-month">
- <input id="cc-exp-year" autocomplete="cc-exp-year">
- <input id="submit" type="submit">
- </form>`,
- targetElementId: "cc-type",
- formValue: {
- "cc-name": "John Doe",
- "cc-number1": "3714",
- "cc-number2": "4963",
- "cc-number3": "5398",
- "cc-number4": "431",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "amex",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [],
- creditCard: [
- {
- guid: null,
- record: {
- "cc-name": "John Doe",
- "cc-number": "371449635398431",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "amex",
- },
- untouchedFields: [],
- },
- ],
- },
- },
- },
- {
- description: "Trigger address and credit card saving",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- tel: "1-650-903-0800",
- "cc-name": "John Doe",
- "cc-number": "5105105105105100",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "visa",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- email: "",
- tel: "1-650-903-0800",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [
- {
- guid: null,
- record: {
- "cc-name": "John Doe",
- "cc-number": "5105105105105100",
- "cc-exp-month": 12,
- "cc-exp-year": 2000,
- "cc-type": "visa",
- },
- untouchedFields: [],
- },
- ],
- },
- },
- },
- {
- description: "Profile saved with trimmed string",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "street-addr": "331 E. Evelyn Avenue ",
- country: "US",
- tel: " 1-650-903-0800",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- email: "",
- tel: "1-650-903-0800",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Eliminate the field that is empty after trimmed",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- email: " ",
- tel: "1-650-903-0800",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- email: "",
- tel: "1-650-903-0800",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Save state with regular select option",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "CA",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "CA",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Save state with lowercase value",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "ca",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "CA",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Save state with a country code prefixed to the label",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "AR",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "AR",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Save state with a country code prefixed to the value",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "US-CA",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "CA",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description:
- "Save state with a country code prefixed to the value and label",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "US-AZ",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "AZ",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description:
- "Should save select label instead when failed to abbreviate the value",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "Ariz",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "address-level1": "Arizonac",
- "address-level2": "",
- "street-address": "331 E. Evelyn Avenue",
- country: "US",
- email: "",
- tel: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Shouldn't save select with multiple selections",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": ["AL", "AK", "AP"],
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- tel: "1-650-903-0800",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- tel: "1-650-903-0800",
- email: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
- {
- description: "Shouldn't save select with empty value",
- document: DEFAULT_TEST_DOC,
- targetElementId: TARGET_ELEMENT_ID,
- formValue: {
- "address-level1": "",
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- tel: "1-650-903-0800",
- },
- expectedResult: {
- formSubmission: true,
- records: {
- address: [
- {
- guid: null,
- record: {
- "street-address": "331 E. Evelyn Avenue",
- "address-level1": "",
- "address-level2": "",
- country: "US",
- tel: "1-650-903-0800",
- email: "",
- },
- untouchedFields: [],
- },
- ],
- creditCard: [],
- },
- },
- },
-];
-
-add_task(async function handle_invalid_form() {
- info("Starting testcase: Test an invalid form element");
- let doc = MockDocument.createTestDocument(
- "http://localhost:8080/test",
- DEFAULT_TEST_DOC
- );
- let fakeForm = doc.createElement("form");
- sinon.spy(FormAutofillContent, "_onFormSubmit");
-
- FormAutofillContent.formSubmitted(fakeForm, undefined, null);
- Assert.equal(FormAutofillContent._onFormSubmit.called, false);
- FormAutofillContent._onFormSubmit.restore();
-});
-
-add_task(async function autofill_disabled() {
- let doc = MockDocument.createTestDocument(
- "http://localhost:8080/test",
- DEFAULT_TEST_DOC
- );
- let form = doc.getElementById("form1");
- form.reset();
-
- let testcase = {
- "street-addr": "331 E. Evelyn Avenue",
- country: "US",
- tel: "+16509030800",
- "cc-number": "1111222233334444",
- };
- for (let key in testcase) {
- let input = doc.getElementById(key);
- input.value = testcase[key];
- }
-
- let element = doc.getElementById(TARGET_ELEMENT_ID);
- FormAutofillContent.identifyAutofillFields(element);
-
- sinon.stub(FormAutofillContent, "_onFormSubmit");
-
- // "_onFormSubmit" shouldn't be called if both "addresses" and "creditCards"
- // are disabled.
- Services.prefs.setBoolPref(
- "extensions.formautofill.addresses.enabled",
- false
- );
- Services.prefs.setBoolPref(
- "extensions.formautofill.creditCards.enabled",
- false
- );
- FormAutofillContent.formSubmitted(form, undefined, null);
- Assert.equal(FormAutofillContent._onFormSubmit.called, false);
- FormAutofillContent._onFormSubmit.resetHistory();
-
- // "_onFormSubmit" should be called as usual.
- Services.prefs.clearUserPref("extensions.formautofill.addresses.enabled");
- Services.prefs.clearUserPref("extensions.formautofill.creditCards.enabled");
-
- Services.prefs.setBoolPref(
- "extensions.formautofill.creditCards.enabled",
- true
- );
-
- FormAutofillContent.formSubmitted(form, undefined, null);
- Assert.equal(FormAutofillContent._onFormSubmit.called, true);
- Assert.notDeepEqual(FormAutofillContent._onFormSubmit.args[0][0].address, []);
- Assert.notDeepEqual(
- FormAutofillContent._onFormSubmit.args[0][0].creditCard,
- []
- );
- FormAutofillContent._onFormSubmit.resetHistory();
-
- // "address" should be empty if "addresses" pref is disabled.
- Services.prefs.setBoolPref(
- "extensions.formautofill.addresses.enabled",
- false
- );
- FormAutofillContent.formSubmitted(form, undefined, null);
- Assert.equal(FormAutofillContent._onFormSubmit.called, true);
- Assert.deepEqual(FormAutofillContent._onFormSubmit.args[0][0].address, []);
- Assert.notDeepEqual(
- FormAutofillContent._onFormSubmit.args[0][0].creditCard,
- []
- );
- FormAutofillContent._onFormSubmit.resetHistory();
- Services.prefs.clearUserPref("extensions.formautofill.addresses.enabled");
-
- // "creditCard" should be empty if "creditCards" pref is disabled.
- Services.prefs.setBoolPref(
- "extensions.formautofill.creditCards.enabled",
- false
- );
- FormAutofillContent.formSubmitted(form, undefined, null);
- Assert.deepEqual(FormAutofillContent._onFormSubmit.called, true);
- Assert.notDeepEqual(FormAutofillContent._onFormSubmit.args[0][0].address, []);
- Assert.deepEqual(FormAutofillContent._onFormSubmit.args[0][0].creditCard, []);
- FormAutofillContent._onFormSubmit.resetHistory();
- Services.prefs.clearUserPref("extensions.formautofill.creditCards.enabled");
-
- FormAutofillContent._onFormSubmit.restore();
-});
-
-TESTCASES.forEach(testcase => {
- add_task(async function check_records_saving_is_called_correctly() {
- info("Starting testcase: " + testcase.description);
-
- Services.prefs.setBoolPref(
- "extensions.formautofill.creditCards.enabled",
- true
- );
- let doc = MockDocument.createTestDocument(
- "http://localhost:8080/test/",
- testcase.document
- );
- let form = doc.getElementById("form1");
- form.reset();
- for (let key in testcase.formValue) {
- let input = doc.getElementById(key);
- let value = testcase.formValue[key];
- if (ChromeUtils.getClassName(input) === "HTMLSelectElement" && value) {
- input.multiple = Array.isArray(value);
- [...input.options].forEach(option => {
- option.selected = value.includes(option.value);
- });
- } else {
- input.value = testcase.formValue[key];
- }
- }
- sinon.stub(FormAutofillContent, "_onFormSubmit");
-
- let element = doc.getElementById(testcase.targetElementId);
- FormAutofillContent.identifyAutofillFields(element);
- FormAutofillContent.formSubmitted(form, undefined, null);
-
- Assert.equal(
- FormAutofillContent._onFormSubmit.called,
- testcase.expectedResult.formSubmission,
- "Check expected onFormSubmit.called"
- );
- if (FormAutofillContent._onFormSubmit.called) {
- for (let ccRecord of FormAutofillContent._onFormSubmit.args[0][0]
- .creditCard) {
- delete ccRecord.flowId;
- }
- for (let addrRecord of FormAutofillContent._onFormSubmit.args[0][0]
- .address) {
- delete addrRecord.flowId;
- }
-
- Assert.deepEqual(
- FormAutofillContent._onFormSubmit.args[0][0],
- testcase.expectedResult.records
- );
- }
- FormAutofillContent._onFormSubmit.restore();
- Services.prefs.clearUserPref("extensions.formautofill.creditCards.enabled");
- });
-});
diff --git a/browser/extensions/formautofill/test/unit/test_phoneNumber.js b/browser/extensions/formautofill/test/unit/test_phoneNumber.js
index 1c1d67e166..133e54f6d7 100644
--- a/browser/extensions/formautofill/test/unit/test_phoneNumber.js
+++ b/browser/extensions/formautofill/test/unit/test_phoneNumber.js
@@ -7,10 +7,10 @@
var PhoneNumber, PhoneNumberNormalizer;
add_setup(async () => {
({ PhoneNumber } = ChromeUtils.importESModule(
- "resource://autofill/phonenumberutils/PhoneNumber.sys.mjs"
+ "resource://gre/modules/shared/PhoneNumber.sys.mjs"
));
({ PhoneNumberNormalizer } = ChromeUtils.importESModule(
- "resource://autofill/phonenumberutils/PhoneNumberNormalizer.sys.mjs"
+ "resource://gre/modules/shared/PhoneNumberNormalizer.sys.mjs"
));
});
diff --git a/browser/extensions/formautofill/test/unit/test_previewFormFields.js b/browser/extensions/formautofill/test/unit/test_previewFormFields.js
index 1b1a01860d..b5ca7e5dfc 100644
--- a/browser/extensions/formautofill/test/unit/test_previewFormFields.js
+++ b/browser/extensions/formautofill/test/unit/test_previewFormFields.js
@@ -152,7 +152,7 @@ function run_tests(testcases) {
// Replace the internal decrypt method with OSKeyStore API,
// but don't pass the reauth parameter to avoid triggering
// reauth login dialog in these tests.
- let decryptHelper = async (cipherText, reauth) => {
+ let decryptHelper = async (cipherText, _reauth) => {
return OSKeyStore.decrypt(cipherText, false);
};
handler.collectFormFields();
diff --git a/browser/extensions/formautofill/test/unit/test_storage_tombstones.js b/browser/extensions/formautofill/test/unit/test_storage_tombstones.js
index 584dac8043..d0365d8f11 100644
--- a/browser/extensions/formautofill/test/unit/test_storage_tombstones.js
+++ b/browser/extensions/formautofill/test/unit/test_storage_tombstones.js
@@ -109,7 +109,7 @@ add_storage_task(async function test_simple_synctombstone(storage, record) {
do_check_tombstone_record(tombstoneInDisk);
});
-add_storage_task(async function test_add_tombstone(storage, record) {
+add_storage_task(async function test_add_tombstone(storage, _record) {
info("Should be able to add a new tombstone");
let guid = await storage.add({ guid: "test-guid-1", deleted: true });
@@ -136,7 +136,7 @@ add_storage_task(async function test_add_tombstone(storage, record) {
add_storage_task(async function test_add_tombstone_without_guid(
storage,
- record
+ _record
) {
info("Should not be able to add a new tombstone without specifying the guid");
await Assert.rejects(storage.add({ deleted: true }), /Record missing GUID/);
@@ -164,7 +164,7 @@ add_storage_task(async function test_add_tombstone_existing_guid(
);
});
-add_storage_task(async function test_update_tombstone(storage, record) {
+add_storage_task(async function test_update_tombstone(storage, _record) {
info("Updating a tombstone should fail");
let guid = await storage.add({ guid: "test-guid-1", deleted: true });
await Assert.rejects(storage.update(guid, {}), /No matching record./);
@@ -172,7 +172,7 @@ add_storage_task(async function test_update_tombstone(storage, record) {
add_storage_task(async function test_remove_existing_tombstone(
storage,
- record
+ _record
) {
info("Removing a record that's already a tombstone should be a no-op");
let guid = await storage.add({
diff --git a/browser/extensions/formautofill/test/unit/xpcshell.toml b/browser/extensions/formautofill/test/unit/xpcshell.toml
index f63ac60e58..dccc27fa63 100644
--- a/browser/extensions/formautofill/test/unit/xpcshell.toml
+++ b/browser/extensions/formautofill/test/unit/xpcshell.toml
@@ -6,6 +6,9 @@ skip-if = [
firefox-appdir = "browser"
head = "head.js"
support-files = ["../fixtures/**"]
+prefs = [
+ "extensions.formautofill.test.ignoreVisibilityCheck=true",
+]
["test_activeStatus.js"]
@@ -98,9 +101,6 @@ skip-if = ["tsan"] # Times out, bug 1612707
["test_nameUtils.js"]
-["test_onFormSubmitted.js"]
-skip-if = ["tsan"] # Times out, bug 1612707
-
["test_parseAddressFormat.js"]
["test_parseStreetAddress.js"]
diff --git a/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js b/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
index 9a2a3e14b8..991093ba6f 100644
--- a/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
+++ b/browser/extensions/pictureinpicture/experiment-apis/pictureInPicture.js
@@ -22,10 +22,9 @@ this.pictureInPictureParent = class extends ExtensionAPI {
* Override ExtensionAPI with PiP override's specific API
* Relays the site overrides to this extension's child process
*
- * @param {ExtensionContext} context the context of our extension
* @returns {object} returns the necessary API structure required to manage sharedData in PictureInPictureParent
*/
- getAPI(context) {
+ getAPI() {
return {
pictureInPictureParent: {
setOverrides(overrides) {
diff --git a/browser/extensions/pictureinpicture/video-wrappers/airmozilla.js b/browser/extensions/pictureinpicture/video-wrappers/airmozilla.js
index d2e98cbe48..a669154a44 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/airmozilla.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/airmozilla.js
@@ -35,7 +35,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container?.querySelector("#overlayCaption").innerText;
if (!text) {
diff --git a/browser/extensions/pictureinpicture/video-wrappers/arte.js b/browser/extensions/pictureinpicture/video-wrappers/arte.js
index 3d1df1f65f..c8bbec2855 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/arte.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/arte.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let textNodeList = container.querySelectorAll(".avp-captions-line");
if (!textNodeList.length) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/bbc.js b/browser/extensions/pictureinpicture/video-wrappers/bbc.js
index a5adcbc534..cc8c5daa5c 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/bbc.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/bbc.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(".p_cueDirUniWrapper")?.innerText;
updateCaptionsFunction(text);
};
diff --git a/browser/extensions/pictureinpicture/video-wrappers/dailymotion.js b/browser/extensions/pictureinpicture/video-wrappers/dailymotion.js
index 161f1ec516..75f8db5e19 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/dailymotion.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/dailymotion.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let textNodeList = container
?.querySelector(".subtitles")
?.querySelectorAll("div");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/disneyplus.js b/browser/extensions/pictureinpicture/video-wrappers/disneyplus.js
index bb5c55e0cb..a15bda727a 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/disneyplus.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/disneyplus.js
@@ -41,7 +41,7 @@ class PictureInPictureVideoWrapper {
container = document.querySelector(".shaka-text-container");
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let textNodeList = container?.querySelectorAll("span");
if (!textNodeList) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/edx.js b/browser/extensions/pictureinpicture/video-wrappers/edx.js
index 07a3d9f302..5e9126ad4c 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/edx.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/edx.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(
".closed-captions.is-visible"
)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/hbomax.js b/browser/extensions/pictureinpicture/video-wrappers/hbomax.js
index 8aff3e0077..5566f1e0b8 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/hbomax.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/hbomax.js
@@ -25,7 +25,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(
'[data-testid="CueBoxContainer"]'
)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/hotstar.js b/browser/extensions/pictureinpicture/video-wrappers/hotstar.js
index c6b45b1a0a..3d366f77a4 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/hotstar.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/hotstar.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let textNodeList = container?.querySelectorAll("span");
if (!textNodeList) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/hulu.js b/browser/extensions/pictureinpicture/video-wrappers/hulu.js
index fdaf6d7c18..000e8f661b 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/hulu.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/hulu.js
@@ -32,7 +32,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
// This will get the subtitles for both live and regular playback videos
// and combine them to display. liveVideoText should be an empty string
// when the video is regular playback and vice versa. If both
@@ -63,7 +63,7 @@ class PictureInPictureVideoWrapper {
});
}
}
- getDuration(video) {
+ getDuration() {
return this.player.duration;
}
}
diff --git a/browser/extensions/pictureinpicture/video-wrappers/mock-wrapper.js b/browser/extensions/pictureinpicture/video-wrappers/mock-wrapper.js
index b68ce3fa9b..c179ed1084 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/mock-wrapper.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/mock-wrapper.js
@@ -5,12 +5,12 @@
"use strict";
class PictureInPictureVideoWrapper {
- play(video) {
+ play() {
let playPauseButton = document.querySelector("#player .play-pause-button");
playPauseButton.click();
}
- pause(video) {
+ pause() {
let invalidSelector = "#player .pause-button";
let playPauseButton = document.querySelector(invalidSelector);
playPauseButton.click();
diff --git a/browser/extensions/pictureinpicture/video-wrappers/netflix.js b/browser/extensions/pictureinpicture/video-wrappers/netflix.js
index e33fe23a24..7458da4447 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/netflix.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/netflix.js
@@ -22,20 +22,18 @@ class PictureInPictureVideoWrapper {
* The Netflix player returns the current time in milliseconds so we convert
* to seconds before returning.
*
- * @param {HTMLVideoElement} video The original video element
* @returns {number} The current time in seconds
*/
- getCurrentTime(video) {
+ getCurrentTime() {
return this.player.getCurrentTime() / 1000;
}
/**
* The Netflix player returns the duration in milliseconds so we convert to
* seconds before returning.
*
- * @param {HTMLVideoElement} video The original video element
* @returns {number} The duration in seconds
*/
- getDuration(video) {
+ getDuration() {
return this.player.getDuration() / 1000;
}
play() {
@@ -50,7 +48,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(".player-timedtext").innerText;
updateCaptionsFunction(text);
};
diff --git a/browser/extensions/pictureinpicture/video-wrappers/nytimes.js b/browser/extensions/pictureinpicture/video-wrappers/nytimes.js
index 4f6d8cbe44..8e3e6b0985 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/nytimes.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/nytimes.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(".cueWrap-2P4Ue4VQ")?.innerText;
if (!text) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/piped.js b/browser/extensions/pictureinpicture/video-wrappers/piped.js
index 1cc1c32eb2..738fa973c6 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/piped.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/piped.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let textNodeList = container
.querySelector(".shaka-text-wrapper")
?.querySelectorAll('span[style="background-color: black;"]');
diff --git a/browser/extensions/pictureinpicture/video-wrappers/primeVideo.js b/browser/extensions/pictureinpicture/video-wrappers/primeVideo.js
index 28a2bd1575..1d23903102 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/primeVideo.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/primeVideo.js
@@ -57,7 +57,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function (mutationsList) {
// eslint-disable-next-line no-unused-vars
for (const mutation of mutationsList) {
let text;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/sonyliv.js b/browser/extensions/pictureinpicture/video-wrappers/sonyliv.js
index b703aaec2c..44e7b82165 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/sonyliv.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/sonyliv.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(
`.text-track-wrapper:not([style*="display: none"])`
)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/tubi.js b/browser/extensions/pictureinpicture/video-wrappers/tubi.js
index 291dbfddeb..c31cdca3d4 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/tubi.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/tubi.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container?.querySelector(
`[data-id="captionsComponent"]:not([style="display: none;"])`
)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/tubilive.js b/browser/extensions/pictureinpicture/video-wrappers/tubilive.js
index 0de748e717..02ec876cac 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/tubilive.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/tubilive.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text =
container.querySelector(`.tubi-text-track-container`)?.innerText ||
container.querySelector(`.subtitleWindow`)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/twitch.js b/browser/extensions/pictureinpicture/video-wrappers/twitch.js
index 1dd7567c24..0c339d063d 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/twitch.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/twitch.js
@@ -5,7 +5,7 @@
"use strict";
class PictureInPictureVideoWrapper {
- isLive(video) {
+ isLive() {
return !document.querySelector(".seekbar-bar");
}
getDuration(video) {
diff --git a/browser/extensions/pictureinpicture/video-wrappers/udemy.js b/browser/extensions/pictureinpicture/video-wrappers/udemy.js
index 09e3b989dc..ad28cb3248 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/udemy.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/udemy.js
@@ -37,7 +37,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(
`[data-purpose="captions-cue-text"]`
)?.innerText;
diff --git a/browser/extensions/pictureinpicture/video-wrappers/videojsWrapper.js b/browser/extensions/pictureinpicture/video-wrappers/videojsWrapper.js
index ca3145af4a..2e94c58f4e 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/videojsWrapper.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/videojsWrapper.js
@@ -11,7 +11,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector("div").innerText;
if (!text) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/voot.js b/browser/extensions/pictureinpicture/video-wrappers/voot.js
index 57d903a2e8..01d3e4e8d4 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/voot.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/voot.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(".playkit-subtitles").innerText;
if (!text) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/washingtonpost.js b/browser/extensions/pictureinpicture/video-wrappers/washingtonpost.js
index 6d0e57c96a..340306328c 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/washingtonpost.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/washingtonpost.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let subtitleElement = container.querySelector(".powa-sub-torpedo");
if (!subtitleElement?.innerText) {
updateCaptionsFunction("");
diff --git a/browser/extensions/pictureinpicture/video-wrappers/yahoo.js b/browser/extensions/pictureinpicture/video-wrappers/yahoo.js
index b7d8d3160f..1dd932bc37 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/yahoo.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/yahoo.js
@@ -10,7 +10,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function () {
let text = container.querySelector(".vp-cc-element.vp-show")?.innerText;
if (!text) {
diff --git a/browser/extensions/pictureinpicture/video-wrappers/youtube.js b/browser/extensions/pictureinpicture/video-wrappers/youtube.js
index 8b39e469f9..b704e711cc 100644
--- a/browser/extensions/pictureinpicture/video-wrappers/youtube.js
+++ b/browser/extensions/pictureinpicture/video-wrappers/youtube.js
@@ -14,7 +14,7 @@ class PictureInPictureVideoWrapper {
? shortsPlayer
: video.closest("#movie_player")?.wrappedJSObject;
}
- isLive(video) {
+ isLive() {
return !!document.querySelector(".ytp-live");
}
setMuted(video, shouldMute) {
@@ -39,7 +39,7 @@ class PictureInPictureVideoWrapper {
if (container) {
updateCaptionsFunction("");
- const callback = function (mutationsList, observer) {
+ const callback = function (mutationsList) {
// eslint-disable-next-line no-unused-vars
for (const mutation of mutationsList) {
let textNodeList = container
diff --git a/browser/extensions/report-site-issue/.eslintrc.js b/browser/extensions/report-site-issue/.eslintrc.js
index a20deab67f..f710dd2f24 100644
--- a/browser/extensions/report-site-issue/.eslintrc.js
+++ b/browser/extensions/report-site-issue/.eslintrc.js
@@ -27,9 +27,6 @@ module.exports = {
// Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 4],
- // Allow the console API aside from console.log.
- "no-console": ["error", { allow: ["error", "info", "trace", "warn"] }],
-
// Disallow use of multiline strings (use template strings instead).
"no-multi-str": "error",
diff --git a/browser/extensions/report-site-issue/background.js b/browser/extensions/report-site-issue/background.js
index d495f33c25..8c8234e52f 100644
--- a/browser/extensions/report-site-issue/background.js
+++ b/browser/extensions/report-site-issue/background.js
@@ -18,24 +18,34 @@ const androidReporterConfig = {
utm_source: "android-components-reporter",
};
-let reporterConfig = desktopReporterConfig;
+const getReporterConfig = (() => {
+ let promise;
+ return async () => {
+ promise ??= new Promise(resolve => {
+ browser.permissions
+ .contains({ permissions: ["nativeMessaging"] })
+ .then(needProductName => {
+ if (needProductName) {
+ const port = browser.runtime.connectNative(
+ "mozacWebcompatReporter"
+ );
+ port.onMessage.addListener(message => {
+ if ("productName" in message) {
+ androidReporterConfig.productName = message.productName;
+ resolve(androidReporterConfig);
-(async () => {
- const permissions = ["nativeMessaging"];
- if (await browser.permissions.contains({ permissions })) {
- reporterConfig = androidReporterConfig;
-
- const port = browser.runtime.connectNative("mozacWebcompatReporter");
- port.onMessage.addListener(message => {
- if ("productName" in message) {
- reporterConfig.productName = message.productName;
-
- // For now, setting the productName is the only use for this port, and that's only happening
- // once after startup, so let's disconnect the port when we're done.
- port.disconnect();
- }
+ // For now, setting the productName is the only use for this port, and that's only happening
+ // once after startup, so let's disconnect the port when we're done.
+ port.disconnect();
+ }
+ });
+ } else {
+ resolve(desktopReporterConfig);
+ }
+ });
});
- }
+ return promise;
+ };
})();
async function loadTab(url) {
@@ -60,6 +70,7 @@ async function captureAndSendReport(tab) {
try {
const { endpointUrl, webcompatInfo } =
await browser.tabExtras.getWebcompatInfo(id);
+ const reporterConfig = await getReporterConfig();
const dataToSend = {
endpointUrl,
reportUrl: url,
diff --git a/browser/extensions/report-site-issue/manifest.json b/browser/extensions/report-site-issue/manifest.json
index 5108716475..aadf7917c7 100644
--- a/browser/extensions/report-site-issue/manifest.json
+++ b/browser/extensions/report-site-issue/manifest.json
@@ -3,7 +3,7 @@
"name": "WebCompat Reporter",
"description": "Report site compatibility issues on webcompat.com",
"author": "Thomas Wisniewski <twisniewski@mozilla.com>",
- "version": "2.0.0",
+ "version": "2.1.0",
"homepage_url": "https://github.com/mozilla/webcompat-reporter",
"browser_specific_settings": {
"gecko": {
@@ -37,6 +37,8 @@
},
"permissions": ["tabs", "<all_urls>"],
"background": {
+ "persistent": false,
+ "type": "module",
"scripts": ["background.js"]
}
}
diff --git a/browser/extensions/report-site-issue/test/browser/head.js b/browser/extensions/report-site-issue/test/browser/head.js
index f4c74ab768..2af0485ff5 100644
--- a/browser/extensions/report-site-issue/test/browser/head.js
+++ b/browser/extensions/report-site-issue/test/browser/head.js
@@ -38,8 +38,6 @@ async function promiseAddonEnabled() {
}
class HelpMenuHelper {
- #popup = null;
-
async open() {
this.popup = document.getElementById("menu_HelpPopup");
ok(this.popup, "Help menu should exist");
diff --git a/browser/extensions/report-site-issue/test/browser/test.html b/browser/extensions/report-site-issue/test/browser/test.html
index ed1844f530..b8811d8227 100644
--- a/browser/extensions/report-site-issue/test/browser/test.html
+++ b/browser/extensions/report-site-issue/test/browser/test.html
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<script>
- /* eslint-disable no-console */
/* eslint-disable no-unused-expressions */
"use strict";
console.log(null);
diff --git a/browser/extensions/screenshots/test/browser/browser.toml b/browser/extensions/screenshots/test/browser/browser.toml
index 240471cc7d..9721a44689 100644
--- a/browser/extensions/screenshots/test/browser/browser.toml
+++ b/browser/extensions/screenshots/test/browser/browser.toml
@@ -1,5 +1,9 @@
[DEFAULT]
-prefs = ["extensions.screenshots.disabled=false",] # The Screenshots extension is disabled by default in Mochitests. We re-enable it here, since it's a more realistic configuration.
+# The Screenshots extension is disabled by default in Mochitests. We re-enable it here, since it's a more realistic configuration.
+prefs = [
+ "extensions.screenshots.disabled=false",
+ "screenshots.browser.component.enabled=false",
+]
["browser_screenshot_button.js"]
diff --git a/browser/extensions/search-detection/extension/api.js b/browser/extensions/search-detection/extension/api.js
index dd15b080ab..2eb7925104 100644
--- a/browser/extensions/search-detection/extension/api.js
+++ b/browser/extensions/search-detection/extension/api.js
@@ -61,7 +61,7 @@ this.addonsSearchDetection = class extends ExtensionAPI {
_urls
// We only want to collect "search URLs" (and not "suggestion"
- // ones for instance). See `URL_TYPE` in `SearchUtils.jsm`.
+ // ones for instance). See `URL_TYPE` in `SearchUtils.sys.mjs`.
.filter(({ type }) => type === "text/html")
.forEach(({ template }) => {
// If this is changed, double check the code in the background
@@ -116,7 +116,7 @@ this.addonsSearchDetection = class extends ExtensionAPI {
// search engines has changed, e.g., a new engine has been added or an
// engine has been removed.
//
- // See: https://searchfox.org/mozilla-central/source/toolkit/components/search/SearchUtils.jsm#145-152
+ // See: https://searchfox.org/mozilla-central/rev/cb44fc4f7bb84f2a18fedba64c8563770df13e34/toolkit/components/search/SearchUtils.sys.mjs#185-193
onSearchEngineModified: new ExtensionCommon.EventManager({
context,
name: "addonsSearchDetection.onSearchEngineModified",
diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js
index c541622914..87b1da747b 100644
--- a/browser/extensions/webcompat/data/injections.js
+++ b/browser/extensions/webcompat/data/injections.js
@@ -186,20 +186,6 @@ const AVAILABLE_INJECTIONS = [
},
},
{
- id: "bug1654877",
- platform: "android",
- domain: "preev.com",
- bug: "1654877",
- contentScripts: {
- matches: ["*://preev.com/*"],
- css: [
- {
- file: "injections/css/bug1654877-preev.com-moz-appearance-fix.css",
- },
- ],
- },
- },
- {
id: "bug1654907",
platform: "android",
domain: "reactine.ca",
@@ -214,24 +200,6 @@ const AVAILABLE_INJECTIONS = [
},
},
{
- id: "bug1631811",
- platform: "all",
- domain: "datastudio.google.com",
- bug: "1631811",
- contentScripts: {
- matches: [
- "https://datastudio.google.com/embed/reporting/*",
- "https://lookerstudio.google.com/embed/reporting/*",
- ],
- js: [
- {
- file: "injections/js/bug1631811-datastudio.google.com-indexedDB.js",
- },
- ],
- allFrames: true,
- },
- },
- {
id: "bug1694470",
platform: "android",
domain: "m.myvidster.com",
@@ -426,23 +394,6 @@ const AVAILABLE_INJECTIONS = [
},
},
{
- id: "bug1790750",
- platform: "all",
- domain: "relearnings.com",
- bug: "1790750",
- contentScripts: {
- matches: [
- "https://relearnings.com/linkedinlearning.html", // Bug 1790750
- ],
- js: [
- {
- file: "injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js",
- },
- ],
- allFrames: true,
- },
- },
- {
id: "bug1859617",
platform: "all",
domain: "Sites relying on there being no window.InstallTrigger",
@@ -557,11 +508,12 @@ const AVAILABLE_INJECTIONS = [
"*://*.avanabayview.com/*", // #118617
"*://*.breakpointeandcoronado.com/*", // #117735
"*://*.courtsatspringmill.com/*", // #128404
+ "*://*.fieldstoneamherst.com/*", // #132974
"*://*.gslbriarcreek.com/*", // #126401
+ "*://*.hpixeniatrails.com/*", // #131703
"*://*.liveatlasathens.com/*", // #111189
"*://*.liveobserverpark.com/*", // #105244
"*://*.liveupark.com/*", // #121083
- "*://*.metropolisapt.com/*", // #129105
"*://*.midwayurban.com/*", // #116523
"*://*.nhcalaska.com/*",
"*://*.prospectportal.com/*", // #115206
@@ -569,7 +521,6 @@ const AVAILABLE_INJECTIONS = [
"*://*.thefoundryat41st.com/*", // #128994
"*://*.theloftsorlando.com/*",
"*://*.vanallenapartments.com/*", // #120056
- "*://*.waterfordapartmentstulsa.com/*", // #125870
],
css: [
{
@@ -958,20 +909,6 @@ const AVAILABLE_INJECTIONS = [
},
},
{
- id: "bug1848716",
- platform: "desktop",
- domain: "elal.com",
- bug: "1848716",
- contentScripts: {
- matches: ["*://*.elal.com/*"],
- css: [
- {
- file: "injections/css/bug1848716-elal.com-unsupported-banner.css",
- },
- ],
- },
- },
- {
id: "bug1848849",
platform: "all",
domain: "theaa.com",
@@ -1091,6 +1028,34 @@ const AVAILABLE_INJECTIONS = [
],
},
},
+ {
+ id: "bug1877346",
+ platform: "android",
+ domain: "offerup.com",
+ bug: "1877346",
+ contentScripts: {
+ matches: ["*://offerup.com/*"],
+ css: [
+ {
+ file: "injections/css/bug1877346-offerup.com-infinite-scroll-fix.css",
+ },
+ ],
+ },
+ },
+ {
+ id: "bug1884842",
+ platform: "android",
+ domain: "foodora.cz",
+ bug: "1884842",
+ contentScripts: {
+ matches: ["*://*.foodora.cz/*"],
+ css: [
+ {
+ file: "injections/css/bug1884842-foodora.cz-height-fix.css",
+ },
+ ],
+ },
+ },
];
module.exports = AVAILABLE_INJECTIONS;
diff --git a/browser/extensions/webcompat/data/shims.js b/browser/extensions/webcompat/data/shims.js
index 16919dbec7..f26ad96d04 100644
--- a/browser/extensions/webcompat/data/shims.js
+++ b/browser/extensions/webcompat/data/shims.js
@@ -321,17 +321,6 @@ const AVAILABLE_SHIMS = [
onlyIfBlockedByETP: true,
},
{
- id: "PBMWebAPIFixes",
- platform: "all",
- name: "Private Browsing Web APIs",
- bug: "1773110",
- runFirst: "private-browsing-web-api-fixes.js",
- matches: [
- "*://*.imgur.io/js/vendor.*.js", // Mobile: imgur.io (bug 1742344); desktop: imgur.com (unaffected)
- ],
- onlyIfPrivateBrowsing: true,
- },
- {
id: "Eluminate",
platform: "all",
name: "Eluminate",
diff --git a/browser/extensions/webcompat/data/ua_overrides.js b/browser/extensions/webcompat/data/ua_overrides.js
index cabaed5bf9..3645e962f0 100644
--- a/browser/extensions/webcompat/data/ua_overrides.js
+++ b/browser/extensions/webcompat/data/ua_overrides.js
@@ -290,25 +290,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
- * Bug 1595215 - UA overrides for Uniqlo sites
- * Webcompat issue #38825 - https://webcompat.com/issues/38825
- *
- * To receive the proper mobile version instead of the desktop version or
- * avoid redirect loop, the UA is spoofed.
- */
- id: "bug1595215",
- platform: "android",
- domain: "uniqlo.com",
- bug: "1595215",
- config: {
- matches: ["*://*.uniqlo.com/*"],
- uaTransformer: originalUA => {
- return originalUA + " Mobile Safari";
- },
- },
- },
- {
- /*
* Bug 1622063 - UA override for wp1-ext.usps.gov
* Webcompat issue #29867 - https://webcompat.com/issues/29867
*
@@ -685,42 +666,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
- * Bug 1790698 - UA override for wolf777.com
- * Webcompat issue #103981 - https://webcompat.com/issues/103981
- *
- * Add 'Linux; ' next to the Android version or the site breaks
- */
- id: "bug1790698",
- platform: "android",
- domain: "wolf777.com",
- bug: "1790698",
- config: {
- matches: ["*://wolf777.com/*"],
- uaTransformer: originalUA => {
- return originalUA.replace("Android", "Linux; Android");
- },
- },
- },
- {
- /*
- * Bug 1800936 - UA override for cov19ent.kdca.go.kr
- * Webcompat issue #110655 - https://webcompat.com/issues/110655
- *
- * Add 'Chrome;' to the UA for the site to load styles
- */
- id: "bug1800936",
- platform: "all",
- domain: "cov19ent.kdca.go.kr",
- bug: "1800936",
- config: {
- matches: ["*://cov19ent.kdca.go.kr/*"],
- uaTransformer: originalUA => {
- return originalUA + " Chrome";
- },
- },
- },
- {
- /*
* Bug 1819702 - UA override for feelgoodcontacts.com
* Webcompat issue #118030 - https://webcompat.com/issues/118030
*
@@ -916,22 +861,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
- * Bug 1827678 - UA override for f2bbs.com
- * Webcompat issue #84932 - https://webcompat.com/issues/84932
- */
- id: "bug1827678-webc84932",
- platform: "android",
- domain: "f2bbs.com",
- bug: "1827678",
- config: {
- matches: ["*://f2bbs.com/*"],
- uaTransformer: originalUA => {
- return UAHelpers.getDeviceAppropriateChromeUA();
- },
- },
- },
- {
- /*
* Bug 1827678 - UA override for kt.com
* Webcompat issue #119012 - https://webcompat.com/issues/119012
*/
@@ -964,22 +893,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
- * Bug 1827678 - UA override for sistema.ibglbrasil.com.br
- * Webcompat issue #119785 - https://webcompat.com/issues/119785
- */
- id: "bug1827678-webc119785",
- platform: "all",
- domain: "sistema.ibglbrasil.com.br",
- bug: "1827678",
- config: {
- matches: ["*://sistema.ibglbrasil.com.br/*"],
- uaTransformer: originalUA => {
- return UAHelpers.getDeviceAppropriateChromeUA();
- },
- },
- },
- {
- /*
* Bug 1827678 - UA override for onp.cloud.waterloo.ca
* Webcompat issue #120450 - https://webcompat.com/issues/120450
*/
@@ -1053,23 +966,6 @@ const AVAILABLE_UA_OVERRIDES = [
},
{
/*
- * Bug 1751604 - UA override for /www.otsuka.co.jp/fib/
- *
- * The site's content is not loaded on mobile unless a Chrome UA is used.
- */
- id: "bug1829126",
- platform: "android",
- domain: "www.otsuka.co.jp",
- bug: "1829126",
- config: {
- matches: ["*://www.otsuka.co.jp/fib/*"],
- uaTransformer: originalUA => {
- return UAHelpers.getDeviceAppropriateChromeUA();
- },
- },
- },
- {
- /*
* Bug 1836109 - UA override for watch.tonton.com.my
*
* The site's content is not loaded unless a Chrome UA is used.
@@ -1298,6 +1194,8 @@ const AVAILABLE_UA_OVERRIDES = [
"*://thematiques.metro.fr/*",
"*://volantino.metro.it/*",
"*://view.publitas.com/*",
+ "*://magazine.kruidvat.be/*",
+ "*://folder.kruidvat.nl/*",
],
uaTransformer: originalUA => {
return UAHelpers.getDeviceAppropriateChromeUA();
@@ -1377,6 +1275,24 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
+ {
+ /*
+ * Bug 1884779 - UA override for
+ * Webcompat issue #134287 - https://webcompat.com/issues/134287
+ *
+ * The site returns desktop layout on Firefox for Android
+ */
+ id: "bug1884779",
+ platform: "android",
+ domain: "memurlar.net",
+ bug: "1884779",
+ config: {
+ matches: ["*://*.memurlar.net/*"],
+ uaTransformer: originalUA => {
+ return UAHelpers.getDeviceAppropriateChromeUA();
+ },
+ },
+ },
];
module.exports = AVAILABLE_UA_OVERRIDES;
diff --git a/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css b/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css
deleted file mode 100644
index b13c3052f3..0000000000
--- a/browser/extensions/webcompat/injections/css/bug1654877-preev.com-moz-appearance-fix.css
+++ /dev/null
@@ -1,19 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * preev.com - typed numbers are not fully visible
- * Bug #1654877 - https://bugzilla.mozilla.org/show_bug.cgi?id=1654877
- * WebCompat issue #55099 - https://webcompat.com/issues/55099
- *
- * It's hard to see the entered number because the spin button is
- * taking too much space. While there is -moz-appearance: textfield,
- * -webkit-appearance: none; underneath supersedes it,
- * leaving the spin button visible. Adding -moz-appearance: textfield;
- * as a separate rule fixes the issue
- */
-input[type="number"],
-input[type="text"] {
- -moz-appearance: textfield;
-}
diff --git a/browser/extensions/webcompat/injections/css/bug1848716-elal.com-unsupported-banner.css b/browser/extensions/webcompat/injections/css/bug1848716-elal.com-unsupported-banner.css
deleted file mode 100644
index 22c81e50c5..0000000000
--- a/browser/extensions/webcompat/injections/css/bug1848716-elal.com-unsupported-banner.css
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * www.elal.com - Firefox is an unsupported browser
- * Bug #1848716 - https://bugzilla.mozilla.org/show_bug.cgi?id=1848716
- * WebCompat issue #85474 - https://github.com/webcompat/web-bugs/issues/85474
- *
- * As everything seems to work just fine, this intervention simply hides the
- * banner.
- */
-
-.pnlOldBrowser {
- display: none !important;
-}
diff --git a/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css b/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css
new file mode 100644
index 0000000000..24681686f4
--- /dev/null
+++ b/browser/extensions/webcompat/injections/css/bug1877346-offerup.com-infinite-scroll-fix.css
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * offerup.com - Infinite scroll doesn't work
+ * Bug #1720060 - https://bugzilla.mozilla.org/show_bug.cgi?id=1720060
+ *
+ * The site uses IntersectionObserver to show new items on the page,
+ * as the page being scrolled and it doesn't work with with
+ * Dynamic Toolbar enabled. Adding an empty element after the content
+ * to make up for the height of the dynamic toolbar makes it work.
+ */
+
+#__next::after {
+ display: block;
+ width: 100%;
+ height: 10px;
+ content: "";
+}
diff --git a/browser/extensions/webcompat/injections/css/bug1884842-foodora.cz-height-fix.css b/browser/extensions/webcompat/injections/css/bug1884842-foodora.cz-height-fix.css
new file mode 100644
index 0000000000..eb43bc5203
--- /dev/null
+++ b/browser/extensions/webcompat/injections/css/bug1884842-foodora.cz-height-fix.css
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * foodora.cz - Unable to pick an address
+ * Bug #1884842 - https://bugzilla.mozilla.org/show_bug.cgi?id=1884842
+ * WebCompat issue #130975 - https://github.com/webcompat/web-bugs/issues/130975
+ *
+ * Unable to confirm an adress on the delivery site due to button being outside
+ * the viewport and parent container unscrollable.
+ * Depends on https://bugzilla.mozilla.org/show_bug.cgi?id=1481876
+ */
+
+@media (max-width: 527.98px) {
+ .bds-c-modal--is-mobile-bottom-sheet .bds-c-modal__content-window {
+ height: 100%;
+ }
+}
+
+@media (min-height: 528px) {
+ .map-modal__map.map-box {
+ height: 362px;
+ }
+}
diff --git a/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js b/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js
deleted file mode 100644
index fb9be74039..0000000000
--- a/browser/extensions/webcompat/injections/js/bug1631811-datastudio.google.com-indexedDB.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/**
- * Bug 1631811 - disable indexedDB for datastudio.google.com iframes
- *
- * Indexed DB is disabled already for these iframes due to cookie blocking.
- * This intervention changes the functionality from throwing a SecurityError
- * when indexedDB is accessed to removing it from the window object
- */
-
-console.info(
- "window.indexedDB has been overwritten for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1631811 for details."
-);
-
-Object.defineProperty(window.wrappedJSObject, "indexedDB", {
- get: undefined,
- set: undefined,
-});
diff --git a/browser/extensions/webcompat/injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js b/browser/extensions/webcompat/injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js
deleted file mode 100644
index 4ad0e6f4e7..0000000000
--- a/browser/extensions/webcompat/injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/**
- * Bug 1790750 - The page is blank on relearnings.com/linkedinlearning.html
- * with ETP set to Standard
- *
- * The linkedin video iframe loaded on relearnings.com/linkedinlearning.html is
- * denied storage access by ETP due to being a tracker breaking the website.
- * Since the iframe is a video which users want to access if visiting the URL
- * this intervention sets the window location to the iframe URL allowing it
- * first party storage access.
- */
-
-/* globals exportFunction */
-
-const LINKEDIN_LEARNING_PATH_PREFIX =
- "https://www.linkedin.com/learning/embed/";
-
-document.addEventListener("DOMContentLoaded", function () {
- let iframes = document.getElementsByTagName("iframe");
- if (iframes.length === 1) {
- if (iframes[0].src.startsWith(LINKEDIN_LEARNING_PATH_PREFIX)) {
- window.location = iframes[0].src;
- console.info(
- "The window.location has been changed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1790750 for details."
- );
- }
- }
-});
diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json
index 9a15ba3aee..f15b3bb938 100644
--- a/browser/extensions/webcompat/manifest.json
+++ b/browser/extensions/webcompat/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
- "version": "123.1.0",
+ "version": "125.0.0",
"browser_specific_settings": {
"gecko": {
"id": "webcompat@mozilla.org",
@@ -145,7 +145,6 @@
"shims/nielsen.js",
"shims/optimizely.js",
"shims/play.svg",
- "shims/private-browsing-web-api-fixes.js",
"shims/rambler-authenticator.js",
"shims/rich-relevance.js",
"shims/salesforce.js",
diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build
index 2a3c9e3c9b..a40641f33b 100644
--- a/browser/extensions/webcompat/moz.build
+++ b/browser/extensions/webcompat/moz.build
@@ -49,7 +49,6 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [
"injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css",
"injections/css/bug1651917-teletrader.com.body-transform-origin.css",
"injections/css/bug1653075-livescience.com-scrollbar-width.css",
- "injections/css/bug1654877-preev.com-moz-appearance-fix.css",
"injections/css/bug1654907-reactine.ca-hide-unsupported.css",
"injections/css/bug1694470-myvidster.com-content-not-shown.css",
"injections/css/bug1707795-office365-sheets-overscroll-disable.css",
@@ -72,11 +71,12 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [
"injections/css/bug1836105-cnn.com-fix-blank-pages-when-printing.css",
"injections/css/bug1848711-vio.com-page-height.css",
"injections/css/bug1848713-cleanrider.com-slider.css",
- "injections/css/bug1848716-elal.com-unsupported-banner.css",
"injections/css/bug1848849-theaa.com-printing-mode-fix.css",
"injections/css/bug1849019-axa-assistance.pl-datepicker-fix.css",
"injections/css/bug1849388-kucharkaprodceru.cz-scroll-fix.css",
"injections/css/bug1868345-tvmovie.de-scroll-fix.css",
+ "injections/css/bug1877346-offerup.com-infinite-scroll-fix.css",
+ "injections/css/bug1884842-foodora.cz-height-fix.css",
]
FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [
@@ -86,13 +86,11 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [
"injections/js/bug1457335-histography.io-ua-change.js",
"injections/js/bug1472075-bankofamerica.com-ua-change.js",
"injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js",
- "injections/js/bug1631811-datastudio.google.com-indexedDB.js",
"injections/js/bug1722955-frontgate.com-ua-override.js",
"injections/js/bug1724868-news.yahoo.co.jp-ua-override.js",
"injections/js/bug1739489-draftjs-beforeinput.js",
"injections/js/bug1769762-tiktok.com-plugins-shim.js",
"injections/js/bug1774005-installtrigger-shim.js",
- "injections/js/bug1790750-relearnings.com-linkedinlearning-iframe-fix.js",
"injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js",
"injections/js/bug1799980-healow.com-infinite-loop-fix.js",
"injections/js/bug1818818-fastclick-legacy-shim.js",
@@ -158,7 +156,6 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [
"shims/nielsen.js",
"shims/optimizely.js",
"shims/play.svg",
- "shims/private-browsing-web-api-fixes.js",
"shims/rambler-authenticator.js",
"shims/rich-relevance.js",
"shims/salesforce.js",
diff --git a/browser/extensions/webcompat/shims/private-browsing-web-api-fixes.js b/browser/extensions/webcompat/shims/private-browsing-web-api-fixes.js
deleted file mode 100644
index b8a1e1fc5a..0000000000
--- a/browser/extensions/webcompat/shims/private-browsing-web-api-fixes.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/**
- * Bug 1714354 - Fix for site issues with web APIs in private browsing
- *
- * Some sites expect specific DOM APIs to work in specific ways, which
- * is not always true, such as in private browsing mode. We work around
- * related breakage by undefining those APIs entirely in private
- * browsing mode for those sites.
- */
-
-// caches.keys() rejects in private browsing mode:
-// https://bugzilla.mozilla.org/show_bug.cgi?id=1742344#c4
-// Can be removed once bug 1714354 is fixed.
-delete window.wrappedJSObject.caches;