Title: [200074] trunk/Source/WebCore
Revision
200074
Author
[email protected]
Date
2016-04-25 22:07:44 -0700 (Mon, 25 Apr 2016)

Log Message

[iOS] ftp links crash @ WebCore::FTPDirectoryDocumentParser::appendEntry
https://bugs.webkit.org/show_bug.cgi?id=157019
<rdar://problem/24292650>

Reviewed by Chris Dumez.

Create separate Ref<Element> object for every row element instead of reusing
one because Ref<>'s operator=() does not allow assignment after a WTFMove().

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200073 => 200074)


--- trunk/Source/WebCore/ChangeLog	2016-04-26 04:29:42 UTC (rev 200073)
+++ trunk/Source/WebCore/ChangeLog	2016-04-26 05:07:44 UTC (rev 200074)
@@ -1,3 +1,17 @@
+2016-04-25  Jiewen Tan  <[email protected]>
+
+        [iOS] ftp links crash @ WebCore::FTPDirectoryDocumentParser::appendEntry
+        https://bugs.webkit.org/show_bug.cgi?id=157019
+        <rdar://problem/24292650>
+
+        Reviewed by Chris Dumez.
+
+        Create separate Ref<Element> object for every row element instead of reusing
+        one because Ref<>'s operator=() does not allow assignment after a WTFMove().
+
+        * html/FTPDirectoryDocument.cpp:
+        (WebCore::FTPDirectoryDocumentParser::appendEntry):
+
 2016-04-25  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Guarantee FontPlatformData's m_cgFont is never nullptr

Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (200073 => 200074)


--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2016-04-26 04:29:42 UTC (rev 200073)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2016-04-26 05:07:44 UTC (rev 200074)
@@ -104,27 +104,27 @@
     RefPtr<Element> rowElement = m_tableElement->insertRow(-1, IGNORE_EXCEPTION);
     rowElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryEntryRow");
 
-    Ref<Element> element = document()->createElement(tdTag, false);
-    element->appendChild(Text::create(*document(), String(&noBreakSpace, 1)), IGNORE_EXCEPTION);
+    Ref<Element> typeElement = document()->createElement(tdTag, false);
+    typeElement->appendChild(Text::create(*document(), String(&noBreakSpace, 1)), IGNORE_EXCEPTION);
     if (isDirectory)
-        element->setAttribute(HTMLNames::classAttr, "ftpDirectoryIcon ftpDirectoryTypeDirectory");
+        typeElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryIcon ftpDirectoryTypeDirectory");
     else
-        element->setAttribute(HTMLNames::classAttr, "ftpDirectoryIcon ftpDirectoryTypeFile");
-    rowElement->appendChild(WTFMove(element), IGNORE_EXCEPTION);
+        typeElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryIcon ftpDirectoryTypeFile");
+    rowElement->appendChild(WTFMove(typeElement), IGNORE_EXCEPTION);
 
-    element = createTDForFilename(filename);
-    element->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileName");
-    rowElement->appendChild(WTFMove(element), IGNORE_EXCEPTION);
+    Ref<Element> nameElement = createTDForFilename(filename);
+    nameElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileName");
+    rowElement->appendChild(WTFMove(nameElement), IGNORE_EXCEPTION);
 
-    element = document()->createElement(tdTag, false);
-    element->appendChild(Text::create(*document(), date), IGNORE_EXCEPTION);
-    element->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileDate");
-    rowElement->appendChild(WTFMove(element), IGNORE_EXCEPTION);
+    Ref<Element> dateElement = document()->createElement(tdTag, false);
+    dateElement->appendChild(Text::create(*document(), date), IGNORE_EXCEPTION);
+    dateElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileDate");
+    rowElement->appendChild(WTFMove(dateElement), IGNORE_EXCEPTION);
 
-    element = document()->createElement(tdTag, false);
-    element->appendChild(Text::create(*document(), size), IGNORE_EXCEPTION);
-    element->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileSize");
-    rowElement->appendChild(WTFMove(element), IGNORE_EXCEPTION);
+    Ref<Element> sizeElement = document()->createElement(tdTag, false);
+    sizeElement->appendChild(Text::create(*document(), size), IGNORE_EXCEPTION);
+    sizeElement->setAttribute(HTMLNames::classAttr, "ftpDirectoryFileSize");
+    rowElement->appendChild(WTFMove(sizeElement), IGNORE_EXCEPTION);
 }
 
 Ref<Element> FTPDirectoryDocumentParser::createTDForFilename(const String& filename)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to