Files
sousa-gecko/testing/web-platform/tests/fetch/compression-dictionary/compressed-large-resources-002.tentative.https.html
Frédéric Wang Nélar d6d33568b4 Bug 2069330 [wpt PR 62427] - Fix flakiness in compression-dictionary/compressed-large-*.https.html, a=testonly
Automatic update from web-platform-tests
Fix flakiness in compression-dictionary/compressed-large-*.https.html

Use UUIDs in URLs to prevent potential race conditions with dictionary
registration, resource loading and cache clearing between
`compression_dictionary_promise_test`s.

Even with `run_wpt_tests.py --repeat=20`, I was enable to reproduce any
failure with compressed-large-resources-002.tentative.https.html, but
let's tentatively remove the failure annotation.

A similar issue was however observable in WebKit with equivalent command
`run-webkit-tests --repeat=4` and is fixed by this change.

Bug: 538228192, 40255884
Change-Id: Ib72f80f02a7a9b539cdb4c3627c1d4cabee684e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8341989
Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com>
Reviewed-by: Patrick Meenan <pmeenan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1691847}

--

wpt-commits: 9298d21d24c022a57b8c0b60b9a609fe6b684c62
wpt-pr: 62427
2026-09-10 11:30:03 +00:00

57 lines
2.4 KiB
HTML

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="timeout" content="long"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/common/utils.js"></script>
<script src="./resources/compression-dictionary-util.sub.js"></script>
</head>
<body>
<script>
[
"dcb",
"dcz",
].forEach(format => {
[
{subframe_dictionary: "subframe-001.html", subframe_compressed: `self-compressed-subframe-001.html.${format}`},
{subframe_dictionary: "style-001.css", subframe_compressed: `subframe-001-compressed-by-style-001.html.${format}`},
{subframe_dictionary: "script-001.js", subframe_compressed: `subframe-001-compressed-by-script-001.html.${format}`},
].forEach(config => {
compression_dictionary_promise_test(async t => {
const test_id = token();
// Load the non-compressed style to register it as a dictionary for itself.
await fetchStaticResourceWithUseAsDictionaryHeader(`${config.subframe_dictionary}?id=${test_id}`, `${config.subframe_compressed}?id=${test_id}`, "iframe");
// Wait for another dictionary to register to give a chance for the
// previous registration to complete. See comment in the 001 file about
// why we can't use waitUntilPreviousRequestHeaders, checkHeaders or checkHeader.
await registerAltDictionaryAndWait(t, `alt_${token()}`);
// Append the compressed subframe.
const iframe = document.createElement("iframe");
iframe.src = `./resources/static/${config.subframe_compressed}?id=${test_id}`;
const waitMessageFromIframe = new Promise(resolve => {
function iframeListener(event) { resolve(event.data === "ready"); }
window.addEventListener("message", iframeListener, {once: true});
t.add_cleanup(_ => {
iframe.remove();
window.removeEventListener("message", iframeListener);
});
});
await new Promise((resolve, reject) => {
iframe.onload = resolve;
iframe.onerror = _ => reject("load failed");
document.body.appendChild(iframe);
});
// Verify script in HTML page was executed.
assert_true(await waitMessageFromIframe, "iframe posted its ready message");
}, `Loading ${config.subframe_compressed} using ${config.subframe_dictionary} as a dictionary works`);
});
});
</script>
</body>