+2012-07-03 Alexis Menard <alexis.menard@openbossa.org>
+
+ [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 <kbalazs@webkit.org>
[Qt][WK2] fast/viewport/viewport-91.html still fails after r121555 and r121661
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();
}
}
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;
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));