Add handling of empty stack in the backtrace debug request.
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 11 Dec 2008 09:35:44 +0000 (09:35 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 11 Dec 2008 09:35:44 +0000 (09:35 +0000)
Add accessor function for the exception in an ExceptionEvent.
Review URL: http://codereview.chromium.org/13382

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@961 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug-delay.js

index 01ea6a4..6db054e 100644 (file)
@@ -832,10 +832,16 @@ ExceptionEvent.prototype.eventType = function() {
 };
 
 
+ExceptionEvent.prototype.exception = function() {
+  return this.exception_;
+}
+
+
 ExceptionEvent.prototype.uncaught = function() {
   return this.uncaught_;
 }
 
+
 ExceptionEvent.prototype.func = function() {
   return this.exec_state_.frame(0).func();
 };
@@ -1322,6 +1328,14 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response)
   // Get the number of frames.
   var total_frames = this.exec_state_.frameCount();
 
+  // Create simple response if there are no frames.
+  if (total_frames == 0) {
+    response.body = {
+      totalFrames: total_frames
+    }
+    return;
+  }
+
   // Default frame range to include in backtrace.
   var from_index = 0
   var to_index = kDefaultBacktraceLength;