Commit 579d9553 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[debug] do not handle debug interrupt in JSON parse/stringify.

R=jgruber@chromium.org

Bug: chromium:789472
Change-Id: I578c0fb13abaeaedcecf862c4e5aa7680b4067e8
Reviewed-on: https://chromium-review.googlesource.com/795972
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49718}
parent 5d4a0903
......@@ -39,6 +39,7 @@ class JsonParser BASE_EMBEDDED {
MUST_USE_RESULT static MaybeHandle<Object> Parse(Isolate* isolate,
Handle<String> source,
Handle<Object> reviver) {
PostponeInterruptsScope no_debug_breaks(isolate, StackGuard::DEBUGBREAK);
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(isolate, result,
JsonParser(isolate, source).ParseJson(), Object);
......
......@@ -94,6 +94,7 @@ MaybeHandle<Object> JsonStringifier::Stringify(Handle<Object> object,
if (!gap->IsUndefined(isolate_) && !InitializeGap(gap)) {
return MaybeHandle<Object>();
}
PostponeInterruptsScope no_debug_breaks(isolate_, StackGuard::DEBUGBREAK);
Result result = SerializeObject(object);
if (result == UNCHANGED) return factory()->undefined_value();
if (result == SUCCESS) return builder_.Finish();
......
......@@ -3951,6 +3951,36 @@ TEST(DebugBreak) {
CheckDebuggerUnloaded();
}
TEST(DebugBreakWithoutJS) {
i::FLAG_stress_compaction = false;
#ifdef VERIFY_HEAP
i::FLAG_verify_heap = true;
#endif
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::Local<v8::Context> context = env.context();
v8::HandleScope scope(isolate);
// Register a debug event listener which sets the break flag and counts.
SetDebugEventListener(isolate, DebugEventBreak);
// Set the debug break flag.
v8::debug::DebugBreak(env->GetIsolate());
v8::Local<v8::String> json = v8_str("[1]");
v8::Local<v8::Value> parsed = v8::JSON::Parse(context, json).ToLocalChecked();
CHECK(v8::JSON::Stringify(context, parsed)
.ToLocalChecked()
->Equals(context, json)
.FromJust());
CHECK_EQ(0, break_point_hit_count);
CompileRun("");
CHECK_EQ(1, break_point_hit_count);
// Get rid of the debug event listener.
SetDebugEventListener(isolate, nullptr);
CheckDebuggerUnloaded();
}
// Test to ensure that JavaScript code keeps running while the debug break
// through the stack limit flag is set but breaks are disabled.
......
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