<dialog> and <iframe> and shadow root on the same page cause DCHECK crash |
|||||||||||||
Issue description
Minimal repro provided by @rbpotter.
See attached HTML file, also pasting below.
<button onclick="showDialog()">Click to show dialog</button>
<iframe></iframe>
<div id="container"></div>
<script>
function showDialog() {
let d = document.querySelector('#container');
d.attachShadow({'mode': 'open'});
let di = document.createElement('dialog');
d.appendChild(di);
document.body.appendChild(d);
di.showModal();
}
</script>
When the button is clicked, the tab is crashing with the following stack trace
[1:1:0119/160952.225034:FATAL:FlatTreeTraversal.h(149)] Check failed: !node.NeedsDistributionRecalc().
#0 0x7fa6080fb3ec base::debug::StackTrace::StackTrace()
#1 0x7fa608125dbc logging::LogMessage::~LogMessage()
#2 0x7fa600ae3af7 blink::FlatTreeTraversal::AssertPrecondition()
#3 0x7fa600cbedb8 blink::FlatTreeTraversal::ContainsIncludingPseudoElement()
#4 0x7fa600cde460 blink::Node::IsInert()
#5 0x7fa600f4ebc5 blink::LocalFrame::PropagateInertToChildFrames()
#6 0x7fa6010175af blink::HTMLDialogElement::showModal()
#7 0x7fa6018fd6dd blink::V8HTMLDialogElement::showModalMethodCallback()
#8 0x7fa602010182 v8::internal::FunctionCallbackArguments::Call()
#9 0x7fa60210aa95 v8::internal::(anonymous namespace)::HandleApiCallHelper<>()
#10 0x7fa602108b89 v8::internal::Builtin_Impl_HandleApiCall()
#11 0x7fa6021085cd v8::internal::Builtin_HandleApiCall()
,
Jan 20 2018
I can repro on 66.0.3326.0 Linux, have not tried other platforms. Also attaching minimal repro again (removed an unnecessary call to document.body.appendChild).
,
Jan 20 2018
,
Jan 20 2018
,
Jan 20 2018
,
Jan 22 2018
,
Jan 22 2018
Looks like the crashing point is related to inertness handling. Routing to accessibility people, and removing Shadow DOM / <iframe> as it is not very relevant.
,
Jan 22 2018
@kochi: The stacktrace indeed points within the inertness handling code, but it is only reproducable when Shadow DOM and an iframe are used. Was not able to find a minimal repro example without involving these.
,
Jan 23 2018
dpapad@ right, but Shadow DOM or iframe is just a part of DOM, inertness handling has to take care of these. So I think the primary responsibility for the code is on accessibility. Dominic or Alice, feel free to assign back to Shadow DOM people.
,
Feb 9 2018
Any updates here? This is affecting Chrome's own new Print Preview UI (--enable-features=NewPrintPreview). I would appreciate if someone take a look or suggest a better Blink component for this bug. Thanks
,
Feb 9 2018
I remember that there was an attempt to fix a crash which IsInnert() would cause, due to the wrong assumption of distribution's dirtiness. See https://chromium-review.googlesource.com/c/chromium/src/+/566341 It looks that is not fixed yet. BTW, I am working on incremental shadow dom, which will remove this kind of painful points from us. http://goto/incremental-shadow-dom
,
Feb 9 2018
,
Feb 16 2018
,
May 17 2018
I've confirmed that Incremental Shadow DOM actually fixes this. That is a great news for us. So once we land IncrementalShadowDOM, let me close this issue.
,
May 17 2018
,
Jun 7 2018
This is still broken in 69.0.3452.0 for Print Preview, although the test case above seems to be fixed. New minimal example attached & pasted below, should I re-open this or open a new bug? It is the same DCHECK, but requires a slightly more complicated case to reproduce.
<template id="dialog">
<custom-dialog></custom-dialog>
</template>
<button on-click="onButtonClick_">Show dialog</button>
<div></div>
<iframe></iframe>
<script>
var customDialogProto = Object.create(HTMLElement.prototype);
customDialogProto.createdCallback = function() {
const shadowRoot = this.createShadowRoot();
shadowRoot.innerHTML = '<dialog></dialog>';
};
customDialogProto.show = function() {
this.shadowRoot.querySelector('dialog').showModal();
};
document.registerElement('custom-dialog', { prototype: customDialogProto });
const b = document.body.querySelector('button');
b.addEventListener('click', () => {
const dialogTemplate = document.querySelector('#dialog');
const d = document.importNode(dialogTemplate.content, true);
const dialog = d.querySelector('custom-dialog');
document.querySelector('div').appendChild(d);
dialog.show();
});
</script>
,
Jun 7 2018
Re-opening to make sure this gets some attention.
,
Jun 8 2018
,
Jun 8 2018
Let me make this available. I guess IsInert (or other code) violates the assumption of using FlatTreeTraversal. I remember aboxhall@ tried to fix a similar bug in https://chromium-review.googlesource.com/c/chromium/src/+/566341. That might be related.
,
Jun 8 2018
aboxhall, could you work on this? It looks isInert is using FlatTreeTraversal without updating distribution, which violates the pre-condition of using FlatTreeTraversal.
,
Oct 12
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e commit ae2fcf0ef323eb487edced1ab876a090b3f9ce1e Author: Noel Gordon <noel@chromium.org> Date: Fri Oct 12 07:04:47 2018 Add Quick View audio load test Now we have the QuickView <webview> infra to detect the 'loaded' state of the <webview> content, add a <file-safe-media> audio test, and also check the <webview> renders its content on a transparent black body. This test exposed an issue in Blink node code. When the modal <dialog> is calling showModal(), its flat tree distribution can be out-of-date, causing a DCHECK crash when testing if the Quick View <dialog> element contains sibling <iframe id="command-dispatcher"> [1]. Fix that: FlatTreeTraversal::ContainsIncludingPseudoElement() requires that its node arguments have up-to-date flat tree distribution. Ensure the <dialog>'s flat tree distribution is up-of-date _before_ trying to propagate the "inert" bit into sub-frames. Add crash test: html/dialog/showmodal-shadow-sibling-frame-crash.html [1] Known crash reports already exist: issue 789094 issue 804047 . test: browser_tests --gtest_filter="QuickView*openQuickViewAudio" Bug: 891150 , 789094, 804047 Change-Id: I714585272fc775c157f6d0bd97143af27bf2b961 Reviewed-on: https://chromium-review.googlesource.com/c/1264138 Commit-Queue: Noel Gordon <noel@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: Luciano Pacheco <lucmult@chromium.org> Cr-Commit-Position: refs/heads/master@{#599125} [modify] https://crrev.com/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc [add] https://crrev.com/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e/third_party/WebKit/LayoutTests/html/dialog/showmodal-shadow-sibling-frame-crash-expected.txt [add] https://crrev.com/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e/third_party/WebKit/LayoutTests/html/dialog/showmodal-shadow-sibling-frame-crash.html [modify] https://crrev.com/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e/third_party/blink/renderer/core/html/html_dialog_element.cc [modify] https://crrev.com/ae2fcf0ef323eb487edced1ab876a090b3f9ce1e/ui/file_manager/integration_tests/file_manager/quick_view.js
,
Oct 13
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4052e809d3bb03478e56c341cc877e49eed96225 commit 4052e809d3bb03478e56c341cc877e49eed96225 Author: Noel Gordon <noel@chromium.org> Date: Sat Oct 13 00:18:09 2018 Partially back-off CL:1264138 to use the fix in CL:823582 CL:823582 used ForceLayoutForCentering() which updates the dialog flat tree distribution as a side-effect. Hence, the forced dialog flat tree distribution update in CL:1264138 is now redundant and can be removed. Covered by layout tests: html/dialog/showmodal-shadow-sibling-frame-crash.html html/dialog/dialog-show-modal-inert-crash.html Covered by Chrome OS browser test: browser_tests --gtest_filter="QuickView*openQuickViewAudio" Tbr: hayato-san Bug: 891150 , 789094, 804047 Change-Id: I84f5e0d29aab2c8956b689bb713a9c383471aa80 Reviewed-on: https://chromium-review.googlesource.com/c/1278075 Commit-Queue: Noel Gordon <noel@chromium.org> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org> Cr-Commit-Position: refs/heads/master@{#599436} [modify] https://crrev.com/4052e809d3bb03478e56c341cc877e49eed96225/third_party/blink/renderer/core/html/html_dialog_element.cc
,
Oct 15
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b275fdf7b833eb58807c628a7e663bda7fd98cab commit b275fdf7b833eb58807c628a7e663bda7fd98cab Author: Noel Gordon <noel@chromium.org> Date: Mon Oct 15 04:56:18 2018 Update html/dialog/showmodal-shadow-sibling-frame-crash.html Convert this test to a testharness test. With CL:823582 this test does not crash, and does crash prior to that change. Note: this test uses shadomDOM V0 registerElement and createShadowRoot since the crash does not reproduce when using shadowDOM V1 methods. Bug: 789094, 804047 Change-Id: Ia65c2f75b805ed99a7401d5b64110601f917a5d7 Reviewed-on: https://chromium-review.googlesource.com/c/1278456 Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: Alan Cutter <alancutter@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#599566} [delete] https://crrev.com/beb96b18d42739814889166ca1c96c4b27000771/third_party/WebKit/LayoutTests/html/dialog/showmodal-shadow-sibling-frame-crash-expected.txt [modify] https://crrev.com/b275fdf7b833eb58807c628a7e663bda7fd98cab/third_party/WebKit/LayoutTests/html/dialog/showmodal-shadow-sibling-frame-crash.html
,
Oct 15
|
|||||||||||||
►
Sign in to add a comment |
|||||||||||||
Comment 1 by dpa...@chromium.org
, Jan 20 2018