Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-07-20 Hayato Ito <hayato@chromium.org>
Reviewed by Darin Adler. Fixed a crash when deeply nested CSS selector is used. https://bugs.webkit.org/show_bug.cgi?id=41129 This patch deletes CSSSelectors iteratively so that it doesn't cause stack overflow. * fast/css/css-selector-deeply-nested-expected.txt: Added. * fast/css/css-selector-deeply-nested.html: Added. 2010-07-20 Hayato Ito <hayato@chromium.org> Reviewed by Darin Adler. Fixed a crash when deeply nested CSS selector is used. https://bugs.webkit.org/show_bug.cgi?id=41129 This patch deletes CSSSelectors iteratively so that it doesn't cause stack overflow. Test: fast/css/css-selector-deeply-nested.html * css/CSSSelector.cpp: (WebCore::CSSSelectorBag::~CSSSelectorBag): (WebCore::CSSSelectorBag::isEmpty): (WebCore::CSSSelectorBag::append): (WebCore::CSSSelectorBag::takeAny): (WebCore::CSSSelector::~CSSSelector): (WebCore::CSSSelector::specificity): * css/CSSSelector.h: Canonical link: https://commits.webkit.org/54585@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
136 additions
and 9 deletions.
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,3 @@ | ||
Test case for http://bugs.webkit.org/show_bug.cgi?id=41129 | ||
|
||
If browser didn't crash, the test passed. |
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,25 @@ | ||
<html> | ||
<head></head> | ||
<body> | ||
<script> | ||
function generate_deeply_nested_selector(nest) { | ||
var selector = []; | ||
for (var i = 0; i < nest; ++i) | ||
selector.push('* > '); | ||
// We don't add last '*' to the selector so that this CSS Selector is invalid. | ||
selector.push(' {background:blue}'); | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
style.innerHTML = selector.join(''); | ||
document.head.appendChild(style); | ||
} | ||
|
||
generate_deeply_nested_selector(400000); | ||
|
||
if (window.layoutTestController) | ||
layoutTestController.dumpAsText(); | ||
</script> | ||
<p>Test case for <a href="http://bugs.webkit.org/show_bug.cgi?id=41129">http://bugs.webkit.org/show_bug.cgi?id=41129</a></p> | ||
<p>If browser didn't crash, the test passed.</p> | ||
</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
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