Bug 1829021 - Fix a race condition in the helper_hittest_iframe_perspective* tests. r=hiro

The race is between the OOP iframe's BrowserParent being informed about
enclosing transforms, and the event synthesized by the test.

The race is resolved by using contentTransformReceived() in the iframe's
process before sending the event.

Differential Revision: https://phabricator.services.mozilla.com/D176829
This commit is contained in:
Botond Ballo 2023-05-03 03:05:51 +00:00
Родитель 0d54e75ac3
Коммит 74fff69f1a
3 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -25,11 +25,16 @@
<body>
<div class="outer">
<div class="inner">
<iframe width="300px" height="200px" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
<iframe id="iframe" width="300px" height="200px" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
</div>
</div>
<script type="application/javascript">
async function test() {
// Wait for iframe to receive content transforms.
await SpecialPowers.spawn(iframe, [], async () => {
await SpecialPowers.contentTransformsReceived(content.window);
});
let eventPromise = new Promise(resolve => {
window.addEventListener("message", event => {
let data = JSON.parse(event.data);

Просмотреть файл

@ -28,11 +28,16 @@
<body>
<div id="outer">
<div id="inner">
<iframe src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
<iframe id="iframe" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
</div>
</div>
<script type="application/javascript">
async function test() {
// Wait for iframe to receive content transforms.
await SpecialPowers.spawn(iframe, [], async () => {
await SpecialPowers.contentTransformsReceived(content.window);
});
let clickCoordsInChild = {
offsetX: 0,
offsetY: 0

Просмотреть файл

@ -16,10 +16,15 @@
</head>
<body>
<div id="container">
<iframe src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
<iframe id="iframe" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
</div>
<script type="application/javascript">
async function test() {
// Wait for iframe to receive content transforms.
await SpecialPowers.spawn(iframe, [], async () => {
await SpecialPowers.contentTransformsReceived(content.window);
});
let clickCoordsInChild = {
offsetX: 0,
offsetY: 0