Title: [140659] trunk/Source
Revision
140659
Author
morr...@google.com
Date
2013-01-24 00:23:16 -0800 (Thu, 24 Jan 2013)

Log Message

There are a few of wrong removeAllChildren() call
https://bugs.webkit.org/show_bug.cgi?id=107790

Reviewed by Ryosuke Niwa.

Source/WebCore:

removeAllChildren() is designed for trashing deleting children out.
It doesn't detach() children and could have possible leak.
This change replaces such removeAllChildren() usage with safer removeChildren().

No new tests. Covered by existing tests.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/InputType.cpp:
(WebCore::InputType::destroyShadowSubtree):
* html/ValidationMessage.cpp:
(WebCore::ValidationMessage::setMessageDOMAndStartTimer):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processEndTag):

Source/WebKit/qt:

* Api/qwebelement.cpp: Repalced removeAllChildren() with safer removeChildren()
(QWebElement::removeAllChildren):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140658 => 140659)


--- trunk/Source/WebCore/ChangeLog	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebCore/ChangeLog	2013-01-24 08:23:16 UTC (rev 140659)
@@ -1,3 +1,25 @@
+2013-01-24  Hajime Morrita  <morr...@google.com>
+
+        There are a few of wrong removeAllChildren() call
+        https://bugs.webkit.org/show_bug.cgi?id=107790
+
+        Reviewed by Ryosuke Niwa.
+
+        removeAllChildren() is designed for trashing deleting children out.
+        It doesn't detach() children and could have possible leak.
+        This change replaces such removeAllChildren() usage with safer removeChildren().
+
+        No new tests. Covered by existing tests.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+        * html/InputType.cpp:
+        (WebCore::InputType::destroyShadowSubtree):
+        * html/ValidationMessage.cpp:
+        (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processEndTag):
+
 2013-01-24  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: should init an AXObject only after AXObjectCache has added it

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (140658 => 140659)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2013-01-24 08:23:16 UTC (rev 140659)
@@ -752,7 +752,8 @@
             detach();
             m_inputType->destroyShadowSubtree();
             m_inputType->createShadowSubtree();
-            attach();
+            if (!attached())
+                attach();
         } else {
             m_inputType->destroyShadowSubtree();
             m_inputType->createShadowSubtree();

Modified: trunk/Source/WebCore/html/InputType.cpp (140658 => 140659)


--- trunk/Source/WebCore/html/InputType.cpp	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebCore/html/InputType.cpp	2013-01-24 08:23:16 UTC (rev 140659)
@@ -489,14 +489,14 @@
     if (!root)
         return;
 
-    root->removeAllChildren();
+    root->removeChildren();
 
     // It's ok to clear contents of all other ShadowRoots because they must have
     // been created by TextFieldDecorationElement, and we don't allow adding
     // AuthorShadowRoot to HTMLInputElement.
     while ((root = root->youngerShadowRoot())) {
 #if ENABLE(SHADOW_DOM)
-        root->removeAllChildren();
+        root->removeChildren();
         root->appendChild(HTMLShadowElement::create(shadowTag, element()->document()));
 #else
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/html/ValidationMessage.cpp (140658 => 140659)


--- trunk/Source/WebCore/html/ValidationMessage.cpp	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebCore/html/ValidationMessage.cpp	2013-01-24 08:23:16 UTC (rev 140659)
@@ -125,8 +125,8 @@
     ASSERT(!validationMessageClient());
     ASSERT(m_messageHeading);
     ASSERT(m_messageBody);
-    m_messageHeading->removeAllChildren();
-    m_messageBody->removeAllChildren();
+    m_messageHeading->removeChildren();
+    m_messageBody->removeChildren();
     Vector<String> lines;
     m_message.split('\n', lines);
     Document* doc = m_messageHeading->document();

Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (140658 => 140659)


--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2013-01-24 08:23:16 UTC (rev 140659)
@@ -2152,7 +2152,7 @@
             m_scriptToProcess = m_tree.currentElement();
             m_tree.openElements()->pop();
             if (isParsingFragment() && !scriptingContentIsAllowed(m_fragmentContext.scriptingPermission()))
-                m_scriptToProcess->removeAllChildren();
+                m_scriptToProcess->removeChildren();
             setInsertionMode(m_originalInsertionMode);
 
             // This token will not have been created by the tokenizer if a

Modified: trunk/Source/WebKit/qt/Api/qwebelement.cpp (140658 => 140659)


--- trunk/Source/WebKit/qt/Api/qwebelement.cpp	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebKit/qt/Api/qwebelement.cpp	2013-01-24 08:23:16 UTC (rev 140659)
@@ -1198,7 +1198,7 @@
     if (!m_element)
         return;
 
-    m_element->removeAllChildren();
+    m_element->removeChildren();
 }
 
 // FIXME: This code, and all callers are wrong, and have no place in a

Modified: trunk/Source/WebKit/qt/ChangeLog (140658 => 140659)


--- trunk/Source/WebKit/qt/ChangeLog	2013-01-24 08:16:00 UTC (rev 140658)
+++ trunk/Source/WebKit/qt/ChangeLog	2013-01-24 08:23:16 UTC (rev 140659)
@@ -1,3 +1,13 @@
+2013-01-24  Hajime Morrita  <morr...@google.com>
+
+        There are a few of wrong removeAllChildren() call
+        https://bugs.webkit.org/show_bug.cgi?id=107790
+
+        Reviewed by Ryosuke Niwa.
+
+        * Api/qwebelement.cpp: Repalced removeAllChildren() with safer removeChildren()
+        (QWebElement::removeAllChildren):
+
 2013-01-23  Shinya Kawanaka  <shin...@chromium.org>
 
         shadowAncestorNode() should be renamed to deprecatedShadowAncestorNode()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to