fix(core): Use primordials for methods (#18839)

I would like to get this change into Deno before merging
https://github.com/denoland/deno_lint/pull/1152
This commit is contained in:
Kenta Moriuchi 2023-05-01 22:30:02 +09:00 committed by GitHub
parent 94a148cdb6
commit 6728ad4203
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 378 additions and 270 deletions

View file

@ -4,10 +4,11 @@ const core = globalThis.Deno.core;
const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeFilter,
Error,
ObjectPrototypeIsPrototypeOf,
StringPrototypeStartsWith,
String,
StringPrototypeStartsWith,
SymbolIterator,
SymbolToStringTag,
} = primordials;
@ -192,8 +193,9 @@ class Worker extends EventTarget {
const event = new MessageEvent("message", {
cancelable: false,
data: message,
ports: transferables.filter((t) =>
ObjectPrototypeIsPrototypeOf(MessagePortPrototype, t)
ports: ArrayPrototypeFilter(
transferables,
(t) => ObjectPrototypeIsPrototypeOf(MessagePortPrototype, t),
),
});
this.dispatchEvent(event);