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 /runtime/js/99_main.js | |
parent | abf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff) |
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'runtime/js/99_main.js')
-rw-r--r-- | runtime/js/99_main.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index ba2b36705..5a4d7e989 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -16,6 +16,7 @@ delete Object.prototype.__proto__; ObjectDefineProperty, ObjectDefineProperties, ObjectFreeze, + ObjectPrototypeIsPrototypeOf, ObjectSetPrototypeOf, PromiseResolve, Symbol, @@ -142,7 +143,9 @@ delete Object.prototype.__proto__; const msgEvent = new MessageEvent("message", { cancelable: false, data: message, - ports: transferables.filter((t) => t instanceof MessagePort), + ports: transferables.filter((t) => + ObjectPrototypeIsPrototypeOf(messagePort.MessagePortPrototype, t) + ), }); try { @@ -311,7 +314,7 @@ delete Object.prototype.__proto__; configurable: true, enumerable: true, get() { - webidl.assertBranded(this, Navigator); + webidl.assertBranded(this, NavigatorPrototype); return webgpu.gpu; }, }, @@ -319,11 +322,12 @@ delete Object.prototype.__proto__; configurable: true, enumerable: true, get() { - webidl.assertBranded(this, Navigator); + webidl.assertBranded(this, NavigatorPrototype); return numCpus; }, }, }); + const NavigatorPrototype = Navigator.prototype; class WorkerNavigator { constructor() { @@ -342,7 +346,7 @@ delete Object.prototype.__proto__; configurable: true, enumerable: true, get() { - webidl.assertBranded(this, WorkerNavigator); + webidl.assertBranded(this, WorkerNavigatorPrototype); return webgpu.gpu; }, }, @@ -350,11 +354,12 @@ delete Object.prototype.__proto__; configurable: true, enumerable: true, get() { - webidl.assertBranded(this, WorkerNavigator); + webidl.assertBranded(this, WorkerNavigatorPrototype); return numCpus; }, }, }); + const WorkerNavigatorPrototype = WorkerNavigator.prototype; // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope const windowOrWorkerGlobalScope = { |