Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: make ModifyCodeGenerationFromStrings more robust #50763

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,18 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
bool is_code_like) {
HandleScope scope(context->GetIsolate());

if (context->GetNumberOfEmbedderDataFields() <=
legendecas marked this conversation as resolved.
Show resolved Hide resolved
ContextEmbedderIndex::kAllowCodeGenerationFromStrings) {
// The context is not (yet) configured by Node.js for this. We don't
// have enough information to make a decision, just allow it which is
// the default.
return {true, {}};
}
Environment* env = Environment::GetCurrent(context);
if (env->source_maps_enabled()) {
if (env == nullptr) {
return {true, {}};
}
if (env->source_maps_enabled() && env->can_call_into_js()) {
// We do not expect the maybe_cache_generated_source_map to throw any more
// exceptions. If it does, just ignore it.
errors::TryCatchScope try_catch(env);
Expand Down
Loading