LibWeb: Generate Optional<NonnullGCPtr<T>> as GCPtr<T>

This is the general pattern which has been adopted in LibWeb, so let's
generate our IDL like this too.
This commit is contained in:
Shannon Booth 2024-04-07 15:10:36 +02:00 committed by Andreas Kling
parent 3a0e69d86f
commit 80658743d3
Notes: sideshowbarker 2024-07-17 10:54:57 +09:00
7 changed files with 11 additions and 11 deletions

View file

@ -18,13 +18,13 @@ namespace Web::XHR {
JS_DEFINE_ALLOCATOR(FormData);
// https://xhr.spec.whatwg.org/#dom-formdata
WebIDL::ExceptionOr<JS::NonnullGCPtr<FormData>> FormData::construct_impl(JS::Realm& realm, Optional<JS::NonnullGCPtr<HTML::HTMLFormElement>> form)
WebIDL::ExceptionOr<JS::NonnullGCPtr<FormData>> FormData::construct_impl(JS::Realm& realm, JS::GCPtr<HTML::HTMLFormElement> form)
{
Vector<FormDataEntry> list;
// 1. If form is given, then:
if (form.has_value()) {
if (form) {
// 1. Let list be the result of constructing the entry list for form.
auto entry_list = TRY(construct_entry_list(realm, form.value()));
auto entry_list = TRY(construct_entry_list(realm, *form));
// 2. If list is null, then throw an "InvalidStateError" DOMException.
if (!entry_list.has_value())
return WebIDL::InvalidStateError::create(realm, "Form element does not contain any entries."_fly_string);