diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-05-01 22:30:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 15:30:02 +0200 |
commit | 6728ad4203d731e555dabf89ec6157f113454ce6 (patch) | |
tree | 956dc2d403b5a6ef107c35cab1ccc259ad4d86a1 /ext/websocket/02_websocketstream.js | |
parent | 94a148cdb6f7660518c75a3c20109bf64848f0f1 (diff) |
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
Diffstat (limited to 'ext/websocket/02_websocketstream.js')
-rw-r--r-- | ext/websocket/02_websocketstream.js | 7 |
1 files changed, 4 insertions, 3 deletions
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) => { |