mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 07:52:50 +00:00
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:
parent
3a0e69d86f
commit
80658743d3
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/shannonbooth
Commit: 80658743d3
Pull-request: https://github.com/SerenityOS/serenity/pull/23877
Reviewed-by: https://github.com/kennethmyhra ✅
7 changed files with 11 additions and 11 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue