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}
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_);
}
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();
}