Bug 721156 - aError.stack is undefined in the Error Console when exception is thrown in Scratchpad. r=robcee
authorHeather Arthur <fayearthur@gmail.com>
Wed, 28 Mar 2012 13:24:44 +0100
changeset 93832 5e087503286f9c7837401162440c4621ae6661b6
parent 93831 014c39d29e3022359d13366252eb1042c8ea78d2
child 93833 3faec66b941336df2d0a5bc3de4cc596f33519de
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobcee
bugs721156
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 721156 - aError.stack is undefined in the Error Console when exception is thrown in Scratchpad. r=robcee
browser/devtools/scratchpad/scratchpad.js
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -482,17 +482,18 @@ var Scratchpad = {
 
   /**
    * Write out an error at the current insertion point as a block comment
    * @param object aValue
    *        The Error object to write out the message and stack trace
    */
   writeAsErrorComment: function SP_writeAsErrorComment(aError)
   {
-    let newComment = "Exception: " + aError.message + "\n" + aError.stack.substring(0, aError.stack.length - 1);
+    let stack = aError.stack || aError.fileName + ":" + aError.lineNumber;
+    let newComment = "Exception: " + aError.message + "\n" + stack.replace(/\n$/, "");
     
     this.writeAsComment(newComment);
   },
 
   /**
    * Open the Property Panel to inspect the given object.
    *
    * @param string aEvalString