Update CustomEvent webidl interface (#33481)

The [idl interface](https://dom.spec.whatwg.org/#interface-customevent) and servo's implementation had diverged.

* Extra arguments to initCustomEvent are optional (fixes `dom/events/CustomEvent.html`)
* The CustomEvent constructor is infallible
* "[Exposed=*]" (and the same for the "Event" interface since it's
  CustomEvent's parent.)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-09-17 14:02:42 +02:00 committed by GitHub
parent 4c3b3529a8
commit 7cbc5f6ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 17 deletions

View file

@ -13,12 +13,19 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
[Exposed=(Window,Worker)]
// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
[Exposed=*]
interface CustomEvent : Event {
[Throws] constructor(DOMString type, optional CustomEventInit eventInitDict = {});
constructor(DOMString type, optional CustomEventInit eventInitDict = {});
readonly attribute any detail;
undefined initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any detail);
undefined initCustomEvent(
DOMString type,
optional boolean bubbles = false,
optional boolean cancelable = false,
optional any detail = null
); // legacy
};
dictionary CustomEventInit : EventInit {

View file

@ -6,7 +6,7 @@
* https://dom.spec.whatwg.org/#event
*/
[Exposed=(Window,Worker)]
[Exposed=*]
interface Event {
[Throws] constructor(DOMString type, optional EventInit eventInitDict = {});
[Pure]