Bug 997285 part 4. Drop the custom stringifier from DOMException in favor of the default one on Error.prototype. r=peterv,robcee
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 05 May 2014 16:01:57 -0400
changeset 181840 1ef41f4b806d9723e609fa04a6f86ac48df70afc
parent 181839 bceaeae2f7af4302b63b9092a7a729f24faa924b
child 181841 46a5bfb1fab7ffdc2eb66110a3129e1dcca18c54
push id43150
push userbzbarsky@mozilla.com
push dateTue, 06 May 2014 20:53:55 +0000
treeherdermozilla-inbound@1ef41f4b806d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv, robcee
bugs997285
milestone32.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 997285 part 4. Drop the custom stringifier from DOMException in favor of the default one on Error.prototype. r=peterv,robcee
browser/devtools/webconsole/test/browser_webconsole_output_04.js
dom/webidl/DOMException.webidl
--- a/browser/devtools/webconsole/test/browser_webconsole_output_04.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_output_04.js
@@ -45,17 +45,17 @@ let inputTests = [
     inspectable: true,
     variablesViewLabel: "TypeError",
   },
 
   // 4
   {
     input: "testDOMException()",
     output: 'DOMException [SyntaxError: "An invalid or illegal string was specified"',
-    printOutput: '[Exception... "An invalid or illegal string was specified"',
+    printOutput: '[object XrayWrapper [object DOMException]]"',
     inspectable: true,
     variablesViewLabel: "SyntaxError",
   },
 
   // 5
   {
     input: "testCSSStyleDeclaration()",
     output: 'CSS2Properties { color: "green", font-size: "2em" }',
--- a/dom/webidl/DOMException.webidl
+++ b/dom/webidl/DOMException.webidl
@@ -13,21 +13,28 @@
 
 // This is the WebIDL version of nsIException.  This is mostly legacy stuff.
 
 interface StackFrame;
 
 [NoInterfaceObject]
 interface ExceptionMembers
 {
-  // A custom message set by the thrower.
+  // A custom message set by the thrower.  LenientThis so it can be
+  // gotten on the prototype, which Error.prototype.toString will do
+  // if someone tries to stringify DOMException.prototype.
+  [LenientThis]
   readonly attribute DOMString               message;
   // The nsresult associated with this exception.
   readonly attribute unsigned long           result;
-  // The name of the error code (ie, a string repr of |result|)
+  // The name of the error code (ie, a string repr of |result|).
+  // LenientThis so it can be gotten on the prototype, which
+  // Error.prototype.toString will do if someone tries to stringify
+  // DOMException.prototype.
+  [LenientThis]
   readonly attribute DOMString               name;
 
   // Filename location.  This is the location that caused the
   // error, which may or may not be a source file location.
   // For example, standard language errors would generally have
   // the same location as their top stack entry.  File
   // parsers may put the location of the file they were parsing,
   // etc.
@@ -44,23 +51,22 @@ 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;
-
-  // A generic formatter - make it suitable to print, etc.
-  stringifier;
 };
 
 [NoInterfaceObject]
 interface Exception {
+  // A generic formatter - make it suitable to print, etc.
+  stringifier;
 };
 
 Exception implements ExceptionMembers;
 
 // XXXkhuey this is an 'exception', not an interface, but we don't have any
 // parser or codegen mechanisms for dealing with exceptions.
 [ExceptionClass]
 interface DOMException {