2011-02-10 Alexey Proskuryakov <ap@apple.com>
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2011 12:42:43 +0000 (12:42 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2011 12:42:43 +0000 (12:42 +0000)
        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=50306
        <rdar://problem/8976152> REGRESSION: WebChromeClient::shouldReplaceWithGeneratedFileForUpload()
        uses an initialized result value (breaks form submission with clang-built WebKit)

        No new test, because I can't reproduce the observable effect with my gcc build.

        * platform/network/FormData.cpp: (WebCore::FormData::appendKeyValuePairItems): Restore an
        empty path check - an empty path was causing an exception in Foundation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78202 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/FormData.cpp

index fe31940..828cd7a 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-10  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50306
+        <rdar://problem/8976152> REGRESSION: WebChromeClient::shouldReplaceWithGeneratedFileForUpload()
+        uses an initialized result value (breaks form submission with clang-built WebKit)
+
+        No new test, because I can't reproduce the observable effect with my gcc build.
+
+        * platform/network/FormData.cpp: (WebCore::FormData::appendKeyValuePairItems): Restore an
+        empty path check - an empty path was causing an exception in Foundation.
+
 2011-02-09  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index bdc4b03..9784b7f 100644 (file)
@@ -209,14 +209,16 @@ void FormData::appendKeyValuePairItems(const FormDataList& list, const TextEncod
                     name = file->webkitRelativePath().isEmpty() ? file->name() : file->webkitRelativePath();
 #else
                     name = file->name();
-#endif                    
-
+#endif
                     // Let the application specify a filename if it's going to generate a replacement file for the upload.
-                    if (Page* page = document->page()) {
-                        String generatedFileName;
-                        shouldGenerateFile = page->chrome()->client()->shouldReplaceWithGeneratedFileForUpload(file->path(), generatedFileName);
-                        if (shouldGenerateFile)
-                            name = generatedFileName;
+                    const String& path = file->path();
+                    if (!path.isEmpty()) {
+                        if (Page* page = document->page()) {
+                            String generatedFileName;
+                            shouldGenerateFile = page->chrome()->client()->shouldReplaceWithGeneratedFileForUpload(path, generatedFileName);
+                            if (shouldGenerateFile)
+                                name = generatedFileName;
+                        }
                     }
                 } else {
                     // For non-file blob, use the identifier part of the URL as the name.