Bug 857648 part 5. Expose a .stack property on DOMExceptions. r=khuey
☠☠ backed out by 7436a483b28e ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 04 Jul 2014 01:25:16 -0400
changeset 201231 a4524d7aec4fef039496acefe980dbf606b1977c
parent 201230 e4dd7f8cf275916f67b692ee28afa0466f0c56d8
child 201232 03b7d111cc86fdf1a3f8c6920c2222e0421bd50f
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-esr52@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs857648
milestone33.0a1
Bug 857648 part 5. Expose a .stack property on DOMExceptions. r=khuey
dom/base/DOMException.cpp
dom/base/DOMException.h
dom/webidl/DOMException.webidl
--- a/dom/base/DOMException.cpp
+++ b/dom/base/DOMException.cpp
@@ -549,16 +549,24 @@ Exception::GetInner() const
 already_AddRefed<nsISupports>
 Exception::GetData() const
 {
   nsCOMPtr<nsISupports> data = mData;
   return data.forget();
 }
 
 void
+Exception::GetStack(nsAString& aStack, ErrorResult& aRv) const
+{
+  if (mLocation) {
+    aRv = mLocation->GetFormattedStack(aStack);
+  }
+}
+
+void
 Exception::Stringify(nsString& retval)
 {
   nsCString str;
 #ifdef DEBUG
   DebugOnly<nsresult> rv =
 #endif
   ToString(str);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
--- a/dom/base/DOMException.h
+++ b/dom/base/DOMException.h
@@ -76,16 +76,18 @@ public:
   uint32_t ColumnNumber() const;
 
   already_AddRefed<nsIStackFrame> GetLocation() const;
 
   already_AddRefed<nsISupports> GetInner() const;
 
   already_AddRefed<nsISupports> GetData() const;
 
+  void GetStack(nsAString& aStack, ErrorResult& aRv) const;
+
   void Stringify(nsString& retval);
 
   // XPCOM factory ctor.
   Exception();
 
   Exception(const nsACString& aMessage,
             nsresult aResult,
             const nsACString& aName,
--- a/dom/webidl/DOMException.webidl
+++ b/dom/webidl/DOMException.webidl
@@ -51,16 +51,20 @@ interface ExceptionMembers
   // this was only ever usefully available to chrome JS.
   [ChromeOnly]
   readonly attribute StackFrame?             location;
   // An inner exception that triggered this, if available.
   readonly attribute nsISupports?            inner;
 
   // Arbitary data for the implementation.
   readonly attribute nsISupports?            data;
+
+  // Formatted exception stack
+  [Throws]
+  readonly attribute DOMString               stack;
 };
 
 [NoInterfaceObject]
 interface Exception {
   // A generic formatter - make it suitable to print, etc.
   stringifier;
 };