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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 | 1694 |
1695 | 1695 |
1696 MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler( | 1696 MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler( |
1697 Handle<JSObject> promise) { | 1697 Handle<JSObject> promise) { |
1698 Handle<JSFunction> fun = isolate_->promise_has_user_defined_reject_handler(); | 1698 Handle<JSFunction> fun = isolate_->promise_has_user_defined_reject_handler(); |
1699 return Execution::Call(isolate_, fun, promise, 0, NULL); | 1699 return Execution::Call(isolate_, fun, promise, 0, NULL); |
1700 } | 1700 } |
1701 | 1701 |
1702 | 1702 |
1703 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 1703 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
| 1704 // We cannot generate debug events when JS execution is disallowed. |
| 1705 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant |
| 1706 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. |
| 1707 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; |
| 1708 |
1704 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); | 1709 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
1705 | 1710 |
1706 // Don't notify listener of exceptions that are internal to a desugaring. | 1711 // Don't notify listener of exceptions that are internal to a desugaring. |
1707 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; | 1712 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; |
1708 | 1713 |
1709 bool uncaught = (catch_type == Isolate::NOT_CAUGHT); | 1714 bool uncaught = (catch_type == Isolate::NOT_CAUGHT); |
1710 if (promise->IsJSObject()) { | 1715 if (promise->IsJSObject()) { |
1711 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 1716 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
1712 // Mark the promise as already having triggered a message. | 1717 // Mark the promise as already having triggered a message. |
1713 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1718 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 } | 2571 } |
2567 | 2572 |
2568 | 2573 |
2569 void LockingCommandMessageQueue::Clear() { | 2574 void LockingCommandMessageQueue::Clear() { |
2570 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2575 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2571 queue_.Clear(); | 2576 queue_.Clear(); |
2572 } | 2577 } |
2573 | 2578 |
2574 } // namespace internal | 2579 } // namespace internal |
2575 } // namespace v8 | 2580 } // namespace v8 |
OLD | NEW |