Commit 215e6682 authored by yangguo's avatar yangguo Committed by Commit bot

[serializer/debugger] hide scripts in the snapshot from the debugger.

R=jgruber@chromium.org
BUG=v8:6274

Review-Url: https://codereview.chromium.org/2826073004
Cr-Commit-Position: refs/heads/master@{#44745}
parent e24206b2
......@@ -2059,13 +2059,13 @@ void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id,
}
void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) {
if (!script->IsUserJavaScript() && script->type() != i::Script::TYPE_WASM) {
return;
}
// Attach the correct debug id to the script. The debug id is used by the
// inspector to filter scripts by native context.
script->set_context_data(isolate_->native_context()->debug_context_id());
if (ignore_events()) return;
if (!script->IsUserJavaScript() && script->type() != i::Script::TYPE_WASM) {
return;
}
if (!debug_delegate_) return;
SuppressDebug while_processing(this);
DebugScope debug_scope(this);
......
......@@ -73,6 +73,10 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
Address original_address = Foreign::cast(info->getter())->foreign_address();
Foreign::cast(info->js_getter())->set_foreign_address(original_address);
accessor_infos_.Add(info);
} else if (obj->IsScript() && Script::cast(obj)->IsUserJavaScript()) {
// Reset type for user scripts embedded in the start-up snapshot to hide
// them from the debugger.
Script::cast(obj)->set_type(Script::TYPE_EXTENSION);
}
// Object has not yet been serialized. Serialize it here.
......
......@@ -638,6 +638,11 @@ TEST(CustomSnapshotDataBlob1) {
CompileRun("f()")->Int32Value(isolate1->GetCurrentContext());
CHECK_EQ(42, result.FromJust());
CHECK(CompileRun("this.g")->IsUndefined());
v8::Local<v8::Value> f = CompileRun("f");
i::Handle<i::JSFunction> function =
i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*f));
// Being part of the snapshot hides a script from the debugger.
CHECK(!function->shared()->IsSubjectToDebugging());
}
isolate1->Dispose();
}
......
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