mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:27:35 +00:00
LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449. While going through these, I also changed the function signature in many places where returning ThrowCompletionOr<T> is no longer necessary.
This commit is contained in:
parent
980e7164fe
commit
72c9f56c66
337 changed files with 1229 additions and 1251 deletions
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Web::WebGL {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::create(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init)
|
||||
JS::NonnullGCPtr<WebGLContextEvent> WebGLContextEvent::create(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<WebGLContextEvent>(realm, realm, event_name, event_init));
|
||||
return realm.heap().allocate<WebGLContextEvent>(realm, realm, event_name, event_init);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init)
|
||||
|
|
|
@ -20,8 +20,8 @@ class WebGLContextEvent final : public DOM::Event {
|
|||
WEB_PLATFORM_OBJECT(WebGLContextEvent, DOM::Event);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> create(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<WebGLContextEvent> create(JS::Realm&, FlyString const& type, WebGLContextEventInit const&);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, FlyString const& type, WebGLContextEventInit const&);
|
||||
|
||||
virtual ~WebGLContextEvent() override;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, Fl
|
|||
{
|
||||
// To fire a WebGL context event named e means that an event using the WebGLContextEvent interface, with its type attribute [DOM4] initialized to e, its cancelable attribute initialized to true, and its isTrusted attribute [DOM4] initialized to true, is to be dispatched at the given object.
|
||||
// FIXME: Consider setting a status message.
|
||||
auto event = WebGLContextEvent::create(canvas_element.realm(), type, WebGLContextEventInit {}).release_value_but_fixme_should_propagate_errors();
|
||||
auto event = WebGLContextEvent::create(canvas_element.realm(), type, WebGLContextEventInit {});
|
||||
event->set_is_trusted(true);
|
||||
event->set_cancelable(true);
|
||||
canvas_element.dispatch_event(*event);
|
||||
|
@ -47,7 +47,7 @@ JS::ThrowCompletionOr<JS::GCPtr<WebGLRenderingContext>> WebGLRenderingContext::c
|
|||
fire_webgl_context_creation_error(canvas_element);
|
||||
return JS::GCPtr<WebGLRenderingContext> { nullptr };
|
||||
}
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<WebGLRenderingContext>(realm, realm, canvas_element, context_or_error.release_value(), context_attributes, context_attributes));
|
||||
return realm.heap().allocate<WebGLRenderingContext>(realm, realm, canvas_element, context_or_error.release_value(), context_attributes, context_attributes);
|
||||
}
|
||||
|
||||
WebGLRenderingContext::WebGLRenderingContext(JS::Realm& realm, HTML::HTMLCanvasElement& canvas_element, NonnullOwnPtr<GL::GLContext> context, WebGLContextAttributes context_creation_parameters, WebGLContextAttributes actual_context_parameters)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue