summaryrefslogtreecommitdiff
path: root/ext/web/13_message_port.js
diff options
context:
space:
mode:
authorLaurence Rowe <l@lrowe.co.uk>2023-11-30 13:06:16 -0800
committerGitHub <noreply@github.com>2023-11-30 14:06:16 -0700
commit8050cbf39e69c1056eaa95e9e7b0887e50776b40 (patch)
treec0a16efef7ec272036fd1067e69325e0abec18f8 /ext/web/13_message_port.js
parentffa09541d76a9ad2fc56afee26e33a7c39489f1f (diff)
perf(ext/web): Avoid changing prototype by setting hostObjectBrand directly (#21358)
Diffstat (limited to 'ext/web/13_message_port.js')
-rw-r--r--ext/web/13_message_port.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 34f86f80c..2a0d864ba 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -26,7 +26,6 @@ const {
ArrayPrototypeIncludes,
ArrayPrototypePush,
ObjectPrototypeIsPrototypeOf,
- ObjectSetPrototypeOf,
Symbol,
SymbolFor,
SymbolIterator,
@@ -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;