[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
inferno at chromium.org
inferno at chromium.org
Wed Dec 22 14:41:49 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 0ba777087b2aa191cc246a22413f367d8e7e6ac0
Author: inferno at chromium.org <inferno at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 16 16:48:06 2010 +0000
2010-10-16 Johnny Ding <jnd at chromium.org>
Reviewed by Adam Barth.
Requires a user gesture when opening file choose dialog.
https://bugs.webkit.org/show_bug.cgi?id=47593
Test: fast/forms/input-file-not-open-without-gesture.html
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::click):
2010-10-16 Johnny Ding <jnd at chromium.org>
Reviewed by Adam Barth.
Requires a user gesture when opening file choose dialog.
https://bugs.webkit.org/show_bug.cgi?id=47593
* fast/forms/input-file-not-open-without-gesture-expected.txt: Added.
* fast/forms/input-file-not-open-without-gesture.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fab06a7..4d703a7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-16 Johnny Ding <jnd at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Requires a user gesture when opening file choose dialog.
+ https://bugs.webkit.org/show_bug.cgi?id=47593
+
+ * fast/forms/input-file-not-open-without-gesture-expected.txt: Added.
+ * fast/forms/input-file-not-open-without-gesture.html: Added.
+
2010-10-16 Alex Milowski <alex at milowski.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/LayoutTests/fast/forms/input-file-not-open-without-gesture-expected.txt b/LayoutTests/fast/forms/input-file-not-open-without-gesture-expected.txt
new file mode 100644
index 0000000..892e199
--- /dev/null
+++ b/LayoutTests/fast/forms/input-file-not-open-without-gesture-expected.txt
@@ -0,0 +1,4 @@
+
+This file is to test that opening file dialog requires a user gesture. Please refer to https://bugs.webkit.org/show_bug.cgi?id=47593 for more details.
+Test opening file dialog without user gesture is PASSED
+
diff --git a/LayoutTests/fast/forms/input-file-not-open-without-gesture.html b/LayoutTests/fast/forms/input-file-not-open-without-gesture.html
new file mode 100644
index 0000000..27cdec2
--- /dev/null
+++ b/LayoutTests/fast/forms/input-file-not-open-without-gesture.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+const INITIAL= 0;
+const OPEN_FILE_WITHOUT_GESTURE = 1;
+window.testStage = INITIAL;
+window.clickReceived = false;
+window.clickFired = false;
+
+function checkResult(continueFunc) {
+ if (!clickFired)
+ return;
+ if (clickReceived) {
+ // When the file select dialog shows up, it's a model window which receives
+ // all UI events sent to window, so the click event can not be received by body.
+ // If we received the click event, it means the file dialog was not opened.
+ if (testStage == OPEN_FILE_WITHOUT_GESTURE)
+ document.getElementById("open_without_gesture").innerHTML = "PASSED";
+ clickReceived = false;
+ }
+ clickFired = false;
+ continueFunc();
+}
+
+function openFileDialogWithoutUserGesture() {
+ // Tries to call <input type=file>.click to open the file dialog without a user gesture.
+ document.getElementById('f').click();
+ // Fires a click event.
+ setTimeout(function() {
+ eventSender.mouseMoveTo(10, 100);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ clickFired = true;
+ testStage = OPEN_FILE_WITHOUT_GESTURE;
+ // Waits for opening the file dialog and checks whether the click event can still be received by document.
+ setTimeout("checkResult(function() { layoutTestController.notifyDone(); })", 500);
+ }, 1);
+}
+
+function startTest() {
+ if (!window.layoutTestController)
+ return;
+ document.body.addEventListener("click", function() { window.clickReceived = true }, true);
+ setTimeout(openFileDialogWithoutUserGesture, 1);
+}
+</script>
+</head>
+<body style="margin:0px; padding:0px" onload="startTest();">
+<form>
+<input type="file" name="file" id="f">
+</form>
+This file is to test that opening file dialog requires a user gesture. Please refer to https://bugs.webkit.org/show_bug.cgi?id=47593 for more details.<br>
+Test opening file dialog without user gesture is <span id="open_without_gesture">FAILED</span><br>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 69ed767..9d399e8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-16 Johnny Ding <jnd at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Requires a user gesture when opening file choose dialog.
+ https://bugs.webkit.org/show_bug.cgi?id=47593
+
+ Test: fast/forms/input-file-not-open-without-gesture.html
+
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::click):
+
2010-10-16 Alex Milowski <alex at milowski.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp
index b6159e3..ccbcf44 100644
--- a/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/WebCore/rendering/RenderFileUploadControl.cpp
@@ -124,8 +124,11 @@ 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(node()->document()->frame(), m_fileChooser);
+ chromePointer->runOpenPanel(frame(), m_fileChooser);
}
Chrome* RenderFileUploadControl::chrome() const
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list