Bug 1596052. If the SendUpdateCanvasForEvent call is for a previous test then ignore it. r=mattwoodrow
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 15 Nov 2019 22:41:19 +0000
changeset 502299 b9737a17de366f287072fec20ae5dcbc14bfad50
parent 502298 2dcb4f20e472a3ff0fc61891746c59c9a8be75c4
child 502300 4c41a3b36c68de9abaf195c7a1cca4b87895ba5d
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
bugs1596052, 1593171
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 1596052. If the SendUpdateCanvasForEvent call is for a previous test then ignore it. r=mattwoodrow This is basically what we did in bug 1593171 (Protect against the same test from calling RecordResult more than once in the reftest harness) where we early exit in SendInitCanvasWithSnapshot. But now we do it in SendUpdateCanvasForEvent too because SendUpdateCanvasForEvent calls SynchronizeForSnapshot which calls setupAsyncScrollOffsets and setupAsyncZoom, both of which get the documentElement of the current doc and operate on it. The problem is that this could be SendUpdateCanvasForEvent call from the previous test operating on the dom of the current test. I haven't actually observed this, just noticed it while implementing checking of contentRootElement to make sure all cases are covered. Differential Revision: https://phabricator.services.mozilla.com/D52827
layout/tools/reftest/reftest-content.js
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -558,17 +558,17 @@ function WaitForTestEnd(contentRootEleme
     function AfterPaintListener(event) {
         LogInfo("AfterPaintListener in " + event.target.document.location.href);
         if (event.target.document != currentDoc) {
             // ignore paint events for subframes or old documents in the window.
             // Invalidation in subframes will cause invalidation in the toplevel document anyway.
             return;
         }
 
-        SendUpdateCanvasForEvent(event, contentRootElement);
+        SendUpdateCanvasForEvent(forURL, event, contentRootElement);
         // These events are fired immediately after a paint. Don't
         // confuse ourselves by firing synchronously if we triggered the
         // paint ourselves.
         setTimeout(MakeProgress, 0);
     }
 
     function AttrModifiedListener() {
         LogInfo("AttrModifiedListener fired");
@@ -1354,18 +1354,25 @@ function roundTo(x, fraction)
 function elementDescription(element)
 {
     return '<' + element.localName +
         [].slice.call(element.attributes).map((attr) =>
             ` ${attr.nodeName}="${attr.value}"`).join('') +
         '>';
 }
 
-function SendUpdateCanvasForEvent(event, contentRootElement)
+function SendUpdateCanvasForEvent(forURL, event, contentRootElement)
 {
+    if (forURL != gCurrentURL) {
+        LogInfo("SendUpdateCanvasForEvent called for previous document");
+        // This is a test we are already done with that is clearing out.
+        // Don't do anything.
+        return;
+    }
+
     var win = content;
     var scale = markupDocumentViewer().fullZoom;
 
     var rects = [ ];
     if (shouldSnapshotWholePage(contentRootElement)) {
       // See comments in SendInitCanvasWithSnapshot() re: the split
       // logic here.
       if (!gBrowserIsRemote) {