Skip to content

Commit 98fb567

Browse files
fred-wangchromium-wpt-export-bot
authored andcommitted
[compression-dictionary] Add WPT tests for load/error events on a <link rel=compression-dictionary>
This is currently not specified but is proposed at whatwg/html#11620 Bug: 522338661, 40255884 Change-Id: I9df45092e344588d4dc06cea0fc2fd4daf84caec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8036725 Reviewed-by: Patrick Meenan <pmeenan@chromium.org> Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Cr-Commit-Position: refs/heads/main@{#1660503}
1 parent 5857e28 commit 98fb567

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<script src="./resources/compression-dictionary-util.sub.js"></script>
6+
<script>
7+
compression_dictionary_promise_test(async t => {
8+
const link = document.createElement('link');
9+
t.add_cleanup(_ => link.remove());
10+
link.rel = 'compression-dictionary';
11+
link.href = kRegisterDictionaryPath;
12+
link.addEventListener("error", t.unreached_func("error event should not be dispatched"));
13+
return new Promise(resolve => {
14+
link.addEventListener("load", resolve);
15+
document.head.appendChild(link);
16+
});
17+
}, 'Load event is dispatched on link with rel=compression-dictionary.');
18+
19+
compression_dictionary_promise_test(async t => {
20+
const link = document.createElement('link');
21+
t.add_cleanup(_ => link.remove());
22+
link.rel = 'compression-dictionary';
23+
link.href = "./resources/register-dictionary-network-error.py";
24+
link.addEventListener("load", t.unreached_func("load event should not be dispatched"));
25+
return new Promise(resolve => {
26+
link.addEventListener("error", resolve);
27+
document.head.appendChild(link);
28+
});
29+
}, 'Error event is dispatched on link with rel=compression-dictionary returning a network error.');
30+
</script>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def main(request, response):
2+
# https://fetch.spec.whatwg.org/#http-redirect-fetch
3+
# If locationURL’s scheme is not an HTTP(S) scheme, then return a network error.
4+
response.status = 302
5+
response.headers.set(b"Location", "about:blank")

0 commit comments

Comments
 (0)