It looks like our DOMException implementation needs some love:
- DOMException.idl still uses the "exception interface" concept that was removed from WebIDL in 2014.
- DOMException itself should not have a |message| attribute at all; instead, it should call %Error%'s constructor and let it and %ErrorPrototype% set Error.prototype.message instead.
- At the moment, DOMException's |code|, |message| and |name| attributes have wrong values in their property descriptors. They all should be configurable:true, enumerable:false and writable:true. At the moment, they're all configurable:true, enumerable:true and writable:false.
- DOMException's |code|, |name| (and |message| while it's still set in DOMException) need to be defined on each instance, not in DOMException itself (or its prototype).
- DOMException shouldn't have its own toString() at all ( issue 556950 ).
Calling %Error%'s constructor and setting the properties on the DOMException instance are the most challenging parts I see: the former because we may need a custom prologue or epilogue in DOMException's constructor, the latter because there's currently no extended attribute to tell the bindings generator that a property should be set on the instance (other than making them [Global], [PrimaryGlobal] or [Unforgeable]).
[Edited after comment #11 and the corresponding WebIDL spec updates]
It looks like our DOMException implementation needs some love:
- DOMException.idl still uses the "exception interface" concept that was removed from WebIDL in 2014.
- DOMException shouldn't have its own toString() at all ( issue 556950 ).
- While DOMExceptions thrown by Blink itself via V8ThrowDOMException have a "stack" attribute acting as a wrapper around Error.stack, DOMExceptions thrown by user code do not.
There used to be many more issues above, but most of them were solved by aligning the spec with what us, Gecko and WebKit actually implement (see https://github.com/heycam/webidl/pull/378 and https://github.com/w3c/web-platform-tests/pull/6361).
Comment 1 by yukishiino@chromium.org
, Jun 28 2017