diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-02-01 18:06:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 18:06:11 +0100 |
commit | 8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch) | |
tree | 94c7d6eb2679e641f59cf78640340f5b7af0022e /ext/crypto/01_webidl.js | |
parent | abf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff) |
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'ext/crypto/01_webidl.js')
-rw-r--r-- | ext/crypto/01_webidl.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/crypto/01_webidl.js b/ext/crypto/01_webidl.js index 67156ce3a..739648766 100644 --- a/ext/crypto/01_webidl.js +++ b/ext/crypto/01_webidl.js @@ -9,7 +9,11 @@ ((window) => { const webidl = window.__bootstrap.webidl; const { CryptoKey } = window.__bootstrap.crypto; - const { ArrayBufferIsView, ArrayBuffer } = window.__bootstrap.primordials; + const { + ArrayBufferIsView, + ArrayBufferPrototype, + ObjectPrototypeIsPrototypeOf, + } = window.__bootstrap.primordials; webidl.converters.AlgorithmIdentifier = (V, opts) => { // Union for (object or DOMString) @@ -21,7 +25,10 @@ webidl.converters["BufferSource or JsonWebKey"] = (V, opts) => { // Union for (BufferSource or JsonWebKey) - if (ArrayBufferIsView(V) || V instanceof ArrayBuffer) { + if ( + ArrayBufferIsView(V) || + ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) + ) { return webidl.converters.BufferSource(V, opts); } return webidl.converters.JsonWebKey(V, opts); @@ -460,7 +467,7 @@ webidl.converters.CryptoKey = webidl.createInterfaceConverter( "CryptoKey", - CryptoKey, + CryptoKey.prototype, ); const dictCryptoKeyPair = [ |