@@ -31,6 +31,7 @@ using v8::FunctionCallbackInfo;
3131using v8::HandleScope;
3232using v8::Isolate;
3333using v8::Just;
34+ using v8::JustVoid;
3435using v8::Local;
3536using v8::Maybe;
3637using v8::MaybeLocal;
@@ -635,7 +636,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
635636
636637// This runs at runtime, regardless of whether the context
637638// is created from a snapshot.
638- Maybe<bool > InitializeContextRuntime (Local<Context> context) {
639+ Maybe<void > InitializeContextRuntime (Local<Context> context) {
639640 Isolate* isolate = context->GetIsolate ();
640641 HandleScope handle_scope (isolate);
641642
@@ -653,7 +654,7 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
653654 Boolean::New (isolate, is_code_generation_from_strings_allowed));
654655
655656 if (per_process::cli_options->disable_proto == " " ) {
656- return Just ( true );
657+ return JustVoid ( );
657658 }
658659
659660 // Remove __proto__
@@ -669,14 +670,14 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
669670 if (!context->Global ()
670671 ->Get (context, object_string)
671672 .ToLocal (&object_v)) {
672- return Nothing<bool >();
673+ return Nothing<void >();
673674 }
674675
675676 Local<Value> prototype_v;
676677 if (!object_v.As <Object>()
677678 ->Get (context, prototype_string)
678679 .ToLocal (&prototype_v)) {
679- return Nothing<bool >();
680+ return Nothing<void >();
680681 }
681682
682683 prototype = prototype_v.As <Object>();
@@ -689,13 +690,13 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
689690 if (prototype
690691 ->Delete (context, proto_string)
691692 .IsNothing ()) {
692- return Nothing<bool >();
693+ return Nothing<void >();
693694 }
694695 } else if (per_process::cli_options->disable_proto == " throw" ) {
695696 Local<Value> thrower;
696697 if (!Function::New (context, ProtoThrower)
697698 .ToLocal (&thrower)) {
698- return Nothing<bool >();
699+ return Nothing<void >();
699700 }
700701
701702 PropertyDescriptor descriptor (thrower, thrower);
@@ -704,17 +705,17 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
704705 if (prototype
705706 ->DefineProperty (context, proto_string, descriptor)
706707 .IsNothing ()) {
707- return Nothing<bool >();
708+ return Nothing<void >();
708709 }
709710 } else if (per_process::cli_options->disable_proto != " " ) {
710711 // Validated in ProcessGlobalArgs
711712 UNREACHABLE (" invalid --disable-proto mode" );
712713 }
713714
714- return Just ( true );
715+ return JustVoid ( );
715716}
716717
717- Maybe<bool > InitializeBaseContextForSnapshot (Local<Context> context) {
718+ Maybe<void > InitializeBaseContextForSnapshot (Local<Context> context) {
718719 Isolate* isolate = context->GetIsolate ();
719720 HandleScope handle_scope (isolate);
720721
@@ -728,18 +729,18 @@ Maybe<bool> InitializeBaseContextForSnapshot(Local<Context> context) {
728729
729730 Local<Value> intl_v;
730731 if (!context->Global ()->Get (context, intl_string).ToLocal (&intl_v)) {
731- return Nothing<bool >();
732+ return Nothing<void >();
732733 }
733734
734735 if (intl_v->IsObject () &&
735736 intl_v.As <Object>()->Delete (context, break_iter_string).IsNothing ()) {
736- return Nothing<bool >();
737+ return Nothing<void >();
737738 }
738739 }
739- return Just ( true );
740+ return JustVoid ( );
740741}
741742
742- Maybe<bool > InitializeMainContextForSnapshot (Local<Context> context) {
743+ Maybe<void > InitializeMainContextForSnapshot (Local<Context> context) {
743744 Isolate* isolate = context->GetIsolate ();
744745 HandleScope handle_scope (isolate);
745746
@@ -750,12 +751,12 @@ Maybe<bool> InitializeMainContextForSnapshot(Local<Context> context) {
750751 ContextEmbedderIndex::kAllowCodeGenerationFromStrings , True (isolate));
751752
752753 if (InitializeBaseContextForSnapshot (context).IsNothing ()) {
753- return Nothing<bool >();
754+ return Nothing<void >();
754755 }
755756 return InitializePrimordials (context);
756757}
757758
758- Maybe<bool > InitializePrimordials (Local<Context> context) {
759+ Maybe<void > InitializePrimordials (Local<Context> context) {
759760 // Run per-context JS files.
760761 Isolate* isolate = context->GetIsolate ();
761762 Context::Scope context_scope (context);
@@ -769,7 +770,7 @@ Maybe<bool> InitializePrimordials(Local<Context> context) {
769770 if (primordials->SetPrototype (context, Null (isolate)).IsNothing () ||
770771 !GetPerContextExports (context).ToLocal (&exports) ||
771772 exports->Set (context, primordials_string, primordials).IsNothing ()) {
772- return Nothing<bool >();
773+ return Nothing<void >();
773774 }
774775
775776 static const char * context_files[] = {" internal/per_context/primordials" ,
@@ -793,11 +794,11 @@ Maybe<bool> InitializePrimordials(Local<Context> context) {
793794 context, *module , arraysize (arguments), arguments, nullptr )
794795 .IsEmpty ()) {
795796 // Execution failed during context creation.
796- return Nothing<bool >();
797+ return Nothing<void >();
797798 }
798799 }
799800
800- return Just ( true );
801+ return JustVoid ( );
801802}
802803
803804// This initializes the main context (i.e. vm contexts are not included).
@@ -806,7 +807,10 @@ Maybe<bool> InitializeContext(Local<Context> context) {
806807 return Nothing<bool >();
807808 }
808809
809- return InitializeContextRuntime (context);
810+ if (InitializeContextRuntime (context).IsNothing ()) {
811+ return Nothing<bool >();
812+ }
813+ return Just (true );
810814}
811815
812816uv_loop_t * GetCurrentEventLoop (Isolate* isolate) {
0 commit comments