Browse Source

LibWeb: Make factory method of CSS::Screen fallible

Kenneth Myhra 2 years ago
parent
commit
57c34e6325

+ 2 - 2
Userland/Libraries/LibWeb/CSS/Screen.cpp

@@ -13,9 +13,9 @@
 
 namespace Web::CSS {
 
-JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<Screen>> Screen::create(HTML::Window& window)
 {
-    return window.heap().allocate<Screen>(window.realm(), window).release_allocated_value_but_fixme_should_propagate_errors();
+    return MUST_OR_THROW_OOM(window.heap().allocate<Screen>(window.realm(), window));
 }
 
 Screen::Screen(HTML::Window& window)

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Screen.h

@@ -17,7 +17,7 @@ class Screen final : public Bindings::PlatformObject {
     WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject);
 
 public:
-    static JS::NonnullGCPtr<Screen> create(HTML::Window&);
+    static WebIDL::ExceptionOr<JS::NonnullGCPtr<Screen>> create(HTML::Window&);
 
     i32 width() const { return screen_rect().width(); }
     i32 height() const { return screen_rect().height(); }