[Webkit-unassigned] [Bug 61123] New: DOMActivateEvent should be one of event sources of user gesture

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 19 06:35:20 PDT 2011


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

           Summary: DOMActivateEvent should be one of event sources of
                    user gesture
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jnd at chromium.org
                CC: abarth at webkit.org, aestes at apple.com


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>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list