mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +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
|
@ -15,9 +15,9 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Navigator>> Navigator::create(JS::Realm& realm)
|
||||
JS::NonnullGCPtr<Navigator> Navigator::create(JS::Realm& realm)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<Navigator>(realm, realm));
|
||||
return realm.heap().allocate<Navigator>(realm, realm);
|
||||
}
|
||||
|
||||
Navigator::Navigator(JS::Realm& realm)
|
||||
|
@ -59,17 +59,17 @@ void Navigator::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_plugin_array);
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<MimeTypeArray>> Navigator::mime_types()
|
||||
JS::NonnullGCPtr<MimeTypeArray> Navigator::mime_types()
|
||||
{
|
||||
if (!m_mime_type_array)
|
||||
m_mime_type_array = TRY(heap().allocate<MimeTypeArray>(realm(), realm()));
|
||||
m_mime_type_array = heap().allocate<MimeTypeArray>(realm(), realm());
|
||||
return *m_mime_type_array;
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<PluginArray>> Navigator::plugins()
|
||||
JS::NonnullGCPtr<PluginArray> Navigator::plugins()
|
||||
{
|
||||
if (!m_plugin_array)
|
||||
m_plugin_array = TRY(heap().allocate<PluginArray>(realm(), realm()));
|
||||
m_plugin_array = heap().allocate<PluginArray>(realm(), realm());
|
||||
return *m_plugin_array;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue