3 <title>A scroll over an iframe should not terminate the wheel transaction
</title>
4 <script type=
"application/javascript" src=
"apz_test_utils.js"></script>
5 <script type=
"application/javascript" src=
"apz_test_native_event_utils.js"></script>
6 <script src=
"/tests/SimpleTest/paint_listener.js"></script>
29 <div id=
"spacer"></div>
30 <iframe id=
"subframe">
34 const searchParams
= new URLSearchParams(location
.search
);
36 async
function scrollWithPan() {
37 await NativePanHandler
.promiseNativePanEvent(
38 document
.scrollingElement
,
42 NativePanHandler
.delta
,
43 NativePanHandler
.beginPhase
,
46 await NativePanHandler
.promiseNativePanEvent(
47 document
.scrollingElement
,
51 NativePanHandler
.delta
,
52 NativePanHandler
.updatePhase
,
55 await NativePanHandler
.promiseNativePanEvent(
56 document
.scrollingElement
,
60 NativePanHandler
.delta
,
61 NativePanHandler
.endPhase
,
65 async
function scrollWithWheel() {
66 await
promiseMoveMouseAndScrollWheelOver(document
.scrollingElement
, 50, 30,
70 async
function test() {
72 SimpleTest
.getTestFileURL("helper_scroll_over_subframe_child.html");
74 switch (searchParams
.get("oop")) {
76 iframeURL
= iframeURL
.replace(window
.location
.origin
, "https://example.com/");
82 const iframeLoadPromise
= promiseOneEvent(subframe
, "load", null);
83 subframe
.src
= iframeURL
;
84 await iframeLoadPromise
;
86 await SpecialPowers
.spawn(subframe
, [], async () => {
87 await content
.wrappedJSObject
.waitUntilApzStable();
88 await SpecialPowers
.contentTransformsReceived(content
);
91 let childWindowReceivedWheelEvent
= false;
93 window
.addEventListener("message", e
=> {
94 if (e
.data
== "child-received-wheel-event") {
95 childWindowReceivedWheelEvent
= true;
99 await SpecialPowers
.spawn(subframe
, [], () => {
100 let target
= content
.document
.getElementById("target")
101 target
.style
.backgroundColor
= "green";
102 content
.getComputedStyle(target
).backgroundColor
;
103 target
.addEventListener("wheel", () => {
104 target
.style
.backgroundColor
= "red";
105 content
.getComputedStyle(target
).backgroundColor
;
107 return new Promise(resolve
=> resolve());
110 await
promiseFrame();
112 let transformEndPromise
= promiseTransformEnd();
114 // Scroll over the iframe
115 switch (searchParams
.get("scroll")) {
117 await
scrollWithWheel();
120 await
scrollWithPan();
123 ok(false, "Unsupported scroll value: " + searchParams
.get("scroll"));
127 await transformEndPromise
;
129 // Wait an extra frame to ensure any message from the child has
130 // extra time to be sent to the parent.
131 await
promiseFrame();
133 let res
= await SpecialPowers
.spawn(subframe
, [], () => {
134 let target
= content
.document
.getElementById("target")
135 return target
.style
.backgroundColor
;
138 await
promiseFrame();
140 // We should not have fired a wheel event to the element in the iframe
141 ok(!childWindowReceivedWheelEvent
, "Child window should not receive wheel events");
142 is(res
, "green", "OOP iframe does not halt user scroll of parent");
144 waitUntilApzStable().then(test
).then(subtestDone
, subtestFailed
);