Bug 1845305 - add tests for sandboxed iframe autocompletion r=dimi

Note the test fails, and the fix will be provided via the next patch in this stack.

Differential Revision: https://phabricator.services.mozilla.com/D203240
This commit is contained in:
Johannes J. Schmidt 2024-03-01 10:42:01 +00:00
parent 071c853e6c
commit 497846017a
4 changed files with 47 additions and 0 deletions

View File

@ -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"]

View File

@ -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();
});

View File

@ -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 +

View File

@ -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>