@@ -31,6 +31,7 @@ using v8::FunctionCallbackInfo;
31
31
using v8::HandleScope;
32
32
using v8::Isolate;
33
33
using v8::Just;
34
+ using v8::JustVoid;
34
35
using v8::Local;
35
36
using v8::Maybe;
36
37
using v8::MaybeLocal;
@@ -635,7 +636,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
635
636
636
637
// This runs at runtime, regardless of whether the context
637
638
// is created from a snapshot.
638
- Maybe<bool > InitializeContextRuntime (Local<Context> context) {
639
+ Maybe<void > InitializeContextRuntime (Local<Context> context) {
639
640
Isolate* isolate = context->GetIsolate ();
640
641
HandleScope handle_scope (isolate);
641
642
@@ -653,7 +654,7 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
653
654
Boolean::New (isolate, is_code_generation_from_strings_allowed));
654
655
655
656
if (per_process::cli_options->disable_proto == " " ) {
656
- return Just ( true );
657
+ return JustVoid ( );
657
658
}
658
659
659
660
// Remove __proto__
@@ -669,14 +670,14 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
669
670
if (!context->Global ()
670
671
->Get (context, object_string)
671
672
.ToLocal (&object_v)) {
672
- return Nothing<bool >();
673
+ return Nothing<void >();
673
674
}
674
675
675
676
Local<Value> prototype_v;
676
677
if (!object_v.As <Object>()
677
678
->Get (context, prototype_string)
678
679
.ToLocal (&prototype_v)) {
679
- return Nothing<bool >();
680
+ return Nothing<void >();
680
681
}
681
682
682
683
prototype = prototype_v.As <Object>();
@@ -689,13 +690,13 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
689
690
if (prototype
690
691
->Delete (context, proto_string)
691
692
.IsNothing ()) {
692
- return Nothing<bool >();
693
+ return Nothing<void >();
693
694
}
694
695
} else if (per_process::cli_options->disable_proto == " throw" ) {
695
696
Local<Value> thrower;
696
697
if (!Function::New (context, ProtoThrower)
697
698
.ToLocal (&thrower)) {
698
- return Nothing<bool >();
699
+ return Nothing<void >();
699
700
}
700
701
701
702
PropertyDescriptor descriptor (thrower, thrower);
@@ -704,17 +705,17 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
704
705
if (prototype
705
706
->DefineProperty (context, proto_string, descriptor)
706
707
.IsNothing ()) {
707
- return Nothing<bool >();
708
+ return Nothing<void >();
708
709
}
709
710
} else if (per_process::cli_options->disable_proto != " " ) {
710
711
// Validated in ProcessGlobalArgs
711
712
UNREACHABLE (" invalid --disable-proto mode" );
712
713
}
713
714
714
- return Just ( true );
715
+ return JustVoid ( );
715
716
}
716
717
717
- Maybe<bool > InitializeBaseContextForSnapshot (Local<Context> context) {
718
+ Maybe<void > InitializeBaseContextForSnapshot (Local<Context> context) {
718
719
Isolate* isolate = context->GetIsolate ();
719
720
HandleScope handle_scope (isolate);
720
721
@@ -728,18 +729,18 @@ Maybe<bool> InitializeBaseContextForSnapshot(Local<Context> context) {
728
729
729
730
Local<Value> intl_v;
730
731
if (!context->Global ()->Get (context, intl_string).ToLocal (&intl_v)) {
731
- return Nothing<bool >();
732
+ return Nothing<void >();
732
733
}
733
734
734
735
if (intl_v->IsObject () &&
735
736
intl_v.As <Object>()->Delete (context, break_iter_string).IsNothing ()) {
736
- return Nothing<bool >();
737
+ return Nothing<void >();
737
738
}
738
739
}
739
- return Just ( true );
740
+ return JustVoid ( );
740
741
}
741
742
742
- Maybe<bool > InitializeMainContextForSnapshot (Local<Context> context) {
743
+ Maybe<void > InitializeMainContextForSnapshot (Local<Context> context) {
743
744
Isolate* isolate = context->GetIsolate ();
744
745
HandleScope handle_scope (isolate);
745
746
@@ -750,12 +751,12 @@ Maybe<bool> InitializeMainContextForSnapshot(Local<Context> context) {
750
751
ContextEmbedderIndex::kAllowCodeGenerationFromStrings , True (isolate));
751
752
752
753
if (InitializeBaseContextForSnapshot (context).IsNothing ()) {
753
- return Nothing<bool >();
754
+ return Nothing<void >();
754
755
}
755
756
return InitializePrimordials (context);
756
757
}
757
758
758
- Maybe<bool > InitializePrimordials (Local<Context> context) {
759
+ Maybe<void > InitializePrimordials (Local<Context> context) {
759
760
// Run per-context JS files.
760
761
Isolate* isolate = context->GetIsolate ();
761
762
Context::Scope context_scope (context);
@@ -769,7 +770,7 @@ Maybe<bool> InitializePrimordials(Local<Context> context) {
769
770
if (primordials->SetPrototype (context, Null (isolate)).IsNothing () ||
770
771
!GetPerContextExports (context).ToLocal (&exports) ||
771
772
exports->Set (context, primordials_string, primordials).IsNothing ()) {
772
- return Nothing<bool >();
773
+ return Nothing<void >();
773
774
}
774
775
775
776
static const char * context_files[] = {" internal/per_context/primordials" ,
@@ -793,11 +794,11 @@ Maybe<bool> InitializePrimordials(Local<Context> context) {
793
794
context, *module, arraysize (arguments), arguments, nullptr )
794
795
.IsEmpty ()) {
795
796
// Execution failed during context creation.
796
- return Nothing<bool >();
797
+ return Nothing<void >();
797
798
}
798
799
}
799
800
800
- return Just ( true );
801
+ return JustVoid ( );
801
802
}
802
803
803
804
// This initializes the main context (i.e. vm contexts are not included).
@@ -806,7 +807,10 @@ Maybe<bool> InitializeContext(Local<Context> context) {
806
807
return Nothing<bool >();
807
808
}
808
809
809
- return InitializeContextRuntime (context);
810
+ if (InitializeContextRuntime (context).IsNothing ()) {
811
+ return Nothing<bool >();
812
+ }
813
+ return Just (true );
810
814
}
811
815
812
816
uv_loop_t * GetCurrentEventLoop (Isolate* isolate) {
0 commit comments