Skip to content

Commit

Permalink
Fix wpt/webtransport/close.https.any.js
Browse files Browse the repository at this point in the history
The test was updated by a Firefox's patch [1] to truncate close
reason for client's close info. However, the expected behavior is
to keep the original reason as the spec specifies [2]. Update the
test to fix and clarify the behavior.

[1] https://phabricator.services.mozilla.com/D164124
[2] https://w3c.github.io/webtransport/#dom-webtransport-close

Bug: 1250221
Change-Id: I7f37771001b0fe74518c8ad3f35d09efa4a9b710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4145645
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Auto-Submit: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1090663}
  • Loading branch information
bashi authored and pull[bot] committed Sep 1, 2023
1 parent 8e52298 commit 1063694
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions webtransport/close.https.any.js
Expand Up @@ -63,16 +63,19 @@ promise_test(async t => {
const close_info = await wt.closed;

assert_equals(close_info.closeCode, 11, 'code');
// This should be truncated to 1023 bytes!
const reason_truncated = 'あいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあいうえおあ';
assert_equals(close_info.reason, reason_truncated, 'reason');
// `close_info.reason` should report the original, non-truncated reason as
// step 9 of https://w3c.github.io/webtransport/#dom-webtransport-close
// uses the original `closeInfo` to perform `Cleanup`.
assert_equals(close_info.reason, reason, 'reason');

await wait(10);
const data = await query(id);

assert_own_property(data, 'session-close-info');
const info = data['session-close-info']

// Server should have received truncated reason as step 6 of
// https://w3c.github.io/webtransport/#dom-webtransport-close specifies.
const expected_reason =
new TextDecoder().decode(
new TextEncoder().encode(reason).slice(0, 1024)).replaceAll('\ufffd', '');
Expand Down

0 comments on commit 1063694

Please sign in to comment.