mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(ext/websocket): Ensure that errors are available after async response returns (#19642)
Fixes the WPT tests that test w/invalid codes. Also explicitly ignoring some h2 tests to hopefully prevent flakes. The previous changes to WebSocketStream introduced a bug where the close errors were not made available if the `pull` method was re-entrant.
This commit is contained in:
parent
b6253370cc
commit
93b3ff0170
6 changed files with 24 additions and 40 deletions
|
@ -467,6 +467,7 @@ class WebSocket extends EventTarget {
|
|||
default: {
|
||||
/* close */
|
||||
const code = kind;
|
||||
const reason = code == 1005 ? "" : op_ws_get_error(rid);
|
||||
const prevState = this[_readyState];
|
||||
this[_readyState] = CLOSED;
|
||||
clearTimeout(this[_idleTimeoutTimeout]);
|
||||
|
@ -476,7 +477,7 @@ class WebSocket extends EventTarget {
|
|||
await op_ws_close(
|
||||
rid,
|
||||
code,
|
||||
op_ws_get_error(rid),
|
||||
reason,
|
||||
);
|
||||
} catch {
|
||||
// ignore failures
|
||||
|
@ -486,7 +487,7 @@ class WebSocket extends EventTarget {
|
|||
const event = new CloseEvent("close", {
|
||||
wasClean: true,
|
||||
code: code,
|
||||
reason: op_ws_get_error(rid),
|
||||
reason,
|
||||
});
|
||||
this.dispatchEvent(event);
|
||||
core.tryClose(rid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue