diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-08-13 13:43:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 10:13:46 +0200 |
commit | 848137750005e27c7afb0794a51751db3ab5e5fa (patch) | |
tree | 2da84bec9a665eb25ac245bafbae3fde4b133fdf | |
parent | 5d6d6836bb181c7c8624d8635fb15af9a9425bfd (diff) |
fix(ext/web): use Array primordials in MessagePort (#11680)
-rw-r--r-- | ext/web/13_message_port.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js index d5014fdb9..d0d9e160e 100644 --- a/ext/web/13_message_port.js +++ b/ext/web/13_message_port.js @@ -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"); } |