chore(ext/websocket): custom arity (#14202)

This commit is contained in:
Divy Srivastava 2022-04-04 15:19:50 +05:30 committed by GitHub
parent cc49b5e0d8
commit 995d1666ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 61 deletions

View file

@ -223,10 +223,11 @@
}
PromisePrototypeThen(
core.opAsync("op_ws_create", {
url: wsURL.href,
protocols: ArrayPrototypeJoin(protocols, ", "),
}),
core.opAsync(
"op_ws_create",
wsURL.href,
ArrayPrototypeJoin(protocols, ", "),
),
(create) => {
this[_rid] = create.rid;
this[_extensions] = create.extensions;
@ -234,9 +235,7 @@
if (this[_readyState] === CLOSING) {
PromisePrototypeThen(
core.opAsync("op_ws_close", {
rid: this[_rid],
}),
core.opAsync("op_ws_close", this[_rid]),
() => {
this[_readyState] = CLOSED;
@ -369,11 +368,7 @@
this[_readyState] = CLOSING;
PromisePrototypeThen(
core.opAsync("op_ws_close", {
rid: this[_rid],
code,
reason,
}),
core.opAsync("op_ws_close", this[_rid], code, reason),
() => {
this[_readyState] = CLOSED;
const event = new CloseEvent("close", {
@ -473,11 +468,7 @@
this[_idleTimeoutTimeout] = setTimeout(async () => {
this[_readyState] = CLOSING;
const reason = "No response from ping frame.";
await core.opAsync("op_ws_close", {
rid: this[_rid],
code: 1001,
reason,
});
await core.opAsync("op_ws_close", this[_rid], 1001, reason);
this[_readyState] = CLOSED;
const errEvent = new ErrorEvent("error", {