Skip to content

Commit 9fb9c27

Browse files
fred-wangchromium-wpt-export-bot
authored andcommitted
[compression-dictionary] Make sure link element are processed after changes to crossorigin attribute
This is currently not specified but is proposed at whatwg/html#11620 Bug: 522338661, 40255884 Change-Id: Ia6f60eee7f0e5a3af9fb4bda9b0d0a483a3e5950 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8027613 Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Reviewed-by: Patrick Meenan <pmeenan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1663692}
1 parent dedb54a commit 9fb9c27

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎fetch/compression-dictionary/dictionary-fetch-timing-002.tentative.https.html‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
<link id="hrefDynamicallySet" rel="compression-dictionary"></link>
1616
<link id="hrefDynamicallyChanged" rel="compression-dictionary" href="./resources/register-dictionary.py?hrefDynamicallyChanged"></link>
1717
<link id="relDynamicallySet" href="./resources/register-dictionary.py?relDynamicallySet">
18+
<!-- Fetching this resources will be tried immediately, use a 404 response so fetching will be attempted again after mutating crossorigin attribute. -->
19+
<link id="crossOriginDynamicallySet" rel="compression-dictionary" href="./resources/404NotFound/register-dictionary.py?crossOriginDynamicallySet">
20+
<link id="crossOriginDynamicallyChanged" rel="compression-dictionary" crossorigin="use-credentials" href="./resources/404NotFound/register-dictionary.py?crossOriginDynamicallyChanged">
21+
<link id="crossOriginDynamicallyRemoved" rel="compression-dictionary" crossorigin="use-credentials" href="./resources/404NotFound/register-dictionary.py?crossOriginDynamicallyRemoved">
1822
<body>
1923
<script>
2024
let fetchedDictionaries = [];
2125
const observer = new PerformanceObserver((list) => {
2226
list.getEntries().forEach(entry => {
2327
const url = new URL(entry.name);
24-
if (url.pathname == "/fetch/compression-dictionary/resources/register-dictionary.py") {
28+
if (url.pathname.endsWith("register-dictionary.py")) {
2529
fetchedDictionaries.push(url.search);
2630
}
2731
});
@@ -32,6 +36,9 @@
3236
// Initially fetched dictionaries.
3337
let expectedEntries = [
3438
"?alreadyBrowsingContextConnected",
39+
"?crossOriginDynamicallyChanged",
40+
"?crossOriginDynamicallyRemoved",
41+
"?crossOriginDynamicallySet",
3542
"?hrefDynamicallyChanged",
3643
];
3744
await t.step_wait(_ => fetchedDictionaries.length >= expectedEntries.length, "initially browsing-context connected <link> should trigger fetch", 5000);
@@ -68,6 +75,18 @@
6875
await t.step_wait(_ => fetchedDictionaries.length >= expectedEntries.length, "setting rel should trigger fetch", 5000);
6976
assert_array_equals(fetchedDictionaries.toSorted(), expectedEntries, "dictionary fetched after setting the rel attribute.");
7077
fetchedDictionaries = [];
78+
79+
// Dynamic changes to crossorigin.
80+
expectedEntries = [
81+
"?crossOriginDynamicallyChanged",
82+
"?crossOriginDynamicallyRemoved",
83+
"?crossOriginDynamicallySet",
84+
];
85+
crossOriginDynamicallySet.setAttribute("crossorigin", "use-credentials");
86+
crossOriginDynamicallyChanged.setAttribute("crossorigin", "anonymous");
87+
crossOriginDynamicallyRemoved.removeAttribute("crossorigin");
88+
await t.step_wait(_ => fetchedDictionaries.length >= expectedEntries.length, "modifying crossorigin should trigger fetch", 5000);
89+
assert_array_equals(fetchedDictionaries.toSorted(), expectedEntries, "fetched dictionaries after dynamic changes to crossorigin attribute.");
7190
}, "<link rel=compression-dictionary> are fetched after DOM operations.");
7291
</script>
7392
</body>

0 commit comments

Comments
 (0)