Skip to content

Commit db2bdfd

Browse files
fred-wangchromium-wpt-export-bot
authored andcommitted
[compression-dictionary] Check that invalid URLs neither trigger any load/error event nor any fetch request.
"create a link request" for an invalid URL returns null per https://html.spec.whatwg.org/#create-a-link-request so "load a compression dictionary" should return early per whatwg/html#11620 Bug: 522338661, 40255884 Change-Id: Id2f37d8c578a585200b88574ef1262048b98ded3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8084469 Reviewed-by: Patrick Meenan <pmeenan@chromium.org> Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Cr-Commit-Position: refs/heads/main@{#1663433}
1 parent 27d2ee7 commit db2bdfd

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<meta name="timeout" content="long"/>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script>
7+
promise_test(async t => {
8+
let fetchedEntries = [];
9+
const observer = new PerformanceObserver((list) => {
10+
list.getEntries().forEach(entry => {
11+
// Ignore favicon.ico and testharness resources.
12+
if (!entry.name.match(/testharness|favicon/g)) {
13+
fetchedEntries.push(entry.name);
14+
}
15+
});
16+
});
17+
observer.observe({ type: "resource", buffered: true});
18+
const link = document.createElement('link');
19+
t.add_cleanup(_ => {
20+
observer.disconnect();
21+
link.remove();
22+
});
23+
link.rel = 'compression-dictionary';
24+
link.href = "https://make:invalid/";
25+
link.addEventListener("error", t.unreached_func("error event should not be dispatched"));
26+
link.addEventListener("load", t.unreached_func("load event should not be dispatched"));
27+
document.head.appendChild(link);
28+
await new Promise(resolve => t.step_timeout(resolve, 1000));
29+
assert_equals(fetchedEntries.length, 0);
30+
}, 'link with rel=compression-dictionary and invalid href neither trigger any load/error event nor any fetch request.');
31+
</script>

0 commit comments

Comments
 (0)