Commit e3f54910 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[debugger] Move ScriptContext creation side effect check to Invoke

Otherwise the side effect is already applied before we throw the exception,
already breaking the environment.

Bug: chromium:1043151
Change-Id: I6d6b4706481bd8eaead6de3503aabc4bad9fb6de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2016597
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65982}
parent 3fa30b25
......@@ -864,9 +864,8 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
info->DebugName().ToCString().get());
}
if (info->needs_script_context()) return DebugInfo::kHasSideEffects;
DCHECK(info->is_compiled());
DCHECK(!info->needs_script_context());
if (info->HasBytecodeArray()) {
// Check bytecodes against whitelist.
Handle<BytecodeArray> bytecode_array(info->GetBytecodeArray(), isolate);
......
......@@ -159,6 +159,13 @@ Handle<Code> JSEntry(Isolate* isolate, Execution::Target execution_target,
MaybeHandle<Context> NewScriptContext(Isolate* isolate,
Handle<JSFunction> function) {
// Creating a script context is a side effect, so abort if that's not
// allowed.
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) {
isolate->Throw(*isolate->factory()->NewEvalError(
MessageTemplate::kNoSideEffectDebugEvaluate));
return MaybeHandle<Context>();
}
SaveAndSwitchContext save(isolate, function->context());
SharedFunctionInfo sfi = function->shared();
Handle<Script> script(Script::cast(sfi.script()), isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment