зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1565670 - Wait for a couple of rAF calls before declaring OOPIFs ready for testing. r=botond
This should ensure that the OOPIF gets painted and attached to the compositor layer tree before the main part of the test starts. We might be able to do something more sophisticated like waitForAllPaints or flushApzRepaints, but it's not trivial because this page loads with an example.com domain and can't easily access SpecialPowers. Differential Revision: https://phabricator.services.mozilla.com/D38225 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fe2f310301
Коммит
fb5a3200bf
|
@ -198,6 +198,13 @@ function isLayerized(elementId) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Return a promise that is resolved on the next rAF callback
|
||||
function waitForFrame() {
|
||||
return new Promise(resolve => {
|
||||
window.requestAnimationFrame(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function promiseApzRepaintsFlushed(aWindow = window) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var repaintDone = function() {
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<script src="apz_test_utils.js"></script>
|
||||
<script>
|
||||
// This is an empty document that serves as a OOPIF content document that be
|
||||
// reused by different fission subtests. The subtest can eval stuff in this
|
||||
// document using the sendToOopif helper and thereby populate this document
|
||||
// with whatever is needed. This allows the subtest to more "contained" in a
|
||||
// single file and avoids having to create new dummy files for each subtest.
|
||||
function loaded() {
|
||||
async function loaded() {
|
||||
window.dispatchEvent(new Event("FissionTestHelper:Init"));
|
||||
// Wait a couple of animation frames before sending the load, to ensure that
|
||||
// this OOPIF's layer tree has been sent to the compositor. We use this
|
||||
// instead of things like flushApzRepaints and/or waitForAllPaints because
|
||||
// this page is running without SpecialPowers and I couldn't figure out a good
|
||||
// way to get a hold of a things like Services.obs or DOMWindowUtils easily.
|
||||
await waitForFrame();
|
||||
await waitForFrame();
|
||||
FissionTestHelper.fireEventInEmbedder("OOPIF:Load", {content: window.location.href});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
<div style="width: 400%; height: 400%; background: red;"></div>
|
||||
<div style="width: 100%; height: 100%; background-color: blue"></div>
|
||||
<script type="application/javascript">
|
||||
function waitForFrame() {
|
||||
return new Promise(resolve => {
|
||||
window.requestAnimationFrame(resolve);
|
||||
});
|
||||
}
|
||||
const utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
async function test(testDriver) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче