Skip to content

Commit

Permalink
test: update encoding web-platform tests
Browse files Browse the repository at this point in the history
PR-URL: #48320
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Filip Skokan <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
anonrig authored Jun 5, 2023
1 parent 3323528 commit e30e716
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Last update:
- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
- dom/abort: https://github.com/web-platform-tests/wpt/tree/d1f1ecbd52/dom/abort
- dom/events: https://github.com/web-platform-tests/wpt/tree/ab8999891c/dom/events
- encoding: https://github.com/web-platform-tests/wpt/tree/0c1b9d1622/encoding
- encoding: https://github.com/web-platform-tests/wpt/tree/a58bbf6d8c/encoding
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
- FileAPI: https://github.com/web-platform-tests/wpt/tree/e36dbb6f00/FileAPI
- hr-time: https://github.com/web-platform-tests/wpt/tree/34cafd797e/hr-time
Expand Down
20 changes: 20 additions & 0 deletions test/fixtures/wpt/encoding/streams/stringification-crash.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html class="test-wait">
<script id="workerScript" type="text/worker">
// Blob will pass a huge Uint8Array object whose stringification will take long
const encoder = new TextEncoderStream()
const blob = new Blob([new ArrayBuffer(1338720)])
const writable = new WritableStream()
blob.stream().pipeThrough(encoder).pipeTo(writable)
// Wait a bit for the piping to start
Promise.resolve().then(() => postMessage('started'));
</script>
<script>
const worker = new Worker(URL.createObjectURL(new Blob([
document.getElementById("workerScript").textContent
])))
worker.onmessage = () => {
worker.terminate();
document.documentElement.classList.remove("test-wait");
};
</script>
10 changes: 6 additions & 4 deletions test/fixtures/wpt/encoding/unsupported-labels.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,13 @@
t.add_cleanup(() => {
frame.remove();
});
frame.src = "resources/text-plain-charset.py?label=" + label;
// Intentionally use <meta> as Content-Type results in browser differences
// See /html/syntax/charset/inheritance-bogus-meta.html
frame.src = "resources/text-html-meta-charset.py?label=" + label;
frame.onload = t.step_func_done(() => {
// If we ever change this default this needs adjusting accordingly.
assert_equals(frame.contentDocument.characterSet, "windows-1252");
assert_equals(frame.contentDocument.inputEncoding, "windows-1252");
// UTF-8 as it inherits from the parent document when unrecognized
assert_equals(frame.contentDocument.characterSet, "UTF-8");
assert_equals(frame.contentDocument.inputEncoding, "UTF-8");
});
document.body.append(frame);
}, `${label} is not supported by the Encoding Standard`);
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"path": "dom/events"
},
"encoding": {
"commit": "0c1b9d1622ae0f27f82d7f7d7a1e9e69d410a3ca",
"commit": "a58bbf6d8c0db1f1fd5352e846acb0754ee55567",
"path": "encoding"
},
"fetch/data-urls/resources": {
Expand Down

0 comments on commit e30e716

Please sign in to comment.