Bug 75385 - [Qt] Programmatic file upload
Summary: [Qt] Programmatic file upload
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P3 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-30 04:19 PST by Jon Leighton
Modified: 2014-02-03 03:19 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Leighton 2011-12-30 04:19:33 PST
As far as I know, the only way to add a file to a file input element without user action, is to intercept QWebPage::chooseFile [http://developer.qt.nokia.com/doc/qt-4.8/qwebpage.html#chooseFile]. This requires creating a click event on the element via Javascript code, which works fine in Qt 4.7.

Qt 4.8 however, incorporates a change [https://github.com/WebKit/webkit/commit/931870c11b2a4d0b714eea241db5654d9d8cf6a7] that prevents this, by ignoring click events that are not generated by the user. (See https://bugs.webkit.org/show_bug.cgi?id=47593.)

It seems like there ought to be a better way to upload a file, without having to create click events in Javascript code, which would mean that the above would not be a problem.
Comment 1 Matt Horan 2012-12-10 19:50:10 PST
We were able to trigger the events required to open the file dialog in capybara-webkit here: http://git.io/izIfYA.  This worked with Qt 4.8 but no longer works in Qt 5.0.

In Qt 5.0, we must trigger native mouse events, which is quite cumbersome as it requires finding the element position on screen, scrolling it into view, and then triggering the event.

In either case, we must still have a way to trigger the expected mouse events, in the event that a developer using capybara-webkit is testing that those events are being triggered.  However, a programmatic method for uploading files would be handy, seeing as all current approaches seem a bit brittle.
Comment 2 Jocelyn Turcotte 2014-02-03 03:19:33 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.