mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
dom: set composed flag when constructing ClipboardEvent
(#35146)
* clipboardevent: set composed flag Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add clipboardevent test expectations Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
parent
527eaf628a
commit
6195026db0
7 changed files with 191 additions and 3 deletions
|
@ -71,10 +71,9 @@ impl ClipboardEventMethods<crate::DomTypeHolder> for ClipboardEvent {
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &ClipboardEventInit,
|
init: &ClipboardEventInit,
|
||||||
) -> DomRoot<ClipboardEvent> {
|
) -> DomRoot<ClipboardEvent> {
|
||||||
// Missing composed field
|
|
||||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
ClipboardEvent::new(
|
let event = ClipboardEvent::new(
|
||||||
window,
|
window,
|
||||||
proto,
|
proto,
|
||||||
type_,
|
type_,
|
||||||
|
@ -82,7 +81,9 @@ impl ClipboardEventMethods<crate::DomTypeHolder> for ClipboardEvent {
|
||||||
cancelable,
|
cancelable,
|
||||||
init.clipboardData.as_deref(),
|
init.clipboardData.as_deref(),
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
);
|
||||||
|
event.upcast::<Event>().set_composed(init.parent.composed);
|
||||||
|
event
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.w3.org/TR/clipboard-apis/#dom-clipboardevent-clipboarddata>
|
/// <https://www.w3.org/TR/clipboard-apis/#dom-clipboardevent-clipboarddata>
|
||||||
|
|
|
@ -1589,6 +1589,7 @@ impl Document {
|
||||||
// Step 9
|
// Step 9
|
||||||
event.set_trusted(trusted);
|
event.set_trusted(trusted);
|
||||||
// Step 10 Set event’s composed to true.
|
// Step 10 Set event’s composed to true.
|
||||||
|
event.set_composed(true);
|
||||||
// Step 11
|
// Step 11
|
||||||
event.dispatch(target, false, can_gc);
|
event.dispatch(target, false, can_gc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,6 +623,10 @@ impl Event {
|
||||||
self.is_trusted.set(trusted);
|
self.is_trusted.set(trusted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_composed(&self, composed: bool) {
|
||||||
|
self.composed.set(composed);
|
||||||
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#fire-a-simple-event>
|
/// <https://html.spec.whatwg.org/multipage/#fire-a-simple-event>
|
||||||
pub(crate) fn fire(&self, target: &EventTarget, can_gc: CanGc) -> EventStatus {
|
pub(crate) fn fire(&self, target: &EventTarget, can_gc: CanGc) -> EventStatus {
|
||||||
self.set_trusted(true);
|
self.set_trusted(true);
|
||||||
|
|
2
tests/wpt/include.ini
vendored
2
tests/wpt/include.ini
vendored
|
@ -3,6 +3,8 @@ skip: true
|
||||||
skip: false
|
skip: false
|
||||||
[_webgl]
|
[_webgl]
|
||||||
skip: false
|
skip: false
|
||||||
|
[clipboard-apis]
|
||||||
|
skip: false
|
||||||
[console]
|
[console]
|
||||||
skip: false
|
skip: false
|
||||||
[cookies]
|
[cookies]
|
||||||
|
|
84
tests/wpt/meta/clipboard-apis/clipboard-item.https.html.ini
vendored
Normal file
84
tests/wpt/meta/clipboard-apis/clipboard-item.https.html.ini
vendored
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
[clipboard-item.https.html]
|
||||||
|
[ClipboardItem({string, Blob}) succeeds with different types]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem() succeeds with empty options]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem({}) fails with empty dictionary input]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem(Blob) fails]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem() fails with null input]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem() fails with no input]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[types() returns correct values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[getType(DOMString valid type) succeeds with correct output]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[getType(DOMString invalid type) succeeds with correct output]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[getType(DOMString type) rejects correctly when querying for missing type]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[getType(DOMString valid type) converts DOMString to Blob]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[getType(DOMString invalid type) converts DOMString to Blob]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(text/plain) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(text/html) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(image/png) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(text/uri-list) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(image/svg+xml) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(web foo/bar) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(web text/html) returns true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(web ) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(web) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(web foo) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(foo/bar) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(weB text/html) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports( web text/html) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports(not a/real type) returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports() returns false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[supports( ) returns false]
|
||||||
|
expected: FAIL
|
3
tests/wpt/meta/clipboard-apis/data-transfer-file-list-change-reference-updates.html.ini
vendored
Normal file
3
tests/wpt/meta/clipboard-apis/data-transfer-file-list-change-reference-updates.html.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[data-transfer-file-list-change-reference-updates.html]
|
||||||
|
[expect changed contents]
|
||||||
|
expected: FAIL
|
93
tests/wpt/meta/clipboard-apis/idlharness.https.window.js.ini
vendored
Normal file
93
tests/wpt/meta/clipboard-apis/idlharness.https.window.js.ini
vendored
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
[idlharness.https.window.html]
|
||||||
|
[ClipboardItem interface: existence and properties of interface object]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface object length]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface object name]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: existence and properties of interface prototype object]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: existence and properties of interface prototype object's "constructor" property]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: existence and properties of interface prototype object's @@unscopables property]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: attribute presentationStyle]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: attribute types]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: operation getType(DOMString)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[ClipboardItem interface: operation supports(DOMString)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: existence and properties of interface object]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface object length]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface object name]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: existence and properties of interface prototype object]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: existence and properties of interface prototype object's "constructor" property]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: existence and properties of interface prototype object's @@unscopables property]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: operation read(optional ClipboardUnsanitizedFormats)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: operation readText()]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: operation write(ClipboardItems)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: operation writeText(DOMString)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard must be primary interface of navigator.clipboard]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Stringification of navigator.clipboard]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: navigator.clipboard must inherit property "read(optional ClipboardUnsanitizedFormats)" with the proper type]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: calling read(optional ClipboardUnsanitizedFormats) on navigator.clipboard with too few arguments must throw TypeError]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: navigator.clipboard must inherit property "readText()" with the proper type]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: navigator.clipboard must inherit property "write(ClipboardItems)" with the proper type]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: calling write(ClipboardItems) on navigator.clipboard with too few arguments must throw TypeError]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: navigator.clipboard must inherit property "writeText(DOMString)" with the proper type]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Clipboard interface: calling writeText(DOMString) on navigator.clipboard with too few arguments must throw TypeError]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Navigator interface: attribute clipboard]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Navigator interface: navigator must inherit property "clipboard" with the proper type]
|
||||||
|
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue