Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
REGRESSION(r190430): Assertion failure in Text::~Text()
https://bugs.webkit.org/show_bug.cgi?id=153577 Reviewed by Antti Koivisto. Source/WebCore: The bug was caused by destroyRenderTreeIfNeeded exiting early on all HTMLSlotElement as it lacks a render object. Fixed it by explicitly avoiding the early return when child is a HTMLSlotElement. Test: fast/shadow-dom/slot-removal-crash-2.html * dom/ContainerNode.cpp: (WebCore::destroyRenderTreeIfNeeded): LayoutTests: Added a regression test. The test hits an assertion in debug build without the fix. * fast/shadow-dom/slot-removal-crash-2-expected.txt: Added. * fast/shadow-dom/slot-removal-crash-2.html: Added. Canonical link: https://commits.webkit.org/171653@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
84 additions
and 1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,5 @@ | ||
Test that removing a slot element with text node does not result in an assertion failure. | ||
The test passes if WebKit does not hit an assertion. | ||
PASS. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<p>Test that removing a slot element with text node does not result in an assertion failure.<br> | ||
The test passes if WebKit does not hit an assertion.</p> | ||
<script> | ||
|
||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
var iframe = document.createElement('iframe'); | ||
document.body.appendChild(iframe); | ||
|
||
var x; | ||
|
||
function runTest() { | ||
var doc = iframe.contentDocument; | ||
|
||
var host = doc.createElement('div'); | ||
var shadowRoot = host.attachShadow({mode: 'open'}); | ||
var slot = doc.createElement('slot'); | ||
slot.textContent = 'hello'; | ||
shadowRoot.appendChild(slot); | ||
doc.body.appendChild(host); | ||
|
||
setTimeout(function () { | ||
x = slot.offsetTop; | ||
shadowRoot.removeChild(slot); | ||
}, 0); | ||
} | ||
|
||
runTest(); | ||
|
||
setTimeout(function () { | ||
iframe.src = 'about:blank'; | ||
x = document.body.offsetTop; | ||
if (window.GCController) | ||
GCController.collect(); | ||
|
||
document.querySelector('p').innerHTML += '<br>PASS.'; | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
}, 0); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters