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 <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
anonrig authored and ruyadorno committed Aug 29, 2023
1 parent e9ac111 commit 125bca6
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
- FileAPI/file: https://github.com/web-platform-tests/wpt/tree/c01f637cca/FileAPI/file
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 125bca6

Please sign in to comment.