Bug 1574508 - [marionette] reftest: call flushRendering in remote frames using actors r=marionette-reviewers,jgraham

Taking a similar approach to the regular Reftest actors, we recursively call flush rendering using js window actors in all remote frames.
The main difference with the regular Reftest actor is that the top frame's flushRendering is still performed as part of the reftestWait call.
The reason for that is that we perform 2 flushRendering in case there is a "reftest-wait" classname, which is easier if we keep it outside of the recursive call.

Differential Revision: https://phabricator.services.mozilla.com/D108420
This commit is contained in:
Julian Descottes 2021-03-17 21:01:50 +00:00
Родитель 5b375a59a6
Коммит 43559fbc63
3 изменённых файлов: 52 добавлений и 3 удалений

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

@ -53,6 +53,9 @@ class MarionetteReftestChild extends JSWindowActorChild {
let result;
switch (name) {
case "MarionetteReftestParent:flushRendering":
result = await this.flushRendering();
break;
case "MarionetteReftestParent:reftestWait":
result = await this.reftestWait(data);
break;
@ -191,7 +194,12 @@ class MarionetteReftestChild extends JSWindowActorChild {
}
for (let i = 0; i < win.frames.length; ++i) {
flushWindow(win.frames[i]);
// Skip remote frames, flushRendering will be called on their individual
// MarionetteReftest actor via _recursiveFlushRendering performed from
// the topmost MarionetteReftest actor.
if (!Cu.isRemoteProxy(win.frames[i])) {
flushWindow(win.frames[i]);
}
}
}
flushWindow(this.document.defaultView);

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

@ -29,6 +29,12 @@ class MarionetteReftestParent extends JSWindowActorParent {
useRemote,
}
);
if (isCorrectUrl) {
// Trigger flush rendering for all remote frames.
await this._flushRenderingInSubtree();
}
return isCorrectUrl;
} catch (e) {
if (e.name === "AbortError") {
@ -41,4 +47,39 @@ class MarionetteReftestParent extends JSWindowActorParent {
throw e;
}
}
/**
* Call flushRendering on all browsing contexts in the subtree.
* Each actor will flush rendering in all the same process frames.
*/
async _flushRenderingInSubtree() {
const browsingContext = this.manager.browsingContext;
const contexts = browsingContext.getAllBrowsingContextsInSubtree();
await Promise.all(
contexts.map(async context => {
if (context === browsingContext) {
// Skip the top browsing context, for which flushRendering is
// already performed via the initial reftestWait call.
return;
}
const windowGlobal = context.currentWindowGlobal;
if (!windowGlobal) {
// Bail out if there is no window attached to the current context.
return;
}
if (!windowGlobal.isProcessRoot) {
// Bail out if this window global is not a process root.
// MarionetteReftestChild::flushRendering will flush all same process
// frames, so we only need to call flushRendering on process roots.
return;
}
const reftestActor = windowGlobal.getActor("MarionetteReftest");
await reftestActor.sendQuery("MarionetteReftestParent:flushRendering");
})
);
}
}

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

@ -1,3 +1,3 @@
[iframe-cross-origin-print.sub.html]
disabled:
if fission: https://bugzilla.mozilla.org/show_bug.cgi?id=1574508
expected:
if fission: FAIL