summaryrefslogtreecommitdiff
path: root/runtime/js/11_workers.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 /runtime/js/11_workers.js
parentdcf8f144ab0516936bfa4e93357d71f1732d880e (diff)
refactor: update runtime code for primordial checks for "instanceof" (#13497)
Diffstat (limited to 'runtime/js/11_workers.js')
-rw-r--r--runtime/js/11_workers.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js
index 4510004d6..80e85a3a1 100644
--- a/runtime/js/11_workers.js
+++ b/runtime/js/11_workers.js
@@ -5,6 +5,7 @@
const core = window.Deno.core;
const {
Error,
+ ObjectPrototypeIsPrototypeOf,
StringPrototypeStartsWith,
String,
SymbolIterator,
@@ -16,8 +17,11 @@
const { serializePermissions } = window.__bootstrap.permissions;
const { log } = window.__bootstrap.util;
const { defineEventHandler } = window.__bootstrap.event;
- const { deserializeJsMessageData, serializeJsMessageData } =
- window.__bootstrap.messagePort;
+ const {
+ deserializeJsMessageData,
+ serializeJsMessageData,
+ MessagePortPrototype,
+ } = window.__bootstrap.messagePort;
function createWorker(
specifier,
@@ -199,7 +203,9 @@
const event = new MessageEvent("message", {
cancelable: false,
data: message,
- ports: transferables.filter((t) => t instanceof MessagePort),
+ ports: transferables.filter((t) =>
+ ObjectPrototypeIsPrototypeOf(MessagePortPrototype, t)
+ ),
});
this.dispatchEvent(event);
}