mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
4c3b3529a8
commit
7cbc5f6ee6
6 changed files with 14 additions and 17 deletions
|
@ -11,7 +11,6 @@ use servo_atoms::Atom;
|
|||
use crate::dom::bindings::codegen::Bindings::CustomEventBinding;
|
||||
use crate::dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
|
@ -75,8 +74,8 @@ impl CustomEvent {
|
|||
can_gc: CanGc,
|
||||
type_: DOMString,
|
||||
init: RootedTraceableBox<CustomEventBinding::CustomEventInit>,
|
||||
) -> Fallible<DomRoot<CustomEvent>> {
|
||||
Ok(CustomEvent::new(
|
||||
) -> DomRoot<CustomEvent> {
|
||||
CustomEvent::new(
|
||||
global,
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
|
@ -84,7 +83,7 @@ impl CustomEvent {
|
|||
init.parent.cancelable,
|
||||
init.detail.handle(),
|
||||
can_gc,
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
fn init_custom_event(
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* https://dom.spec.whatwg.org/#event
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
[Exposed=*]
|
||||
interface Event {
|
||||
[Throws] constructor(DOMString type, optional EventInit eventInitDict = {});
|
||||
[Pure]
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[CustomEvent.html]
|
||||
[initCustomEvent's default parameter values.]
|
||||
expected: FAIL
|
3
tests/wpt/meta/dom/idlharness.any.js.ini
vendored
3
tests/wpt/meta/dom/idlharness.any.js.ini
vendored
|
@ -11,9 +11,6 @@
|
|||
[Event interface: new Event("foo") must inherit property "composed" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any)]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
3
tests/wpt/meta/dom/idlharness.window.js.ini
vendored
3
tests/wpt/meta/dom/idlharness.window.js.ini
vendored
|
@ -169,9 +169,6 @@
|
|||
[XPathExpression interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any)]
|
||||
expected: FAIL
|
||||
|
||||
[XPathResult interface: constant ORDERED_NODE_ITERATOR_TYPE on interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue