measure-updated-layout.html is flaky |
||||
Issue description
,
Jan 4
,
Jan 4
So the issue seems to be that when we do Element::AttachLayoutTree on the container element, we don't create a layout object, and the display lock's update promise is rejected. This happens about 0.8% of the time for me locally.
The fix is easy enough:
replacing runTest(); with window.onload = runTest;
However, I'd like to understand why this is happening. +futhark do you by any chance know why we wouldn't create a layout object when we attach a layout tree? Essentially what we have is
<div id="parent"></div>
<script>
let container = document.createElement("div");
container.id = "container";
document.getElementById("parent").appendChild(container);
</script>
With container being styled to have size and content containment. If we delay the script block to be in an onload handler then everything seems to work.
If we don't create a layout object at that time, when would we create it? Or is this a misuse of code and layout object is never created?
,
Jan 4
You might have some race condition going on with your async runTest() and html parsing since the html parser may finish parsing the document before runTest() finishes. Finishing html parsing will cause a style/layout tree update here: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/document.cc?sq=package:chromium&g=0&l=6122-6123
,
Jan 7
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e43c748762648c7104a5d33f33cae91be744b2b6 commit e43c748762648c7104a5d33f33cae91be744b2b6 Author: Vladimir Levin <vmpstr@chromium.org> Date: Mon Jan 07 15:56:28 2019 [PE,DL] Deflake a display locking test. This test fails occasionally due to the fact that when we attach the layout tree, the element doesn't have the layout object (yet). To fix it ensure that this test (and another similar one) are run from an onload handler. For more information see the referenced bug. R=chrishtr@chromium.org Bug: 919096 Change-Id: Id13f87c2d5c5720fd6fde0af1c74e7a0e70623bb Reviewed-on: https://chromium-review.googlesource.com/c/1396494 Commit-Queue: vmpstr <vmpstr@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#620333} [modify] https://crrev.com/e43c748762648c7104a5d33f33cae91be744b2b6/third_party/blink/web_tests/TestExpectations [modify] https://crrev.com/e43c748762648c7104a5d33f33cae91be744b2b6/third_party/blink/web_tests/display-lock/lock-before-append/measure-forced-layout.html [modify] https://crrev.com/e43c748762648c7104a5d33f33cae91be744b2b6/third_party/blink/web_tests/display-lock/lock-before-append/measure-updated-layout.html
,
Jan 8
Thanks for the explanation.. it was very likely that it was the parser race as you describe.. |
||||
►
Sign in to add a comment |
||||
Comment 1 by bugdroid1@chromium.org
, Jan 4