summaryrefslogtreecommitdiff
path: root/runtime/js/11_workers.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-02-01 18:06:11 +0100
committerGitHub <noreply@github.com>2022-02-01 18:06:11 +0100
commit8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch)
tree94c7d6eb2679e641f59cf78640340f5b7af0022e /runtime/js/11_workers.js
parentabf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff)
refactor: primordials for instanceof (#13527)
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);
}