mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibJS: Propagate errors from Intrinsics initialization
This commit is contained in:
parent
af118f2a67
commit
53852452b2
6 changed files with 15 additions and 13 deletions
|
@ -15,13 +15,13 @@
|
|||
namespace JS {
|
||||
|
||||
// 9.3.1 CreateRealm ( ), https://tc39.es/ecma262/#sec-createrealm
|
||||
NonnullGCPtr<Realm> Realm::create(VM& vm)
|
||||
ThrowCompletionOr<NonnullGCPtr<Realm>> Realm::create(VM& vm)
|
||||
{
|
||||
// 1. Let realmRec be a new Realm Record.
|
||||
auto realm = vm.heap().allocate_without_realm<Realm>();
|
||||
|
||||
// 2. Perform CreateIntrinsics(realmRec).
|
||||
Intrinsics::create(*realm);
|
||||
MUST_OR_THROW_OOM(Intrinsics::create(*realm));
|
||||
|
||||
// 3. Set realmRec.[[GlobalObject]] to undefined.
|
||||
// 4. Set realmRec.[[GlobalEnv]] to undefined.
|
||||
|
@ -37,7 +37,7 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
|
|||
DeferGC defer_gc(vm.heap());
|
||||
|
||||
// 1. Let realm be CreateRealm().
|
||||
auto realm = Realm::create(vm);
|
||||
auto realm = MUST_OR_THROW_OOM(Realm::create(vm));
|
||||
|
||||
// 2. Let newContext be a new execution context.
|
||||
auto new_context = make<ExecutionContext>(vm.heap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue