diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-01-27 16:27:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 16:27:22 +0100 |
commit | f248e6f1778dc26db91d3322de2ecca5d1aa9866 (patch) | |
tree | 46b1ff59091cc8d31ff67427173d3a0148734007 /ext/web/02_structured_clone.js | |
parent | 382a978859a7a7a4351542be818bb2e59523429c (diff) |
Revert "refactor: update runtime code for primordial checks for "instanceof" (#13497)" (#13511)
This reverts commit 884143218fad0e18f7553aaf079d52de703f7601.
Diffstat (limited to 'ext/web/02_structured_clone.js')
-rw-r--r-- | ext/web/02_structured_clone.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/web/02_structured_clone.js b/ext/web/02_structured_clone.js index 058390cfe..005b668af 100644 --- a/ext/web/02_structured_clone.js +++ b/ext/web/02_structured_clone.js @@ -13,12 +13,10 @@ const { DOMException } = window.__bootstrap.domException; const { ArrayBuffer, - ArrayBufferPrototype, ArrayBufferIsView, - DataViewPrototype, - ObjectPrototypeIsPrototypeOf, + DataView, TypedArrayPrototypeSlice, - TypeErrorPrototype, + TypeError, WeakMap, WeakMapPrototypeSet, } = window.__bootstrap.primordials; @@ -44,7 +42,7 @@ function structuredClone(value) { // Performance optimization for buffers, otherwise // `serialize/deserialize` will allocate new buffer. - if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, value)) { + if (value instanceof ArrayBuffer) { const cloned = cloneArrayBuffer( value, 0, @@ -61,7 +59,7 @@ // only DataView has a length in bytes and TypedArrays use a length in // terms of elements, so we adjust for that. let length; - if (ObjectPrototypeIsPrototypeOf(DataViewPrototype, view)) { + if (value instanceof DataView) { length = value.byteLength; } else { length = value.length; @@ -76,7 +74,7 @@ try { return core.deserialize(core.serialize(value)); } catch (e) { - if (ObjectPrototypeIsPrototypeOf(TypeErrorPrototype, e)) { + if (e instanceof TypeError) { throw new DOMException("Uncloneable value", "DataCloneError"); } throw e; |