On 1/21/19 9:13 AM, 'Harald Alvestrand' via blink-dev wrote:
> b) An error object couldn't be defined in WebIDL because of reasons I
> think I understood at the time, but wouldn't be able to reproduce now
Taking a quick look at how RTCError is defined, the following are the
bits that are not doable in Web IDL right now, as far as I can see:
1) Having %Error% as the prototype of the RTCError constructor.
2) Having %ErrorPrototype% as the prototype of RTCError.prototype.
3) Having the RTCError constructor create a new object when its [[Call]]
is invoked (as opposed to its [[Construct]]).
4) Having all the properties have useful values on RTCError.prototype.
Item 2 is similar to what
https://heycam.github.io/webidl/#es-DOMException-specialness defines
(and is something I have in the past proposed as a Web IDL extended
attribute, but didn't happen due to pushback from Chrome).
Item 1 is a subclassing sanity thing, and makes some sense; I've
proposed it for DOMException in the past but again there was pushback.
Item 3 is just a bad idea, imo; neither Web IDL objects nor newer ES
builtins (e.g. Map) work that way.
Item 4 is not really doable with Web IDL, but it's not clear to me how
integral it is to the definition of this error type.
All of which is to say that I personally would support extending IDL to
support the proto chain modifications described above, if that would
help. I suspect it would make the spec a lot less vague [1].
-Boris
[1] For example, it's not clear to me, once we get to
<
https://w3c.github.io/webrtc-pc/#set-the-rtcsessiondescription> step 6,
what the "sdpLineNumber" property is supposed to look like. Is it an
accessor or a value property? Is it configurable? Writable?
Enumerable? None of that is defined, and it would need to be for this
spec to be interoperably implementable.