Skip to content

Commit

Permalink
perf(ext/web): Avoid changing prototype by setting hostObjectBrand di…
Browse files Browse the repository at this point in the history
…rectly

* Depends on: denoland/deno_core#207
  • Loading branch information
lrowe committed Nov 28, 2023
1 parent d65a297 commit 3850051
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ext/web/13_message_port.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const {
ArrayPrototypeIncludes,
ArrayPrototypePush,
ObjectPrototypeIsPrototypeOf,
ObjectSetPrototypeOf,
Symbol,
SymbolFor,
SymbolIterator,
Expand Down Expand Up @@ -84,9 +83,8 @@ const _enabled = Symbol("enabled");
* @returns {MessagePort}
*/
function createMessagePort(id) {
const port = core.createHostObject();
ObjectSetPrototypeOf(port, MessagePortPrototype);
port[webidl.brand] = webidl.brand;
const port = webidl.createBranded(MessagePort);
port[core.hostObjectBrand] = core.hostObjectBrand;
setEventTargetData(port);
port[_id] = id;
return port;
Expand Down

0 comments on commit 3850051

Please sign in to comment.