WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
61123
DOMActivateEvent should be one of event sources of user gesture
https://bugs.webkit.org/show_bug.cgi?id=61123
Summary
DOMActivateEvent should be one of event sources of user gesture
Johnny(Jianning) Ding
Reported
2011-05-19 06:35:20 PDT
In current ScriptController::processingUserGesture implementation, it returns false if current event type is DOMActivateEvent (even UserGestureIndicator::getUserGestureState is DefinitelyProcessingUserGesture). It's because Event::fromUserGesture does not accept DOMActivateEvent as event sources of user gesture. It is wrong because 1. DOMActivateEvent is generate by clickEvent, see Node.cpp:2925 2. Some elements' click handler can only be called via DOMActivateEvent. like <input type=file>, it's because the input-file control's UI actually is a shadow input-button, which's click handler is not to open file dialog, the file dialog will be opened by calling FileInputType::handleDOMActivateEvent (see HTMLInputElement.cpp:1091-1092), which calls RenderFileUploadControl::click. If ScriptController::processingUserGesture returns false when event is DOMActivateEvent in RenderFileUploadControl::click, no file dialog will be opened. This situation now is only happened in LayoutTest mode because in normal mode, there is no JavaScript stack, so ScriptController::processingUserGesture always returns true.(See ScriptController.cpp 252). The following test case is to prove my analysis. Running it with patch in
bug 55110
, no file dialog will be opened when running openFileDialog(true), If you want to pass it, the temporary way is to add "onclick=this.click()" in <input type="file" name="file" id="f"> see the following testcase <head> <script> if (window.layoutTestController) { layoutTestController.dumpAsText(); layoutTestController.setCanOpenWindows(); layoutTestController.waitUntilDone(); } function openFileDialog(withUserGesture) { window.console.log("Open the file dialog " + (withUserGesture ? "with" : "without") + " a user gesture."); if (withUserGesture) { eventSender.mouseMoveTo(10, 10); eventSender.mouseDown(); eventSender.mouseUp(); } else { document.getElementById('f').click(); } } function startTest() { if (!window.layoutTestController) return; openFileDialog(false); openFileDialog(true); layoutTestController.notifyDone(); } </script> </head> <body style="margin:0px; padding:0px" onload="startTest();"> <form> <input type="file" name="file" id="f"> </form>
Attachments
Add attachment
proposed patch, testcase, etc.
Johnny(Jianning) Ding
Comment 1
2011-05-19 07:15:41 PDT
(In reply to
comment #0
)
> 2. Some elements' click handler can only be called via DOMActivateEvent.
My previous analysis was wrong. Close this bug. Sorry
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug