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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1690 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
1691 if (!promise->IsJSObject() || | 1691 if (!promise->IsJSObject() || |
1692 JSReceiver::GetDataProperty(Handle<JSObject>::cast(promise), key) | 1692 JSReceiver::GetDataProperty(Handle<JSObject>::cast(promise), key) |
1693 ->IsUndefined(isolate_)) { | 1693 ->IsUndefined(isolate_)) { |
1694 OnException(value, promise); | 1694 OnException(value, promise); |
1695 } | 1695 } |
1696 } | 1696 } |
1697 | 1697 |
1698 | 1698 |
1699 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 1699 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
| 1700 // We cannot generate debug events when JS execution is disallowed. |
| 1701 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant |
| 1702 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. |
| 1703 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; |
| 1704 |
1700 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); | 1705 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
1701 | 1706 |
1702 // Don't notify listener of exceptions that are internal to a desugaring. | 1707 // Don't notify listener of exceptions that are internal to a desugaring. |
1703 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; | 1708 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; |
1704 | 1709 |
1705 bool uncaught = catch_type == Isolate::NOT_CAUGHT; | 1710 bool uncaught = catch_type == Isolate::NOT_CAUGHT; |
1706 if (promise->IsJSObject()) { | 1711 if (promise->IsJSObject()) { |
1707 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 1712 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
1708 // Mark the promise as already having triggered a message. | 1713 // Mark the promise as already having triggered a message. |
1709 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 1714 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 } | 2563 } |
2559 | 2564 |
2560 | 2565 |
2561 void LockingCommandMessageQueue::Clear() { | 2566 void LockingCommandMessageQueue::Clear() { |
2562 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2567 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2563 queue_.Clear(); | 2568 queue_.Clear(); |
2564 } | 2569 } |
2565 | 2570 |
2566 } // namespace internal | 2571 } // namespace internal |
2567 } // namespace v8 | 2572 } // namespace v8 |
OLD | NEW |