Bug 1390170 - DOMException.prototype should have .message and .name r=bkelly

The spec requires that they be interface members:

  https://heycam.github.io/webidl/#idl-DOMException

This means they're on the prototype.  This change brings us in line with
Chrome, Edge, and WebKit, as tested by
<https://github.com/w3c/web-platform-tests/pull/6875>.

MozReview-Commit-ID: A1cKpmlCNCs

--HG--
extra : rebase_source : 1bce93cdb44fe6718289a86314bbe8ab4afea6ed
This commit is contained in:
Aryeh Gregor 2017-08-14 18:52:18 +03:00
Родитель ad97051e47
Коммит 11e2c13fc6
1 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -19,12 +19,8 @@ interface StackFrame;
Exposed=(Window,Worker)]
interface ExceptionMembers
{
// A custom message set by the thrower.
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|).
readonly attribute DOMString name;
// Filename location. This is the location that caused the
// error, which may or may not be a source file location.
@ -57,6 +53,10 @@ interface ExceptionMembers
[NoInterfaceObject, Exposed=(Window,Worker)]
interface Exception {
// The name of the error code (ie, a string repr of |result|).
readonly attribute DOMString name;
// A custom message set by the thrower.
readonly attribute DOMString message;
// A generic formatter - make it suitable to print, etc.
stringifier;
};
@ -69,6 +69,12 @@ Exception implements ExceptionMembers;
Exposed=(Window, Worker),
Constructor(optional DOMString message = "", optional DOMString name)]
interface DOMException {
// The name of the error code (ie, a string repr of |result|).
readonly attribute DOMString name;
// A custom message set by the thrower.
readonly attribute DOMString message;
readonly attribute unsigned short code;
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
const unsigned short HIERARCHY_REQUEST_ERR = 3;
@ -94,8 +100,6 @@ interface DOMException {
const unsigned short TIMEOUT_ERR = 23;
const unsigned short INVALID_NODE_TYPE_ERR = 24;
const unsigned short DATA_CLONE_ERR = 25;
readonly attribute unsigned short code;
};
// XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave