File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -758,7 +758,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
758
758
if (InitializeBaseContextForSnapshot (context).IsNothing ()) {
759
759
return Nothing<void >();
760
760
}
761
- return InitializePrimordials (context );
761
+ return JustVoid ( );
762
762
}
763
763
764
764
Maybe<void > InitializePrimordials (Local<Context> context) {
@@ -767,13 +767,18 @@ Maybe<void> InitializePrimordials(Local<Context> context) {
767
767
Context::Scope context_scope (context);
768
768
Local<Object> exports;
769
769
770
+ if (!GetPerContextExports (context).ToLocal (&exports)) {
771
+ return Nothing<void >();
772
+ }
770
773
Local<String> primordials_string =
771
774
FIXED_ONE_BYTE_STRING (isolate, " primordials" );
775
+ // Ensure that `InitializePrimordials` is called exactly once on a given
776
+ // context.
777
+ CHECK (!exports->Has (context, primordials_string).FromJust ());
772
778
773
- // Create primordials first and make it available to per-context scripts.
774
779
Local<Object> primordials = Object::New (isolate);
780
+ // Create primordials and make it available to per-context scripts.
775
781
if (primordials->SetPrototypeV2 (context, Null (isolate)).IsNothing () ||
776
- !GetPerContextExports (context).ToLocal (&exports) ||
777
782
exports->Set (context, primordials_string, primordials).IsNothing ()) {
778
783
return Nothing<void >();
779
784
}
You can’t perform that action at this time.
0 commit comments