Fix file upload on Qt 4.8.

Code was added to WebKit to detect whether the click event on the file
input element is triggered by user action or by a script. If it's by a
script, the event is ignored. This prevented us from simulating a click
on the element.

This fix just patches WebKit to remove the detection.

The relevant WebKit commit is:

  931870c11b

The associated WebKit bug is:

  https://bugs.webkit.org/show_bug.cgi?id=47593

Our bug is:

  http://code.google.com/p/phantomjs/issues/detail?id=307&q=upload
1.5
Jon Leighton 2011-12-30 09:54:02 +00:00
parent 91b272760b
commit 00a8e72fb3
3 changed files with 16 additions and 0 deletions

View File

@ -71,6 +71,7 @@ if [ $QT_VERSION = 4.8 ] ; then
patch -p1 < ../qt48_enable_debugger.patch
patch -p1 < ../qt48_fix_inspector.patch
patch -p1 < ../qt48_headless_and_pdf_fixes.patch
patch -p1 < ../qt48_enable_file_input_click.patch
# Build in lighthose mode for an x-less build
if [ "$2" = "--headless" ] ; then
echo "Building 4.8 in qpa headless mode"

View File

@ -36,6 +36,7 @@ mv qt-everywhere-opensource-src-$QT_VERSION Qt-$QT_VERSION
cd $QT_FOLDER
patch configure ../allow-static-qtwebkit.patch
patch -p1 < ../qapplication_skip_qtmenu.patch
patch -p1 < ../qt48_enable_file_input_click.patch
rm -rf src/3rdparty/webkit/Source/WebKit/qt/tests

View File

@ -0,0 +1,14 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
index 87f6ff1..7d8f2d1 100644
--- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
@@ -130,9 +130,6 @@ void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vec
void RenderFileUploadControl::click()
{
- // Requires a user gesture to open the file dialog.
- if (!frame() || !frame()->loader()->isProcessingUserGesture())
- return;
if (Chrome* chromePointer = chrome())
chromePointer->runOpenPanel(frame(), m_fileChooser);
}