TextDecoder: Passing explicit undefined to decode() [chromium/src : master]

0 views
Skip to first unread message

Joshua Bell (Gerrit)

unread,
Feb 10, 2021, 3:11:58 PM2/10/21
to Yuki Shiino, blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org

Attention is currently required from: Yuki Shiino.

Joshua Bell would like Yuki Shiino to review this change.

View 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.

Gerrit-Project: chromium/src
Gerrit-Branch: master
Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
Gerrit-Change-Number: 2686917
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
Gerrit-Attention: Yuki Shiino <yukis...@chromium.org>
Gerrit-MessageType: newchange

Joshua Bell (Gerrit)

unread,
Feb 10, 2021, 3:12:08 PM2/10/21
to blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, Yuki Shiino, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Yuki Shiino.

Patch set 1:Auto-Submit +1

View Change

1 comment:

  • Patchset:

To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: master
Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
Gerrit-Change-Number: 2686917
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
Gerrit-Attention: Yuki Shiino <yukis...@chromium.org>
Gerrit-Comment-Date: Wed, 10 Feb 2021 20:11:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Blink WPT Bot (Gerrit)

unread,
Feb 10, 2021, 3:28:21 PM2/10/21
to Joshua Bell, blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, Yuki Shiino, Chromium LUCI CQ, chromium...@chromium.org

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

View Change

    To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
    Gerrit-Change-Number: 2686917
    Gerrit-PatchSet: 1
    Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
    Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
    Gerrit-Attention: Joshua Bell <jsb...@chromium.org>
    Gerrit-Attention: Yuki Shiino <yukis...@chromium.org>
    Gerrit-Comment-Date: Wed, 10 Feb 2021 20:27:59 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Yuki Shiino (Gerrit)

    unread,
    Feb 11, 2021, 10:14:52 PM2/11/21
    to Joshua Bell, blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, Yuki Shiino, Blink WPT Bot, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Joshua Bell.

    Patch set 1:Code-Review +1Commit-Queue +2

    View Change

    1 comment:

    To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
    Gerrit-Change-Number: 2686917
    Gerrit-PatchSet: 1
    Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
    Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
    Gerrit-Attention: Joshua Bell <jsb...@chromium.org>
    Gerrit-Comment-Date: Fri, 12 Feb 2021 03:14:32 +0000

    Chromium LUCI CQ (Gerrit)

    unread,
    Feb 11, 2021, 11:26:57 PM2/11/21
    to Joshua Bell, blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, Yuki Shiino, Blink WPT Bot, chromium...@chromium.org

    Chromium LUCI CQ submitted this change.

    View Change

    Approvals: Yuki Shiino: Looks good to me; Commit Joshua Bell: Send CL to CQ automatically after approval
    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.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
    Gerrit-Change-Number: 2686917
    Gerrit-PatchSet: 2
    Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
    Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
    Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
    Gerrit-MessageType: merged

    Blink WPT Bot (Gerrit)

    unread,
    Feb 12, 2021, 12:12:42 AM2/12/21
    to Joshua Bell, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, jshin...@chromium.org, Yuki Shiino, chromium...@chromium.org

    The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/27580

    View Change

      To view, visit change 2686917. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: master
      Gerrit-Change-Id: I6f20caa5db5505192cb8eb4b27e251bf7f42117b
      Gerrit-Change-Number: 2686917
      Gerrit-PatchSet: 2
      Gerrit-Owner: Joshua Bell <jsb...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Joshua Bell <jsb...@chromium.org>
      Gerrit-Reviewer: Yuki Shiino <yukis...@chromium.org>
      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
      Gerrit-Comment-Date: Fri, 12 Feb 2021 05:12:01 +0000
      Reply all
      Reply to author
      Forward
      0 new messages