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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 v8::Local<v8::Context> GetDebugEventContext(Isolate* isolate) { | 1739 v8::Local<v8::Context> GetDebugEventContext(Isolate* isolate) { |
1740 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); | 1740 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); |
1741 // Isolate::context() may have been NULL when "script collected" event | 1741 // Isolate::context() may have been NULL when "script collected" event |
1742 // occured. | 1742 // occured. |
1743 if (context.is_null()) return v8::Local<v8::Context>(); | 1743 if (context.is_null()) return v8::Local<v8::Context>(); |
1744 Handle<Context> native_context(context->native_context()); | 1744 Handle<Context> native_context(context->native_context()); |
1745 return v8::Utils::ToLocal(native_context); | 1745 return v8::Utils::ToLocal(native_context); |
1746 } | 1746 } |
1747 } // anonymous namespace | 1747 } // anonymous namespace |
1748 | 1748 |
1749 bool Debug::IsExceptionBlackboxed(bool uncaught) { | |
1750 JavaScriptFrameIterator it(isolate_); | |
1751 if (it.done()) return false; | |
1752 // Uncaught exception is blackboxed if all current frames are blackboxed, | |
1753 // caught exception if top frame is blackboxed. | |
1754 bool is_top_frame_blackboxed = IsBlackboxed(it.frame()->function()->shared()); | |
Yang
2017/01/25 10:10:15
This doesn't account for inlined frames. Please us
kozy
2017/01/25 17:39:26
Done + added a test.
| |
1755 if (!uncaught || !is_top_frame_blackboxed) return is_top_frame_blackboxed; | |
1756 it.Advance(); | |
1757 while (!it.done()) { | |
1758 if (!IsBlackboxed(it.frame()->function()->shared())) return false; | |
1759 it.Advance(); | |
1760 } | |
1761 return true; | |
1762 } | |
1763 | |
1749 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 1764 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
1750 // We cannot generate debug events when JS execution is disallowed. | 1765 // We cannot generate debug events when JS execution is disallowed. |
1751 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant | 1766 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant |
1752 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. | 1767 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. |
1753 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; | 1768 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; |
1754 | 1769 |
1755 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); | 1770 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
1756 | 1771 |
1757 // Don't notify listener of exceptions that are internal to a desugaring. | 1772 // Don't notify listener of exceptions that are internal to a desugaring. |
1758 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; | 1773 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; |
(...skipping 12 matching lines...) Expand all Loading... | |
1771 // Uncaught exceptions are reported by either flags. | 1786 // Uncaught exceptions are reported by either flags. |
1772 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1787 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
1773 } else { | 1788 } else { |
1774 // Caught exceptions are reported is activated. | 1789 // Caught exceptions are reported is activated. |
1775 if (!break_on_exception_) return; | 1790 if (!break_on_exception_) return; |
1776 } | 1791 } |
1777 | 1792 |
1778 { | 1793 { |
1779 JavaScriptFrameIterator it(isolate_); | 1794 JavaScriptFrameIterator it(isolate_); |
1780 // Check whether the top frame is blackboxed or the break location is muted. | 1795 // Check whether the top frame is blackboxed or the break location is muted. |
1781 if (!it.done() && (IsBlackboxed(it.frame()->function()->shared()) || | 1796 if (!it.done() && (IsMutedAtCurrentLocation(it.frame()) || |
1782 IsMutedAtCurrentLocation(it.frame()))) { | 1797 IsExceptionBlackboxed(uncaught))) { |
1783 return; | 1798 return; |
1784 } | 1799 } |
1785 } | 1800 } |
1786 | 1801 |
1787 DebugScope debug_scope(this); | 1802 DebugScope debug_scope(this); |
1788 if (debug_scope.failed()) return; | 1803 if (debug_scope.failed()) return; |
1789 | 1804 |
1790 if (debug_delegate_) { | 1805 if (debug_delegate_) { |
1791 HandleScope scope(isolate_); | 1806 HandleScope scope(isolate_); |
1792 | 1807 |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2333 return v8::Utils::ToLocal(callback_data_); | 2348 return v8::Utils::ToLocal(callback_data_); |
2334 } | 2349 } |
2335 | 2350 |
2336 | 2351 |
2337 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2352 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
2338 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2353 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
2339 } | 2354 } |
2340 | 2355 |
2341 } // namespace internal | 2356 } // namespace internal |
2342 } // namespace v8 | 2357 } // namespace v8 |
OLD | NEW |