mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix(ext/web): use Array primordials in MessagePort (#11680)
This commit is contained in:
parent
5d6d6836bb
commit
8481377500
1 changed files with 8 additions and 3 deletions
|
@ -15,6 +15,8 @@
|
|||
const { defineEventHandler } = window.__bootstrap.event;
|
||||
const { DOMException } = window.__bootstrap.domException;
|
||||
const {
|
||||
ArrayPrototypeIncludes,
|
||||
ArrayPrototypePush,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
|
@ -117,7 +119,7 @@
|
|||
);
|
||||
}
|
||||
const { transfer } = options;
|
||||
if (transfer.includes(this)) {
|
||||
if (ArrayPrototypeIncludes(transfer, this)) {
|
||||
throw new DOMException("Can not tranfer self", "DataCloneError");
|
||||
}
|
||||
const data = serializeJsMessageData(message, transfer);
|
||||
|
@ -196,7 +198,7 @@
|
|||
switch (transferable.kind) {
|
||||
case "messagePort": {
|
||||
const port = createMessagePort(transferable.data);
|
||||
transferables.push(port);
|
||||
ArrayPrototypePush(transferables, port);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -238,7 +240,10 @@
|
|||
);
|
||||
}
|
||||
transferable[_id] = null;
|
||||
serializedTransferables.push({ kind: "messagePort", data: id });
|
||||
ArrayPrototypePush(serializedTransferables, {
|
||||
kind: "messagePort",
|
||||
data: id,
|
||||
});
|
||||
} else {
|
||||
throw new DOMException("Value not transferable", "DataCloneError");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue