From 00a8e72fb306d0cedca399425a11b862f2fb27ea Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 30 Dec 2011 09:54:02 +0000 Subject: [PATCH] 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: https://github.com/WebKit/webkit/commit/931870c11b2a4d0b714eea241db5654d9d8cf6a7 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 --- deploy/build-linux.sh | 1 + deploy/build-mac.sh | 1 + deploy/qt48_enable_file_input_click.patch | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 deploy/qt48_enable_file_input_click.patch diff --git a/deploy/build-linux.sh b/deploy/build-linux.sh index 8fa67156..e89286c8 100755 --- a/deploy/build-linux.sh +++ b/deploy/build-linux.sh @@ -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" diff --git a/deploy/build-mac.sh b/deploy/build-mac.sh index a6fcffb2..c8ee8b66 100755 --- a/deploy/build-mac.sh +++ b/deploy/build-mac.sh @@ -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 diff --git a/deploy/qt48_enable_file_input_click.patch b/deploy/qt48_enable_file_input_click.patch new file mode 100644 index 00000000..10358b3d --- /dev/null +++ b/deploy/qt48_enable_file_input_click.patch @@ -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); + }