script: Make set_dictionary_property a safe function (#39191)

Makes `set_dictionary_property` safe.

Testing: Changes are internal, this shouldn't affect behavior.
Fixes: #39128

Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
lumiscosity 2025-09-07 13:56:20 +02:00 committed by GitHub
parent af8723c0b1
commit 088d16d634
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 20 deletions

View file

@ -222,16 +222,12 @@ impl MessagePort {
type_.safe_to_jsval(cx, type_string.handle_mut());
// Perform ! CreateDataProperty(message, "type", type).
unsafe {
set_dictionary_property(*cx, message.handle(), "type", type_string.handle())
.expect("Setting the message type should not fail.");
}
set_dictionary_property(cx, message.handle(), "type", type_string.handle())
.expect("Setting the message type should not fail.");
// Perform ! CreateDataProperty(message, "value", value).
unsafe {
set_dictionary_property(*cx, message.handle(), "value", value)
.expect("Setting the message value should not fail.");
}
set_dictionary_property(cx, message.handle(), "value", value)
.expect("Setting the message value should not fail.");
// Let targetPort be the port with which port is entangled, if any; otherwise let it be null.
// Done in `global.post_messageport_msg`.