summaryrefslogtreecommitdiff
path: root/ext/crypto/01_webidl.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-01-27 13:36:36 +0100
committerGitHub <noreply@github.com>2022-01-27 13:36:36 +0100
commit884143218fad0e18f7553aaf079d52de703f7601 (patch)
tree9b9e9d30ea647041438ef8fa974b8d4234cabf73 /ext/crypto/01_webidl.js
parentdcf8f144ab0516936bfa4e93357d71f1732d880e (diff)
refactor: update runtime code for primordial checks for "instanceof" (#13497)
Diffstat (limited to 'ext/crypto/01_webidl.js')
-rw-r--r--ext/crypto/01_webidl.js13
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 = [