1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibJS+LibWeb: Add JS::Value constructor for `JS::Handle<T>`

Similar to the constructors for ``JS::{Nonnull}GCPtr<T>``, this helper
avoids unnecessary .ptr() clutter when we want to construct Values.
This commit is contained in:
Andrew Kaster 2023-12-18 14:01:39 -07:00 committed by Andrew Kaster
parent 9624eca116
commit d361221657
8 changed files with 13 additions and 7 deletions

View file

@ -59,7 +59,7 @@ JS::NonnullGCPtr<JS::Object> MessageEvent::ports() const
if (!m_ports_array) {
Vector<JS::Value> port_vector;
for (auto const& port : m_ports) {
port_vector.append(JS::Value(port.ptr()));
port_vector.append(port);
}
m_ports_array = JS::Array::create_from(realm(), port_vector);
MUST(m_ports_array->set_integrity_level(IntegrityLevel::Frozen));