whatwg / webidl

Web IDL Standard
https://webidl.spec.whatwg.org/
Other
410 stars 164 forks source link

Should `DOMException#stack` be standardized? #1186

Open saschanaz opened 2 years ago

saschanaz commented 2 years ago

I was just watching the war (😉) at https://github.com/whatwg/webidl/pull/1179 and https://github.com/whatwg/webidl/pull/1179#issuecomment-1241307416 interested me. Gecko does have Error.prototype.stack as an IDL accessor while Blink/WebKit do not, and currently the spec says:

Additionally, if an implementation gives native Error objects special powers or nonstandard properties (such as a stack property), it should also expose those on DOMException instances.

So per the spec stack is nonstandard and thus it should not be an accessor. But should it be in the standard? How many rabbits are in the hole?

domenic commented 2 years ago

So per the spec stack is nonstandard and thus it should not be an accessor.

I'm not sure this follows?

The intent of the quoted part of the IDL: if you're adding nonstandard properties, such as stack, to Error, then also add them to DOMException.

It doesn't say anything like: if you're adding nonstandard properties, such as stack, to Error, don't add them to DOMException as accessors.

saschanaz commented 2 years ago

Oh oops, yes, I misread it, thanks for the correction.

But "add to the instance" still sounds like Object.hasOwn(domException, "stack") should be true to me, doesn't it?

Edit: so many edits, I'll go bed, sorry 🥲

domenic commented 2 years ago

I see how it can be read that way, yeah. That wasn't really the intent; probably the word "instance" shouldn't have been used. The goal was basically "if Error has stack, then DOMException should too".