Commit 18455418 authored by svenpanne's avatar svenpanne Committed by Commit bot

Make GetDebugContext a bit more robust.

Perhaps we should throw an exception and/or change our external API to
use a MaybeLocal, but that would be a bigger change. For now, we just
return undefined when something goes wrong with the DebugContext,
which is good enough to avoid crashing.

BUG=chromium:474538
LOG=y

Review URL: https://codereview.chromium.org/1065213002

Cr-Commit-Position: refs/heads/master@{#27650}
parent f3338dd3
......@@ -2804,6 +2804,7 @@ void Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event,
Handle<Context> Debug::GetDebugContext() {
DebugScope debug_scope(this);
if (debug_scope.failed()) return Handle<Context>();
// The global handle may be destroyed soon after. Return it reboxed.
return handle(*debug_context(), isolate_);
}
......
......@@ -2659,6 +2659,7 @@ RUNTIME_FUNCTION(Runtime_GetDebugContext) {
HandleScope scope(isolate);
DCHECK(args.length() == 0);
Handle<Context> context = isolate->debug()->GetDebugContext();
if (context.is_null()) return isolate->heap()->undefined_value();
context->set_security_token(isolate->native_context()->security_token());
return context->global_proxy();
}
......
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