зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1672050 - Try to make test_bug1639328.html more reliable. r=smaug
2 request animation ticks should be enough to guarantee that a paint has happened, and thus that the frame has received the new visibility updates and such. That being said, I guess that since on fission the IPC communication goes through the parent, it might not be guaranteed after all. This is mostly a tentative patch, if waiting longer doesn't fix it and the intermittents become timeouts, that means that there's something else to fix in Gecko. Differential Revision: https://phabricator.services.mozilla.com/D107503
This commit is contained in:
Родитель
b00ad45946
Коммит
08ebc51b1d
|
@ -20,7 +20,7 @@
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
function getOneMessage(frame) {
|
function getOneMessage(frame) {
|
||||||
info("querying " + frame.src);
|
info(`querying ${frame.src} (${frame.id})`);
|
||||||
let resolve;
|
let resolve;
|
||||||
let promise = new Promise(r => { resolve = r; });
|
let promise = new Promise(r => { resolve = r; });
|
||||||
window.addEventListener("message", function(e) {
|
window.addEventListener("message", function(e) {
|
||||||
|
@ -38,24 +38,27 @@ async function ticks(n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkFrame(frame, shouldThrottle) {
|
async function checkFrame(frame, shouldThrottle) {
|
||||||
let message = await getOneMessage(frame);
|
let message = null;
|
||||||
|
do {
|
||||||
|
if (message) {
|
||||||
|
await ticks(2);
|
||||||
|
}
|
||||||
|
message = await getOneMessage(frame);
|
||||||
|
} while (message.throttledFrameRequests != shouldThrottle);
|
||||||
is(message.throttledFrameRequests, shouldThrottle, frame.id);
|
is(message.throttledFrameRequests, shouldThrottle, frame.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
onload = async function() {
|
onload = async function() {
|
||||||
await SimpleTest.promiseFocus(window);
|
await SimpleTest.promiseFocus(window);
|
||||||
await ticks(2);
|
|
||||||
is(SpecialPowers.DOMWindowUtils.effectivelyThrottlesFrameRequests, false, "Should not be throttling main page");
|
is(SpecialPowers.DOMWindowUtils.effectivelyThrottlesFrameRequests, false, "Should not be throttling main page");
|
||||||
for (let frame of document.querySelectorAll("iframe")) {
|
for (let frame of document.querySelectorAll("iframe")) {
|
||||||
let shouldThrottle = frame.style.display == "none";
|
let shouldThrottle = frame.style.display == "none";
|
||||||
await checkFrame(frame, shouldThrottle);
|
await checkFrame(frame, shouldThrottle);
|
||||||
info("Switching display of " + frame.id);
|
info("Switching display of " + frame.id);
|
||||||
frame.style.display = shouldThrottle ? "" : "none";
|
frame.style.display = shouldThrottle ? "" : "none";
|
||||||
await ticks(2);
|
|
||||||
await checkFrame(frame, !shouldThrottle);
|
await checkFrame(frame, !shouldThrottle);
|
||||||
info("And switching display back for " + frame.id);
|
info("And switching display back for " + frame.id);
|
||||||
frame.style.display = shouldThrottle ? "none" : "";
|
frame.style.display = shouldThrottle ? "none" : "";
|
||||||
await ticks(2);
|
|
||||||
await checkFrame(frame, shouldThrottle);
|
await checkFrame(frame, shouldThrottle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче