Commit a1418981 authored by yangguo's avatar yangguo Committed by Commit bot

[debugger] sunset --expose-debug-as flag.

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

Review-Url: https://codereview.chromium.org/2589083002
Cr-Commit-Position: refs/heads/master@{#41832}
parent fc209dc6
......@@ -4076,25 +4076,6 @@ bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate);
JSObject::AddProperty(Error, name, stack_trace_limit, NONE);
// Expose the debug global object in global if a name for it is specified.
if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
// If loading fails we just bail out without installing the
// debugger but without tanking the whole context.
Debug* debug = isolate->debug();
if (!debug->Load()) return true;
Handle<Context> debug_context = debug->debug_context();
// Set the security token for the debugger context to the same as
// the shell native context to allow calling between these (otherwise
// exposing debug global object doesn't make much sense).
debug_context->set_security_token(native_context->security_token());
Handle<String> debug_string =
factory->InternalizeUtf8String(FLAG_expose_debug_as);
uint32_t index;
if (debug_string->AsArrayIndex(&index)) return true;
Handle<Object> global_proxy(debug_context->global_proxy(), isolate);
JSObject::AddProperty(global, debug_string, global_proxy, DONT_ENUM);
}
WasmJs::Install(isolate, global);
return true;
......
......@@ -600,7 +600,6 @@ DEFINE_BOOL(script_streaming, true, "enable parsing on background")
// bootstrapper.cc
DEFINE_STRING(expose_natives_as, NULL, "expose natives in global object")
DEFINE_STRING(expose_debug_as, NULL, "expose debug in global object")
DEFINE_BOOL(expose_free_buffer, false, "expose freeBuffer extension")
DEFINE_BOOL(expose_gc, false, "expose gc extension")
DEFINE_STRING(expose_gc_as, NULL,
......
......@@ -3027,35 +3027,32 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
}
}
static int debug_break_count = 0;
static void DebugEventCounter(const v8::Debug::EventDetails& event_details) {
if (event_details.GetEvent() == v8::Break) debug_break_count++;
}
TEST(BytecodeGraphBuilderDebuggerStatement) {
FLAG_expose_debug_as = "debug";
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
Zone* zone = scope.main_zone();
v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter);
ExpectedSnippet<0> snippet = {
"var Debug = debug.Debug;"
"var count = 0;"
"function f() {"
" debugger;"
"}"
"function listener(event) {"
" if (event == Debug.DebugEvent.Break) count++;"
"}"
"Debug.setListener(listener);"
"f();"
"Debug.setListener(null);"
"return count;",
{handle(Smi::FromInt(1), isolate)}};
ScopedVector<char> script(1024);
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
snippet.code_snippet, kFunctionName);
"f();",
{isolate->factory()->undefined_value()}};
BytecodeGraphTester tester(isolate, zone, script.start());
BytecodeGraphTester tester(isolate, zone, snippet.code_snippet);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->SameValue(*snippet.return_value()));
v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr);
CHECK(return_value.is_identical_to(snippet.return_value()));
CHECK_EQ(2, debug_break_count);
}
} // namespace compiler
......
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