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