Bug 58406 - Bringing up the context menu on a link might also follow the link
Summary: Bringing up the context menu on a link might also follow the link
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-04-12 17:59 PDT by Brady Eidson
Modified: 2012-01-30 05:15 PST (History)
1 user (show)

See Also:


Attachments
Patch v1 (7.40 KB, patch)
2011-04-12 18:38 PDT, Brady Eidson
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2011-04-12 17:59:55 PDT
Bringing up the context menu on a link might also follow the link.

This is because we bring up the context menu with "mouse press", but in some cases a "mouse release" might already be in the CoreIPC pipeline, and blindly handling that message would cause the link to be followed in the view behind the context menu.

We need to track when a context menu is showing and ignore any other pending mouse events in that state.

In radar as <rdar://problem/9029193>
Comment 1 Brady Eidson 2011-04-12 18:38:40 PDT
Created attachment 89325 [details]
Patch v1
Comment 2 Maciej Stachowiak 2011-04-12 19:10:40 PDT
Comment on attachment 89325 [details]
Patch v1

r=me

Is there a way to test this? EventSender.mouseDown exists...
Comment 3 Brady Eidson 2011-04-12 19:23:39 PDT
The problem with layout testing it is the asynchronous nature of the race between events and the context menu.

You need to queue up an extra mouse event in the WebProcess (the mouse up) before the UIProcess actually shows the context menu.  I can't think of a way we could do this reliably - at least certainly not with the existing eventSender API in LayoutTestController.

I'm open to suggestions, but think it's prudent to land as-is in the meantime.
Comment 4 Brady Eidson 2011-04-12 19:24:40 PDT
http://trac.webkit.org/changeset/83687
Comment 5 Hugo Parente Lima 2012-01-27 12:50:36 PST
This patch causes any layout test using mouse right click to fail on wk2, e.g.:

fast/events/mouse-click-events.html

Isn't the port responsible for send or not mouse events to webkit2 when the context menu is showing?

Sorry if I misunderstood something, I'm new to webkit and started to hack on qt-wk2 click events layout tests.

if this bug happen only when using async events, i.e. not using webkittestrunner, what about removing the "if (m_isShowingCon...)" only on WebPage::mouseEventSyncForTesting ?
Comment 6 Hugo Parente Lima 2012-01-30 05:15:17 PST
hmmm, I think I got the problem, forget my last comment.