Attention is currently required from: Yuki Shiino.
Joshua Bell would like Yuki Shiino to review this change.
TextDecoder: Passing explicit undefined to decode()
Test various permutations of passing explicit undefined to decode(),
which has two optional arguments.
Chrome's binding layer had incorrect behavior here, which wasn't
tested.
Bug: 1172968
Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
---
A third_party/blink/web_tests/external/wpt/encoding/textdecoder-arguments.any.js
1 file changed, 49 insertions(+), 0 deletions(-)
diff --git a/third_party/blink/web_tests/external/wpt/encoding/textdecoder-arguments.any.js b/third_party/blink/web_tests/external/wpt/encoding/textdecoder-arguments.any.js
new file mode 100644
index 0000000..f469dcd
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/encoding/textdecoder-arguments.any.js
@@ -0,0 +1,49 @@
+// META: title=Encoding API: TextDecoder decode() optional arguments
+
+test(t => {
+ const decoder = new TextDecoder();
+
+ // Just passing nothing.
+ assert_equals(
+ decoder.decode(undefined), '',
+ 'Undefined as first arg should decode to empty string');
+
+ // Flushing an incomplete sequence.
+ decoder.decode(new Uint8Array([0xc9]), {stream: true});
+ assert_equals(
+ decoder.decode(undefined), '\uFFFD',
+ 'Undefined as first arg should flush the stream');
+
+}, 'TextDecoder decode() with explicit undefined');
+
+test(t => {
+ const decoder = new TextDecoder();
+
+ // Just passing nothing.
+ assert_equals(
+ decoder.decode(undefined, undefined), '',
+ 'Undefined as first arg should decode to empty string');
+
+ // Flushing an incomplete sequence.
+ decoder.decode(new Uint8Array([0xc9]), {stream: true});
+ assert_equals(
+ decoder.decode(undefined, undefined), '\uFFFD',
+ 'Undefined as first arg should flush the stream');
+
+}, 'TextDecoder decode() with undefined and undefined');
+
+test(t => {
+ const decoder = new TextDecoder();
+
+ // Just passing nothing.
+ assert_equals(
+ decoder.decode(undefined, {}), '',
+ 'Undefined as first arg should decode to empty string');
+
+ // Flushing an incomplete sequence.
+ decoder.decode(new Uint8Array([0xc9]), {stream: true});
+ assert_equals(
+ decoder.decode(undefined, {}), '\uFFFD',
+ 'Undefined as first arg should flush the stream');
+
+}, 'TextDecoder decode() with undefined and options');
To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Yuki Shiino.
Patch set 1:Auto-Submit +1
1 comment:
Patchset:
yukishiino@ - could you please review?
Thanks!
To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Joshua Bell, Yuki Shiino.
Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/27580.
When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.
WPT Export docs:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md#Automatic-export-process
Attention is currently required from: Joshua Bell.
Patch set 1:Code-Review +1Commit-Queue +2
1 comment:
Patchset:
Thanks for writing a WPT. :)
To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.
Chromium LUCI CQ submitted this change.
TextDecoder: Passing explicit undefined to decode()
Test various permutations of passing explicit undefined to decode(),
which has two optional arguments.
Chrome's binding layer had incorrect behavior here, which wasn't
tested.
Bug: 1172968
Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2686917
Commit-Queue: Yuki Shiino <yukis...@chromium.org>
Auto-Submit: Joshua Bell <jsb...@chromium.org>
Reviewed-by: Yuki Shiino <yukis...@chromium.org>
Cr-Commit-Position: refs/heads/master@{#853395}
+}, 'TextDecoder decode() with undefined and options');
To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.
The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/27580