Skip to content

Commit 125bca6

Browse files
anonrigruyadorno
authored andcommitted
test: update encoding web-platform tests
PR-URL: #48320 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e9ac111 commit 125bca6

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

test/fixtures/wpt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Last update:
1414
- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
1515
- dom/abort: https://github.com/web-platform-tests/wpt/tree/d1f1ecbd52/dom/abort
1616
- dom/events: https://github.com/web-platform-tests/wpt/tree/ab8999891c/dom/events
17-
- encoding: https://github.com/web-platform-tests/wpt/tree/0c1b9d1622/encoding
17+
- encoding: https://github.com/web-platform-tests/wpt/tree/a58bbf6d8c/encoding
1818
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
1919
- FileAPI: https://github.com/web-platform-tests/wpt/tree/e36dbb6f00/FileAPI
2020
- FileAPI/file: https://github.com/web-platform-tests/wpt/tree/c01f637cca/FileAPI/file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html class="test-wait">
3+
<script id="workerScript" type="text/worker">
4+
// Blob will pass a huge Uint8Array object whose stringification will take long
5+
const encoder = new TextEncoderStream()
6+
const blob = new Blob([new ArrayBuffer(1338720)])
7+
const writable = new WritableStream()
8+
blob.stream().pipeThrough(encoder).pipeTo(writable)
9+
// Wait a bit for the piping to start
10+
Promise.resolve().then(() => postMessage('started'));
11+
</script>
12+
<script>
13+
const worker = new Worker(URL.createObjectURL(new Blob([
14+
document.getElementById("workerScript").textContent
15+
])))
16+
worker.onmessage = () => {
17+
worker.terminate();
18+
document.documentElement.classList.remove("test-wait");
19+
};
20+
</script>

test/fixtures/wpt/encoding/unsupported-labels.window.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,13 @@
167167
t.add_cleanup(() => {
168168
frame.remove();
169169
});
170-
frame.src = "resources/text-plain-charset.py?label=" + label;
170+
// Intentionally use <meta> as Content-Type results in browser differences
171+
// See /html/syntax/charset/inheritance-bogus-meta.html
172+
frame.src = "resources/text-html-meta-charset.py?label=" + label;
171173
frame.onload = t.step_func_done(() => {
172-
// If we ever change this default this needs adjusting accordingly.
173-
assert_equals(frame.contentDocument.characterSet, "windows-1252");
174-
assert_equals(frame.contentDocument.inputEncoding, "windows-1252");
174+
// UTF-8 as it inherits from the parent document when unrecognized
175+
assert_equals(frame.contentDocument.characterSet, "UTF-8");
176+
assert_equals(frame.contentDocument.inputEncoding, "UTF-8");
175177
});
176178
document.body.append(frame);
177179
}, `${label} is not supported by the Encoding Standard`);

test/fixtures/wpt/versions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"path": "dom/events"
1717
},
1818
"encoding": {
19-
"commit": "0c1b9d1622ae0f27f82d7f7d7a1e9e69d410a3ca",
19+
"commit": "a58bbf6d8c0db1f1fd5352e846acb0754ee55567",
2020
"path": "encoding"
2121
},
2222
"fetch/data-urls/resources": {

0 commit comments

Comments
 (0)