mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:37:44 +00:00
LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs. Work towards #20405
This commit is contained in:
parent
fde26c53f0
commit
18c54d8d40
804 changed files with 1330 additions and 2171 deletions
|
@ -27,12 +27,12 @@ $262Object::$262Object(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> $262Object::initialize(Realm& realm)
|
||||
void $262Object::initialize(Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
Base::initialize(realm);
|
||||
|
||||
m_agent = MUST_OR_THROW_OOM(vm().heap().allocate<AgentObject>(realm, realm));
|
||||
m_is_htmldda = MUST_OR_THROW_OOM(vm().heap().allocate<IsHTMLDDA>(realm, realm));
|
||||
m_agent = MUST(vm().heap().allocate<AgentObject>(realm, realm));
|
||||
m_is_htmldda = MUST(vm().heap().allocate<IsHTMLDDA>(realm, realm));
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, "clearKeptObjects", clear_kept_objects, 0, attr);
|
||||
|
@ -44,8 +44,6 @@ ThrowCompletionOr<void> $262Object::initialize(Realm& realm)
|
|||
define_direct_property("gc", realm.global_object().get_without_side_effects("gc"), attr);
|
||||
define_direct_property("global", &realm.global_object(), attr);
|
||||
define_direct_property("IsHTMLDDA", m_is_htmldda, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void $262Object::visit_edges(Cell::Visitor& visitor)
|
||||
|
@ -68,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm)
|
|||
VERIFY(realm_global_object);
|
||||
realm->set_global_object(realm_global_object, nullptr);
|
||||
set_default_global_bindings(*realm);
|
||||
MUST_OR_THROW_OOM(realm_global_object->initialize(*realm));
|
||||
realm_global_object->initialize(*realm);
|
||||
return Value(realm_global_object->$262());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class $262Object final : public Object {
|
|||
JS_OBJECT($262Object, Object);
|
||||
|
||||
public:
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~$262Object() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,9 +17,9 @@ AgentObject::AgentObject(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> AgentObject::initialize(JS::Realm& realm)
|
||||
void AgentObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
Base::initialize(realm);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, "monotonicNow", monotonic_now, 0, attr);
|
||||
|
@ -27,8 +27,6 @@ JS::ThrowCompletionOr<void> AgentObject::initialize(JS::Realm& realm)
|
|||
// TODO: broadcast
|
||||
// TODO: getReport
|
||||
// TODO: start
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(AgentObject::monotonic_now)
|
||||
|
|
|
@ -15,7 +15,7 @@ class AgentObject final : public Object {
|
|||
JS_OBJECT(AgentObject, Object);
|
||||
|
||||
public:
|
||||
virtual JS::ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AgentObject() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -14,18 +14,16 @@
|
|||
|
||||
namespace JS::Test262 {
|
||||
|
||||
ThrowCompletionOr<void> GlobalObject::initialize(Realm& realm)
|
||||
void GlobalObject::initialize(Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
Base::initialize(realm);
|
||||
|
||||
m_$262 = MUST_OR_THROW_OOM(vm().heap().allocate<$262Object>(realm, realm));
|
||||
m_$262 = MUST(vm().heap().allocate<$262Object>(realm, realm));
|
||||
|
||||
// https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, "print", print, 1, attr);
|
||||
define_direct_property("$262", m_$262, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void GlobalObject::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -15,7 +15,7 @@ class GlobalObject final : public JS::GlobalObject {
|
|||
JS_OBJECT(GlobalObject, JS::GlobalObject);
|
||||
|
||||
public:
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GlobalObject() override = default;
|
||||
|
||||
$262Object* $262() const { return m_$262; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue