1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibWeb: Make factory method of HTML::Window fallible

This commit is contained in:
Kenneth Myhra 2023-02-15 20:04:35 +01:00 committed by Linus Groh
parent b41401bab2
commit 3e834636a6
4 changed files with 5 additions and 5 deletions

View file

@ -178,7 +178,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
Bindings::main_thread_vm(), Bindings::main_thread_vm(),
[&](JS::Realm& realm) -> JS::Object* { [&](JS::Realm& realm) -> JS::Object* {
// - For the global object, create a new Window object. // - For the global object, create a new Window object.
window = HTML::Window::create(realm); window = HTML::Window::create(realm).release_value_but_fixme_should_propagate_errors();
return window; return window;
}, },
[&](JS::Realm&) -> JS::Object* { [&](JS::Realm&) -> JS::Object* {

View file

@ -118,7 +118,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context
browsing_context->m_window_proxy = realm.heap().allocate<WindowProxy>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors(); browsing_context->m_window_proxy = realm.heap().allocate<WindowProxy>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
// - For the global object, create a new Window object. // - For the global object, create a new Window object.
window = HTML::Window::create(realm); window = HTML::Window::create(realm).release_value_but_fixme_should_propagate_errors();
return window.ptr(); return window.ptr();
}, },
[&](JS::Realm&) -> JS::Object* { [&](JS::Realm&) -> JS::Object* {

View file

@ -86,9 +86,9 @@ private:
u32 m_handle { 0 }; u32 m_handle { 0 };
}; };
JS::NonnullGCPtr<Window> Window::create(JS::Realm& realm) WebIDL::ExceptionOr<JS::NonnullGCPtr<Window>> Window::create(JS::Realm& realm)
{ {
return realm.heap().allocate<Window>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors(); return MUST_OR_THROW_OOM(realm.heap().allocate<Window>(realm, realm));
} }
Window::Window(JS::Realm& realm) Window::Window(JS::Realm& realm)

View file

@ -37,7 +37,7 @@ class Window final
WEB_PLATFORM_OBJECT(Window, DOM::EventTarget); WEB_PLATFORM_OBJECT(Window, DOM::EventTarget);
public: public:
static JS::NonnullGCPtr<Window> create(JS::Realm&); static WebIDL::ExceptionOr<JS::NonnullGCPtr<Window>> create(JS::Realm&);
~Window(); ~Window();