Title: [121761] trunk/Source/WebKit2
Revision
121761
Author
[email protected]
Date
2012-07-03 06:32:29 -0700 (Tue, 03 Jul 2012)

Log Message

[Qt] When calling accept() on the FilePickerContextObject with an empty list, early return and call reject().
https://bugs.webkit.org/show_bug.cgi?id=89755

Reviewed by Simon Hausmann.

When calling accept with an empty list of files we can just bailout
and call reject(). Any other processing is pointless.

       * UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml:
       * UIProcess/qt/QtDialogRunner.cpp:
(WebKit::FilePickerContextObject::accept):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (121760 => 121761)


--- trunk/Source/WebKit2/ChangeLog	2012-07-03 13:00:46 UTC (rev 121760)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-03 13:32:29 UTC (rev 121761)
@@ -1,3 +1,17 @@
+2012-07-03  Alexis Menard  <[email protected]>
+
+        [Qt] When calling accept() on the FilePickerContextObject with an empty list, early return and call reject().
+        https://bugs.webkit.org/show_bug.cgi?id=89755
+
+        Reviewed by Simon Hausmann.
+
+        When calling accept with an empty list of files we can just bailout
+        and call reject(). Any other processing is pointless.
+
+       * UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml:
+       * UIProcess/qt/QtDialogRunner.cpp:
+        (WebKit::FilePickerContextObject::accept):
+
 2012-07-03  Balazs Kelemen  <[email protected]>
 
         [Qt][WK2] fast/viewport/viewport-91.html still fails after r121555 and r121661

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml (121760 => 121761)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml	2012-07-03 13:00:46 UTC (rev 121760)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml	2012-07-03 13:32:29 UTC (rev 121761)
@@ -11,18 +11,20 @@
     height: 400
 
     property bool selectFile
+    property bool returnEmpty: false
     property bool acceptMultiple: false
 
     experimental.filePicker: Item {
         Component.onCompleted: {
-            var selectedFiles = ["filename1", "filename2"]
-            if (selectFile) {
+            if (returnEmpty)
+                model.accept("");
+            else if (selectFile) {
+                var selectedFiles = ["filename1", "filename2"];
                 if (acceptMultiple)
-                    model.accept(selectedFiles)
+                    model.accept(selectedFiles);
                 else
                     model.accept("acceptedfilename");
-            }
-            else
+            } else
                 model.reject();
         }
     }
@@ -57,12 +59,21 @@
 
         function test_multiple() {
             webView.selectFile = true;
+            webView.returnEmpty = false;
             webView.acceptMultiple = true;
             openItemSelector()
             titleSpy.wait()
             compare(webView.title, "filename1")
         }
 
+        function test_rejectIfEmptyAccept() {
+            var oldTitle = webView.title
+            webView.selectFile = false;
+            webView.returnEmpty = true;
+            openItemSelector()
+            compare(webView.title, oldTitle)
+        }
+
         function test_reject() {
             var oldTitle = webView.title
             webView.selectFile = false;

Modified: trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp (121760 => 121761)


--- trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-07-03 13:00:46 UTC (rev 121760)
+++ trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-07-03 13:32:29 UTC (rev 121761)
@@ -223,6 +223,12 @@
     void accept(const QVariant& path)
     {
         QStringList filesPath = path.toStringList();
+
+        if (filesPath.isEmpty()) {
+            emit rejected();
+            return;
+        }
+
         // For single file upload, send only the first element if there are more than one file paths
         if (!m_allowMultiple && filesPath.count() > 1)
             filesPath = QStringList(filesPath.at(0));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to