Skip to content

Commit 294506a

Browse files
test: skip the adopted-iframe pages only where the engine drops their box
The Chrome quirk test asserted a Chrome 155 behavior that Chromium 141, the one CI runs, does not have, so it failed on main too. The render tier now probes the quirk and skips ADOPTED_IFRAME_PAGES only where it holds.
1 parent 22a5b52 commit 294506a

1 file changed

Lines changed: 30 additions & 24 deletions

File tree

‎test/specCases/syntaxEquivalence.spectest.js‎

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,11 +2686,35 @@ const RENDER_WIDTHS = [360, 1400];
26862686

26872687
// WHY: Chrome 155 lays out no box for an iframe the adoption agency moved —
26882688
// measured: `<b><p><iframe></iframe></b>` gives it 0x0, where Chromium 141
2689-
// gives 304x154 — so a page doing so renders apart from its printed tree.
2689+
// gives 304x154 — so a page doing so renders apart from its printed tree, and
2690+
// is skipped only in an engine `dropsAdoptedIframeBox` finds doing it.
26902691
const ADOPTED_IFRAME_PAGES = new Set([
26912692
"test/external/wpt/html/syntax/parsing/crashtests/adoption-agency-cycle-mutation.html"
26922693
]);
26932694

2695+
/**
2696+
* Whether the engine lays out no box for an iframe the adoption agency moved.
2697+
* @param {import("puppeteer-core").Page} page a page to probe in
2698+
* @returns {Promise<boolean>} true when the moved iframe has no width
2699+
*/
2700+
const dropsAdoptedIframeBox = (page) =>
2701+
page.evaluate(async () => {
2702+
const frame = document.createElement("iframe");
2703+
frame.setAttribute("sandbox", "allow-same-origin");
2704+
const loaded = new Promise((resolve) => {
2705+
frame.addEventListener("load", resolve, { once: true });
2706+
});
2707+
frame.srcdoc = "<!doctype html><b><p><iframe></iframe></b>";
2708+
document.body.append(frame);
2709+
await loaded;
2710+
const moved = /** @type {HTMLIFrameElement} */ (
2711+
/** @type {Document} */ (frame.contentDocument).querySelector("iframe")
2712+
);
2713+
const { width } = moved.getBoundingClientRect();
2714+
frame.remove();
2715+
return width === 0;
2716+
});
2717+
26942718
// Engine behaviors a workaround in this suite exists for, each probed in the
26952719
// engines it was measured in: once one is fixed its test fails, naming the
26962720
// workaround to take back out.
@@ -2707,28 +2731,6 @@ const ENGINE_QUIRKS = [
27072731
.textContent === "a<\uFFFD!"
27082732
)
27092733
},
2710-
{
2711-
engines: ["chrome"],
2712-
quirk: "lays out no box for an iframe the adoption agency moved",
2713-
workaround: "the render tier skipping `ADOPTED_IFRAME_PAGES`",
2714-
holds: (page) =>
2715-
page.evaluate(async () => {
2716-
const frame = document.createElement("iframe");
2717-
frame.setAttribute("sandbox", "allow-same-origin");
2718-
const loaded = new Promise((resolve) => {
2719-
frame.addEventListener("load", resolve, { once: true });
2720-
});
2721-
frame.srcdoc = "<!doctype html><b><p><iframe></iframe></b>";
2722-
document.body.append(frame);
2723-
await loaded;
2724-
const moved = /** @type {HTMLIFrameElement} */ (
2725-
/** @type {Document} */ (frame.contentDocument).querySelector("iframe")
2726-
);
2727-
const { width } = moved.getBoundingClientRect();
2728-
frame.remove();
2729-
return width === 0;
2730-
})
2731-
},
27322734
{
27332735
engines: ["firefox"],
27342736
quirk: "paints a relative color a byte away from its sRGB spelling",
@@ -2876,6 +2878,7 @@ describe("a minified page renders as the page it came from", () => {
28762878
let page;
28772879
/** @type {Error | undefined} */
28782880
let unrecovered;
2881+
let skipAdoptedIframes = false;
28792882

28802883
// WHY: a WebKit run never returned from one wpt/css batch, and every later
28812884
// test then waited behind it on the same page. Past a deadline the batch is
@@ -2897,6 +2900,7 @@ describe("a minified page renders as the page it came from", () => {
28972900
protocolTimeout: FILE_TIMEOUT
28982901
});
28992902
page = await openPage();
2903+
skipAdoptedIframes = await dropsAdoptedIframeBox(page);
29002904
}, FILE_TIMEOUT);
29012905

29022906
afterAll(async () => {
@@ -2991,6 +2995,9 @@ describe("a minified page renders as the page it came from", () => {
29912995
*/
29922996
const renderPairs = (fixtures, options) =>
29932997
fixtures.flatMap((fixture) => {
2998+
if (skipAdoptedIframes && ADOPTED_IFRAME_PAGES.has(fixture.name)) {
2999+
return [];
3000+
}
29943001
const after = minifyHtml(fixture.raw, options);
29953002
return after === fixture.raw
29963003
? []
@@ -3010,7 +3017,6 @@ describe("a minified page renders as the page it came from", () => {
30103017
// the spec ignores it in body text, while Chromium turns one right after a
30113018
// `<` into U+FFFD — measured: `a<\0!` renders `a<\uFFFD!` in Chrome 141.
30123019
if (raw.includes("\u0000")) continue;
3013-
if (ENGINE === "chrome" && ADOPTED_IFRAME_PAGES.has(name)) continue;
30143020
const group = name.split("/").slice(2, 4).join("/");
30153021
const pages = wptPages.get(group);
30163022
const fixture = { name, raw, min: raw };

0 commit comments

Comments
 (0)