summaryrefslogtreecommitdiff
path: root/ext/websocket/02_websocketstream.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/websocket/02_websocketstream.js')
-rw-r--r--ext/websocket/02_websocketstream.js31
1 files changed, 13 insertions, 18 deletions
diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js
index 0f4cecaa5..0a14657e9 100644
--- a/ext/websocket/02_websocketstream.js
+++ b/ext/websocket/02_websocketstream.js
@@ -11,19 +11,18 @@
const { add, remove } = window.__bootstrap.abortSignal;
const {
- ArrayPrototypeJoin,
- ArrayPrototypeMap,
- Error,
- ObjectPrototypeIsPrototypeOf,
- PromisePrototypeCatch,
- PromisePrototypeThen,
- Set,
StringPrototypeEndsWith,
StringPrototypeToLowerCase,
Symbol,
SymbolFor,
+ Set,
+ ArrayPrototypeMap,
+ ArrayPrototypeJoin,
+ PromisePrototypeThen,
+ PromisePrototypeCatch,
+ Uint8Array,
TypeError,
- Uint8ArrayPrototype,
+ Error,
} = window.__bootstrap.primordials;
webidl.converters.WebSocketStreamOptions = webidl.createDictionaryConverter(
@@ -71,7 +70,7 @@
[_url];
get url() {
- webidl.assertBranded(this, WebSocketStreamPrototype);
+ webidl.assertBranded(this, WebSocketStream);
return this[_url];
}
@@ -196,9 +195,7 @@
kind: "text",
value: chunk,
});
- } else if (
- ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk)
- ) {
+ } else if (chunk instanceof Uint8Array) {
await core.opAsync("op_ws_send", this[_rid], {
kind: "binary",
value: chunk,
@@ -299,7 +296,7 @@
}
},
(err) => {
- if (ObjectPrototypeIsPrototypeOf(core.InterruptedPrototype, err)) {
+ if (err instanceof core.Interrupted) {
// The signal was aborted.
err = options.signal.reason;
} else {
@@ -314,19 +311,19 @@
[_connection] = new Deferred();
get connection() {
- webidl.assertBranded(this, WebSocketStreamPrototype);
+ webidl.assertBranded(this, WebSocketStream);
return this[_connection].promise;
}
[_earlyClose] = false;
[_closed] = new Deferred();
get closed() {
- webidl.assertBranded(this, WebSocketStreamPrototype);
+ webidl.assertBranded(this, WebSocketStream);
return this[_closed].promise;
}
close(closeInfo) {
- webidl.assertBranded(this, WebSocketStreamPrototype);
+ webidl.assertBranded(this, WebSocketStream);
closeInfo = webidl.converters.WebSocketCloseInfo(closeInfo, {
prefix: "Failed to execute 'close' on 'WebSocketStream'",
context: "Argument 1",
@@ -384,7 +381,5 @@
}
}
- const WebSocketStreamPrototype = WebSocketStream.prototype;
-
window.__bootstrap.webSocket.WebSocketStream = WebSocketStream;
})(this);