summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-12 20:29:30 +0100
committerSam Atkins <atkinssj@gmail.com>2023-02-12 21:35:59 +0000
commitf698585097fcc1cd2770483dcfea774279c5a770 (patch)
tree4b954d9661b46517e2bb2d4d378f8df8919517ee /Userland
parent4b1e501bdfd4bad98b140ed7bcbfac01aa4e5e80 (diff)
downloadserenity-f698585097fcc1cd2770483dcfea774279c5a770.zip
LibWeb: Move setting of FormDataPrototype to initialize()
This moves the setting of FormDataPrototype out of the constructor to initialize().
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/XHR/FormData.cpp9
-rw-r--r--Userland/Libraries/LibWeb/XHR/FormData.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/FormData.cpp b/Userland/Libraries/LibWeb/XHR/FormData.cpp
index 82014ba4f3..19722689bc 100644
--- a/Userland/Libraries/LibWeb/XHR/FormData.cpp
+++ b/Userland/Libraries/LibWeb/XHR/FormData.cpp
@@ -42,11 +42,18 @@ FormData::FormData(JS::Realm& realm, HashMap<DeprecatedString, Vector<FormDataEn
: PlatformObject(realm)
, m_entry_list(move(entry_list))
{
- set_prototype(&Bindings::ensure_web_prototype<Bindings::FormDataPrototype>(realm, "FormData"));
}
FormData::~FormData() = default;
+JS::ThrowCompletionOr<void> FormData::initialize(JS::Realm& realm)
+{
+ MUST_OR_THROW_OOM(Base::initialize(realm));
+ set_prototype(&Bindings::ensure_web_prototype<Bindings::FormDataPrototype>(realm, "FormData"));
+
+ return {};
+}
+
void FormData::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
diff --git a/Userland/Libraries/LibWeb/XHR/FormData.h b/Userland/Libraries/LibWeb/XHR/FormData.h
index 3156de0057..99171309a6 100644
--- a/Userland/Libraries/LibWeb/XHR/FormData.h
+++ b/Userland/Libraries/LibWeb/XHR/FormData.h
@@ -39,6 +39,7 @@ public:
private:
explicit FormData(JS::Realm&, HashMap<DeprecatedString, Vector<FormDataEntryValue>> entry_list = {});
+ virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
WebIDL::ExceptionOr<void> append_impl(String const& name, Variant<JS::NonnullGCPtr<FileAPI::Blob>, String> const& value, Optional<String> const& filename = {});