From 6728ad4203d731e555dabf89ec6157f113454ce6 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Mon, 1 May 2023 22:30:02 +0900 Subject: fix(core): Use primordials for methods (#18839) I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152 --- ext/websocket/02_websocketstream.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ext/websocket') diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js index fef17b701..06f4b50d9 100644 --- a/ext/websocket/02_websocketstream.js +++ b/ext/websocket/02_websocketstream.js @@ -17,6 +17,7 @@ const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeJoin, ArrayPrototypeMap, + DateNow, Error, ObjectPrototypeIsPrototypeOf, PromisePrototypeCatch, @@ -27,8 +28,8 @@ const { StringPrototypeToLowerCase, Symbol, SymbolFor, - TypedArrayPrototypeGetByteLength, TypeError, + TypedArrayPrototypeGetByteLength, Uint8ArrayPrototype, } = primordials; @@ -281,7 +282,7 @@ class WebSocketStream { this[_closed].state === "pending" ) { if ( - new Date().getTime() - await this[_closeSent].promise <= + DateNow() - await this[_closeSent].promise <= CLOSE_RESPONSE_TIMEOUT ) { return pull(controller); @@ -404,7 +405,7 @@ class WebSocketStream { core.opAsync("op_ws_close", this[_rid], code, closeInfo.reason), () => { setTimeout(() => { - this[_closeSent].resolve(new Date().getTime()); + this[_closeSent].resolve(DateNow()); }, 0); }, (err) => { -- cgit v1.2.3