Bug 1593170. Adjust how we deal with the reftest events for async plugin drawing for the fission changes to the reftest harness. r=mattwoodrow
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 18 Nov 2019 11:26:33 +0000
changeset 502489 ddcfa0a1fa00353cb74f5b237a9652bce8398b45
parent 502488 449d87c4759340bd61e4ae3ab0bc67f826ac02cf
child 502490 285e9108032ffb6cd62fe7d587ef97c1a86d8d41
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);