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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Nikkel 2019-11-15 22:41:19 +00:00
Родитель 7e99bb005b
Коммит d714373537
1 изменённых файлов: 9 добавлений и 2 удалений

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

@ -563,7 +563,7 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements, f
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.
@ -1359,8 +1359,15 @@ function elementDescription(element)
'>';
}
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;