1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +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

@ -26,7 +26,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStream>> WritableStream::construct_
auto writable_stream = realm.heap().allocate<WritableStream>(realm, realm);
// 1. If underlyingSink is missing, set it to null.
auto underlying_sink = underlying_sink_object.has_value() ? JS::Value(underlying_sink_object.value().ptr()) : JS::js_null();
auto underlying_sink = underlying_sink_object.has_value() ? JS::Value(underlying_sink_object.value()) : JS::js_null();
// 2. Let underlyingSinkDict be underlyingSink, converted to an IDL value of type UnderlyingSink.
auto underlying_sink_dict = TRY(UnderlyingSink::from_value(vm, underlying_sink));