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/webidl/00_webidl.js | |
parent | 382a978859a7a7a4351542be818bb2e59523429c (diff) |
Revert "refactor: update runtime code for primordial checks for "instanceof" (#13497)" (#13511)
This reverts commit 884143218fad0e18f7553aaf079d52de703f7601.
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r-- | ext/webidl/00_webidl.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index de3221081..668c141cb 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -11,7 +11,7 @@ ((window) => { const core = window.Deno.core; const { - ArrayBufferPrototype, + ArrayBuffer, ArrayBufferIsView, ArrayPrototypeForEach, ArrayPrototypePush, @@ -20,6 +20,7 @@ BigInt, BigIntAsIntN, BigIntAsUintN, + DataView, Float32Array, Float64Array, FunctionPrototypeBind, @@ -49,7 +50,6 @@ ObjectGetOwnPropertyDescriptors, ObjectGetPrototypeOf, ObjectPrototypeHasOwnProperty, - ObjectPrototypeIsPrototypeOf, ObjectIs, PromisePrototypeThen, PromiseReject, @@ -434,11 +434,11 @@ } function isNonSharedArrayBuffer(V) { - return ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V); + return V instanceof ArrayBuffer; } function isSharedArrayBuffer(V) { - return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V); + return V instanceof SharedArrayBuffer; } converters.ArrayBuffer = (V, opts = {}) => { @@ -457,7 +457,7 @@ }; converters.DataView = (V, opts = {}) => { - if (!(ObjectPrototypeIsPrototypeOf(DataViewPrototype, V))) { + if (!(V instanceof DataView)) { throw makeException(TypeError, "is not a DataView", opts); } @@ -862,7 +862,7 @@ function createInterfaceConverter(name, prototype) { return (V, opts) => { - if (!ObjectPrototypeIsPrototypeOf(prototype, V) || V[brand] !== brand) { + if (!(V instanceof prototype) || V[brand] !== brand) { throw makeException(TypeError, `is not of type ${name}.`, opts); } return V; @@ -877,9 +877,7 @@ } function assertBranded(self, prototype) { - if ( - !ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand - ) { + if (!(self instanceof prototype) || self[brand] !== brand) { throw new TypeError("Illegal invocation"); } } @@ -946,7 +944,7 @@ } function entries() { - assertBranded(this, prototype.prototype); + assertBranded(this, prototype); return createDefaultIterator(this, "key+value"); } @@ -965,7 +963,7 @@ }, keys: { value: function keys() { - assertBranded(this, prototype.prototype); + assertBranded(this, prototype); return createDefaultIterator(this, "key"); }, writable: true, @@ -974,7 +972,7 @@ }, values: { value: function values() { - assertBranded(this, prototype.prototype); + assertBranded(this, prototype); return createDefaultIterator(this, "value"); }, writable: true, @@ -983,7 +981,7 @@ }, forEach: { value: function forEach(idlCallback, thisArg = undefined) { - assertBranded(this, prototype.prototype); + assertBranded(this, prototype); const prefix = `Failed to execute 'forEach' on '${name}'`; requiredArguments(arguments.length, 1, { prefix }); idlCallback = converters["Function"](idlCallback, { |