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

Side by Side Diff: src/debug/debug.cc

Issue 2651683005: [inspector] don't ignore uncaught exception if at least 1 frame isn't blackboxed (Closed)
Patch Set: addressed comments Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | test/inspector/debugger/framework-break.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = IsFrameBlackboxed(it.frame());
1755 if (!uncaught || !is_top_frame_blackboxed) return is_top_frame_blackboxed;
1756 it.Advance();
1757 while (!it.done()) {
1758 if (!IsFrameBlackboxed(it.frame())) return false;
1759 it.Advance();
1760 }
1761 return true;
1762 }
1763
1764 bool Debug::IsFrameBlackboxed(JavaScriptFrame* frame) {
1765 HandleScope scope(isolate_);
1766 if (!frame->HasInlinedFrames()) {
1767 return IsBlackboxed(frame->function()->shared());
1768 }
1769 List<SharedFunctionInfo*> raw_shareds;
1770 frame->GetFunctions(&raw_shareds);
1771 List<Handle<SharedFunctionInfo>> shareds;
1772 for (int i = 0; i < raw_shareds.length(); ++i) {
1773 shareds.Add(handle(raw_shareds[i]));
1774 }
1775 for (int i = 0; i < shareds.length(); ++i) {
1776 if (!IsBlackboxed(shareds[i])) return false;
1777 }
1778 return true;
1779 }
1780
1749 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { 1781 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) {
1750 // We cannot generate debug events when JS execution is disallowed. 1782 // We cannot generate debug events when JS execution is disallowed.
1751 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant 1783 // TODO(5530): Reenable debug events within DisallowJSScopes once relevant
1752 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++. 1784 // code (MakeExceptionEvent and ProcessDebugEvent) have been moved to C++.
1753 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return; 1785 if (!AllowJavascriptExecution::IsAllowed(isolate_)) return;
1754 1786
1755 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); 1787 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher();
1756 1788
1757 // Don't notify listener of exceptions that are internal to a desugaring. 1789 // Don't notify listener of exceptions that are internal to a desugaring.
1758 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; 1790 if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return;
(...skipping 12 matching lines...) Expand all
1771 // Uncaught exceptions are reported by either flags. 1803 // Uncaught exceptions are reported by either flags.
1772 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; 1804 if (!(break_on_uncaught_exception_ || break_on_exception_)) return;
1773 } else { 1805 } else {
1774 // Caught exceptions are reported is activated. 1806 // Caught exceptions are reported is activated.
1775 if (!break_on_exception_) return; 1807 if (!break_on_exception_) return;
1776 } 1808 }
1777 1809
1778 { 1810 {
1779 JavaScriptFrameIterator it(isolate_); 1811 JavaScriptFrameIterator it(isolate_);
1780 // Check whether the top frame is blackboxed or the break location is muted. 1812 // Check whether the top frame is blackboxed or the break location is muted.
1781 if (!it.done() && (IsBlackboxed(it.frame()->function()->shared()) || 1813 if (!it.done() && (IsMutedAtCurrentLocation(it.frame()) ||
1782 IsMutedAtCurrentLocation(it.frame()))) { 1814 IsExceptionBlackboxed(uncaught))) {
1783 return; 1815 return;
1784 } 1816 }
1785 } 1817 }
1786 1818
1787 DebugScope debug_scope(this); 1819 DebugScope debug_scope(this);
1788 if (debug_scope.failed()) return; 1820 if (debug_scope.failed()) return;
1789 1821
1790 if (debug_delegate_) { 1822 if (debug_delegate_) {
1791 HandleScope scope(isolate_); 1823 HandleScope scope(isolate_);
1792 1824
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 return v8::Utils::ToLocal(callback_data_); 2429 return v8::Utils::ToLocal(callback_data_);
2398 } 2430 }
2399 2431
2400 2432
2401 v8::Isolate* EventDetailsImpl::GetIsolate() const { 2433 v8::Isolate* EventDetailsImpl::GetIsolate() const {
2402 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); 2434 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate());
2403 } 2435 }
2404 2436
2405 } // namespace internal 2437 } // namespace internal
2406 } // namespace v8 2438 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | test/inspector/debugger/framework-break.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698