| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 if (in_debug_scope() || ignore_events()) return; | 1686 if (in_debug_scope() || ignore_events()) return; |
| 1687 HandleScope scope(isolate_); | 1687 HandleScope scope(isolate_); |
| 1688 // Check whether the promise has been marked as having triggered a message. | 1688 // Check whether the promise has been marked as having triggered a message. |
| 1689 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1689 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
| 1690 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate_)) { | 1690 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate_)) { |
| 1691 OnException(value, promise); | 1691 OnException(value, promise); |
| 1692 } | 1692 } |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 | 1695 |
| 1696 MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler( | |
| 1697 Handle<JSObject> promise) { | |
| 1698 Handle<JSFunction> fun = isolate_->promise_has_user_defined_reject_handler(); | |
| 1699 return Execution::Call(isolate_, fun, promise, 0, NULL); | |
| 1700 } | |
| 1701 | |
| 1702 | |
| 1703 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 1696 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
| 1704 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); | 1697 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
| 1705 | 1698 |
| 1706 // Don't notify listener of exceptions that are internal to a desugaring. | 1699 // Don't notify listener of exceptions that are internal to a desugaring. |
| 1707 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; | 1700 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; |
| 1708 | 1701 |
| 1709 bool uncaught = (catch_type == Isolate::NOT_CAUGHT); | 1702 bool uncaught = (catch_type == Isolate::NOT_CAUGHT || |
| 1710 if (promise->IsJSObject()) { | 1703 catch_type == Isolate::CAUGHT_BY_ASYNC_AWAIT); |
| 1704 if (catch_type != Isolate::CAUGHT_BY_JAVASCRIPT && promise->IsJSObject()) { |
| 1711 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 1705 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
| 1712 // Mark the promise as already having triggered a message. | 1706 // Mark the promise as already having triggered a message. |
| 1713 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1707 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
| 1714 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); | 1708 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); |
| 1715 // Check whether the promise reject is considered an uncaught exception. | 1709 // Check whether the promise reject is considered an uncaught exception. |
| 1716 Handle<Object> has_reject_handler; | 1710 uncaught = !isolate_->PromiseHasUserDefinedRejectHandler(jspromise); |
| 1717 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | |
| 1718 isolate_, has_reject_handler, | |
| 1719 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); | |
| 1720 uncaught = has_reject_handler->IsFalse(isolate_); | |
| 1721 } | 1711 } |
| 1722 // Bail out if exception breaks are not active | 1712 // Bail out if exception breaks are not active |
| 1723 if (uncaught) { | 1713 if (uncaught) { |
| 1724 // Uncaught exceptions are reported by either flags. | 1714 // Uncaught exceptions are reported by either flags. |
| 1725 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1715 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
| 1726 } else { | 1716 } else { |
| 1727 // Caught exceptions are reported is activated. | 1717 // Caught exceptions are reported is activated. |
| 1728 if (!break_on_exception_) return; | 1718 if (!break_on_exception_) return; |
| 1729 } | 1719 } |
| 1730 | 1720 |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 } | 2556 } |
| 2567 | 2557 |
| 2568 | 2558 |
| 2569 void LockingCommandMessageQueue::Clear() { | 2559 void LockingCommandMessageQueue::Clear() { |
| 2570 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2560 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2571 queue_.Clear(); | 2561 queue_.Clear(); |
| 2572 } | 2562 } |
| 2573 | 2563 |
| 2574 } // namespace internal | 2564 } // namespace internal |
| 2575 } // namespace v8 | 2565 } // namespace v8 |
| OLD | NEW |