[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

mjs at apple.com mjs at apple.com
Thu Feb 4 21:26:54 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 9fc28d8f62faaf8142c4291c7301fc9fcd91d342
Author: mjs at apple.com <mjs at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 25 04:11:38 2010 +0000

    2010-01-24  Maciej Stachowiak  <mjs at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Content with heavily nested residual style is so slow, it seems like a hang
            https://bugs.webkit.org/show_bug.cgi?id=34059
            <rdar://problem/7292906>
    
            Test cast: fast/parser/residual-style-hang.html
    
            * html/HTMLParser.cpp:
            (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
            Limit the number of iterations of the main loop to 5.
    
            The reason this limit is necessary is that otherwise, N misnested open tags followed
            by N misnested close tags will cause O(N^2) of work due to cloning and attaching subtrees;
            at a fixed limit, the cost is at worst O(N).
    
            The code that was in the loop originally ran exactly once - the loop was added in
            r21472 to fix <https://bugs.webkit.org/show_bug.cgi?id=13603>. I have verified that
            with the iteration limit, the bug is still fixed, both with the original test case
            and with the layout tests tht were added.
    2010-01-24  Maciej Stachowiak  <mjs at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Content with heavily nested residual style is so slow, it seems like a hang
            https://bugs.webkit.org/show_bug.cgi?id=34059
            <rdar://problem/7292906>
    
            Test case for the above bug fix.
    
            * fast/parser/residual-style-hang-expected.txt: Added.
            * fast/parser/residual-style-hang.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53790 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 69b8b8b..71f2aba 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-24  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Content with heavily nested residual style is so slow, it seems like a hang
+        https://bugs.webkit.org/show_bug.cgi?id=34059
+        <rdar://problem/7292906>
+
+        Test case for the above bug fix.
+
+        * fast/parser/residual-style-hang-expected.txt: Added.
+        * fast/parser/residual-style-hang.html: Added.
+
 2010-01-24  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/parser/residual-style-hang-expected.txt b/LayoutTests/fast/parser/residual-style-hang-expected.txt
new file mode 100644
index 0000000..f320093
--- /dev/null
+++ b/LayoutTests/fast/parser/residual-style-hang-expected.txt
@@ -0,0 +1,2 @@
+This test checks whether deeply nested residual style processing hangs the browser. When it passes, it should not hang.
+
diff --git a/LayoutTests/fast/parser/residual-style-hang.html b/LayoutTests/fast/parser/residual-style-hang.html
new file mode 100644
index 0000000..e31c375
--- /dev/null
+++ b/LayoutTests/fast/parser/residual-style-hang.html
@@ -0,0 +1,325 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+<b><div>
+This test checks whether deeply nested residual style processing hangs the browser. When it passes, it should not hang.
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
+</b>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 84ec645..8739145 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-01-24  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Content with heavily nested residual style is so slow, it seems like a hang
+        https://bugs.webkit.org/show_bug.cgi?id=34059
+        <rdar://problem/7292906>
+        
+        Test cast: fast/parser/residual-style-hang.html
+
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
+        Limit the number of iterations of the main loop to 5.
+        
+        The reason this limit is necessary is that otherwise, N misnested open tags followed
+        by N misnested close tags will cause O(N^2) of work due to cloning and attaching subtrees;
+        at a fixed limit, the cost is at worst O(N).
+        
+        The code that was in the loop originally ran exactly once - the loop was added in
+        r21472 to fix <https://bugs.webkit.org/show_bug.cgi?id=13603>. I have verified that
+        with the iteration limit, the bug is still fixed, both with the original test case
+        and with the layout tests tht were added.
+
 2010-01-24  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp
index f116bff..644f63e 100644
--- a/WebCore/html/HTMLParser.cpp
+++ b/WebCore/html/HTMLParser.cpp
@@ -65,6 +65,8 @@ using namespace HTMLNames;
 
 static const unsigned cMaxRedundantTagDepth = 20;
 static const unsigned cResidualStyleMaxDepth = 200;
+static const unsigned cResidualStyleIterationLimit = 5;
+
 
 static const int minBlockLevelTagPriority = 3;
 
@@ -1128,8 +1130,10 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
     bool finished = false;
     bool strayTableContent = elem->strayTableContent;
 
+    unsigned iterationCount = 0;
+
     m_handlingResidualStyleAcrossBlocks = true;
-    while (!finished) {
+    while (!finished && (iterationCount++ < cResidualStyleIterationLimit)) {
         // Find the outermost element that crosses over to a higher level. If there exists another higher-level
         // element, we will do another pass, until we have corrected the innermost one.
         ExceptionCode ec = 0;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list