devtools might use outdated slot's distributed nodes in testing environment |
||
Issue descriptionhttp/tests/devtools/elements/shadow/shadow-distribution.js is failing with IncrementalShadowDOM flag. https://test-results.appspot.com/data/layout_results/linux_chromium_rel_ng/77814/layout-test-results/results.html It looks the cause is: - devtool's inspector maintains its own distributedNodes as slot's *expanded* children. It looks expanded children are updated in InspectorDOMAgent::DidPerformSlotDistribution [1]. - probe::didPerformSlotDistribution is called if and only if actual slot's distributed_nodes are actually updated [2]. [1] https://cs.chromium.org/chromium/src/out/Debug/gen/third_party/blink/renderer/core/CoreProbesInl.h?type=cs&q=didPerformSlotDistribution&l=124 [2] https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_slot_element.cc?type=cs&l=554 Given that, it would be possible that inspector shows outdated distributed nodes unless devtools explicitly try to update distribution because the actual distribution is calculated lazily as per Blink's current architecture. An inspector might show outdated distributed nodes if the distribution is dirty; NeedsDistributionRecal flag is set. I don't think this is a serious issue because I believe that end users wouldn't face this issue in most cases. The distribution is surely updated in most cases when end users are using an inspector. However, it looks this can be observable in layout testing, where the rendering pipeline does't have any chance to update distribution between DOM mutation and assertions used in tests. In fact, when we turn on IncrementalShadowDOM flag, this can be observable via shadow-distribution.js test. I've investigated why this can not be observable in testing without IncrementalShadowDOM flag. It turned out an slotchange event triggers to update distribution. The slotchange event happens at the timing of between DOM mutation and assertion used in testing; slotchange event is dispatched at the end of microtask timing. In non-IncrementalShadowDOM, an event path calculation needs to update distribution, however, this is no longer true for IncrementalShadowDOM, that is one of the benefits of IncrementalShadowDOM. I guess the test shouldn't depend on an slotchange event implicitly for updating distribution. I guess the shadow-distribuiton.js passes without any intention to depend on slotchange events. IncrementalShadowDOM just revealed that.
,
May 7 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3 commit d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3 Author: Hayato Ito <hayato@chromium.org> Date: Mon May 07 11:17:03 2018 [IncrementalShadowDOM] Support slot's expanded nodes in devtools Support slot's expanded nodes, using slot's assigned nodes, for IncrementalShadowDOM. Inspector can show slot's assigned nodes correctly even in IncrementalShadowDOM. virtual/incremental-shadow-dom/http/tests/devtools/elements/shadow/shadow-distribution.js test is still failing, however, this is not a regression of IncrementalShadowDOM. See crbug.com/840238 for details. This CL adds an expected.txt for the test. Bug: 776656 , 840238 Change-Id: I037caf9184e9be42525575bf2e027cf000bdbf7a Reviewed-on: https://chromium-review.googlesource.com/1029567 Commit-Queue: Hayato Ito <hayato@chromium.org> Reviewed-by: Takayoshi Kochi <kochi@chromium.org> Reviewed-by: Rakina Zata Amni <rakina@chromium.org> Cr-Commit-Position: refs/heads/master@{#556414} [modify] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/WebKit/LayoutTests/virtual/incremental-shadow-dom/http/tests/devtools/elements/shadow/README.txt [add] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/WebKit/LayoutTests/virtual/incremental-shadow-dom/http/tests/devtools/elements/shadow/shadow-distribution-expected.txt [modify] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/blink/renderer/core/html/html_slot_element.cc [modify] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/blink/renderer/core/html/html_slot_element.h [modify] https://crrev.com/d55f0816be5901e9e5bfdf49b7c6e785dca0c3d3/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc
,
Dec 4
I assume this is fixed. |
||
►
Sign in to add a comment |
||
Comment 1 by hayato@chromium.org
, May 7 2018