Bug 1716810 - Make test_deltaMode_lines_always_enabled.html wait to first user input via the parent process r=smaug

`synthesizeWheel` dispatches a `wheel` event via APZ.
* https://searchfox.org/mozilla-central/rev/b79212b4fc017f27ac2435a658d4e9b9798efa86/dom/base/nsDOMWindowUtils.cpp#755,789
* https://searchfox.org/mozilla-central/rev/b79212b4fc017f27ac2435a658d4e9b9798efa86/widget/PuppetWidget.cpp#383,386,396-397

So, it's important that the `<iframe>`'s layout information is registered in
the parent process.  Otherwise, the `wheel` event will be dispatched on the
`<iframe>` in the parent document instead.

Therefore, the test needs to wait a synthesized event via the parent process
before using `synthesizeWheel`.

Depends on D119596

Differential Revision: https://phabricator.services.mozilla.com/D119715
This commit is contained in:
Masayuki Nakano 2021-07-13 10:02:11 +00:00
parent afce03d9c7
commit 931a8fba11
2 changed files with 12 additions and 5 deletions

View File

@ -264,8 +264,6 @@ skip-if = toolkit == 'android' # Bug 1312791
[test_bug1673434.html]
[test_bug1681800.html]
[test_deltaMode_lines_always_enabled.html]
skip-if =
fission && xorigin && !debug # Bug 1716405 - New fission platform triage
[test_dnd_with_modifiers.html]
skip-if = toolkit == 'android' # Dnd isn't supported
[test_hover_mouseleave.html]

View File

@ -5,19 +5,28 @@
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<p id="display"></p>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1684001">Mozilla Bug 1684001</a>
<div id="overflow" style="height: 300vh"></div>
<pre id="test"></pre>
<script>
SimpleTest.waitForExplicitFinish();
const HACK_PREF = "dom.event.wheel-deltaMode-lines.always-enabled";
const testEl = document.getElementById("test");
const linkEl = document.getElementById("link-test");
(async function() {
await SimpleTest.promiseFocus(window);
await SpecialPowers.pushPrefEnv({
set: [[HACK_PREF, document.domain]]
set: [
[HACK_PREF, document.domain],
["test.events.async.enabled", true],
],
});
// FYI: Cannot use scrollingElement because it's center may be outside of the viewport.
await promiseElementReadyForUserInput(document.querySelector("a[href]"));
await SpecialPowers.pushPrefEnv({
clear: [
["test.events.async.enabled"],
],
});
document.addEventListener("wheel", e => {