Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: src/debug.cc

Issue 607913002: Report promise reject with no handler (behind a flag). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | src/execution.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index f0e77968eb48fb6135ff9a8636a4dac6adbd18ad..720c06524d09a92fa3bbe037a4cab06ffb6c462f 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -768,7 +768,8 @@ bool Debug::CompileDebuggerScript(Isolate* isolate, int index) {
isolate->ComputeLocation(&computed_location);
Handle<Object> message = MessageHandler::MakeMessageObject(
isolate, "error_loading_debugger", &computed_location,
- Vector<Handle<Object> >::empty(), Handle<JSArray>());
+ Vector<Handle<Object> >::empty(), Handle<JSObject>(),
+ Handle<JSArray>());
DCHECK(!isolate->has_pending_exception());
Handle<Object> exception;
if (maybe_exception.ToHandle(&exception)) {
@@ -1262,17 +1263,6 @@ bool Debug::IsBreakOnException(ExceptionBreakType type) {
}
-bool Debug::PromiseHasRejectHandler(Handle<JSObject> promise) {
- Handle<JSFunction> fun = Handle<JSFunction>::cast(
- JSObject::GetDataProperty(isolate_->js_builtins_object(),
- isolate_->factory()->NewStringFromStaticChars(
- "PromiseHasRejectHandler")));
- Handle<Object> result =
- Execution::Call(isolate_, fun, promise, 0, NULL).ToHandleChecked();
- return result->IsTrue();
-}
-
-
void Debug::PrepareStep(StepAction step_action,
int step_count,
StackFrame::Id frame_id) {
@@ -2501,7 +2491,8 @@ MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) {
}
-void Debug::OnThrow(Handle<Object> exception, bool uncaught) {
+void Debug::OnThrow(Handle<Object> exception, Handle<Object> promise,
+ bool uncaught) {
if (in_debug_scope() || ignore_events()) return;
// Temporarily clear any scheduled_exception to allow evaluating
// JavaScript from the debug event handler.
@@ -2511,7 +2502,7 @@ void Debug::OnThrow(Handle<Object> exception, bool uncaught) {
scheduled_exception = handle(isolate_->scheduled_exception(), isolate_);
isolate_->clear_scheduled_exception();
}
- OnException(exception, uncaught, isolate_->GetPromiseOnStackOnThrow());
+ OnException(exception, uncaught, promise);
if (!scheduled_exception.is_null()) {
isolate_->thread_local_top()->scheduled_exception_ = *scheduled_exception;
}
@@ -2527,8 +2518,12 @@ void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) {
void Debug::OnException(Handle<Object> exception, bool uncaught,
Handle<Object> promise) {
- if (promise->IsJSObject()) {
- uncaught |= !PromiseHasRejectHandler(Handle<JSObject>::cast(promise));
+ if (!uncaught && promise->IsJSObject()) {
+ Handle<Object> has_reject_handler;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, has_reject_handler,
+ Execution::PromiseHasRejectHandler(isolate_, promise), /* void */);
+ uncaught = has_reject_handler->IsFalse();
}
// Bail out if exception breaks are not active
if (uncaught) {
« no previous file with comments | « src/debug.h ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698