diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-01-27 13:36:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 13:36:36 +0100 |
commit | 884143218fad0e18f7553aaf079d52de703f7601 (patch) | |
tree | 9b9e9d30ea647041438ef8fa974b8d4234cabf73 /runtime/js/99_main.js | |
parent | dcf8f144ab0516936bfa4e93357d71f1732d880e (diff) |
refactor: update runtime code for primordial checks for "instanceof" (#13497)
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 = { |