Bug 1593170. Adjust how we deal with the reftest events for async plugin drawing for the fission changes to the reftest harness. r=mattwoodrow
☠☠ backed out by bdca724cf3a2 ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 18 Nov 2019 00:45:33 +0000
changeset 502363 80bd8cadf835988a4ea48084d80cf47eb4aa5b24
parent 502362 a004de6493422688953b5b8ea2fc5e1522240f47
child 502364 a10072d821e51e633d96a86120595e37a49429c2
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1593170
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1593170. Adjust how we deal with the reftest events for async plugin drawing for the fission changes to the reftest harness. r=mattwoodrow The long code comment explains. Differential Revision: https://phabricator.services.mozilla.com/D51345
layout/tools/reftest/reftest-content.js
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -1023,26 +1023,46 @@ function OnDocumentLoad(event)
     setupDisplayport(contentRootElement);
     var inPrintMode = false;
 
     async function AfterOnLoadScripts() {
         // Regrab the root element, because the document may have changed.
         var contentRootElement =
           content.document ? content.document.documentElement : null;
 
+        // "MozPaintWait" events are dispatched using a scriptrunner, so we
+        // receive then after painting has finished but before the main thread
+        // returns from the paint call. Then a "MozPaintWaitFinished" is
+        // dispatched to the main thread event loop.
+        // Before Fission both the FlushRendering and SendInitCanvasWithSnapshot
+        // calls were sync, but with Fission they must be async. So before Fission
+        // we got the MozPaintWait event but not the MozPaintWaitFinished event
+        // here (yet), which made us enter WaitForTestEnd. After Fission we get
+        // both MozPaintWait and MozPaintWaitFinished here. So to make this work
+        // the same way as before we just track if we got either event and go
+        // into reftest-wait mode.
+        var paintWaiterFinished = false;
+
+        gExplicitPendingPaintsCompleteHook = function () {
+            LogInfo("PaintWaiters finished while we were sending initial snapshop in AfterOnLoadScripts");
+            paintWaiterFinished = true;
+        }
+
         // Flush the document in case it got modified in a load event handler.
         await FlushRendering(FlushMode.ALL);
 
         // Take a snapshot now. We need to do this before we check whether
         // we should wait, since this might trigger dispatching of
         // MozPaintWait events and make shouldWaitForExplicitPaintWaiters() true
         // below.
         let painted = await SendInitCanvasWithSnapshot(ourURL);
 
-        if (shouldWaitForExplicitPaintWaiters() ||
+        gExplicitPendingPaintsCompleteHook = null;
+
+        if (paintWaiterFinished || shouldWaitForExplicitPaintWaiters() ||
             (!inPrintMode && doPrintMode(contentRootElement)) ||
             // If we didn't force a paint above, in
             // InitCurrentCanvasWithSnapshot, so we should wait for a
             // paint before we consider them done.
             !painted) {
             LogInfo("AfterOnLoadScripts belatedly entering WaitForTestEnd");
             // Go into reftest-wait mode belatedly.
             WaitForTestEnd(contentRootElement, inPrintMode, [], ourURL);