Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed)

Created:
5 years, 10 months ago by kirkshoop_msft
Modified:
5 years, 3 months ago
Reviewers:
bokan, pdr., Rick Byers
CC:
blink-reviews, hayato, Ignacio Solla
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Don't invoke default actions for MouseEvents generated by script (other than "click") Brings blink in-line with the DOM events spec and behavior of IE and Firefox. BUG=423975 R=rbyers@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196987

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : address bokan's feedback #

Total comments: 5

Patch Set 4 : refactor according to Rick's feedback #

Patch Set 5 : set FromScript when MouseEvent and derived are constructed by script #

Patch Set 6 : changed failing tests to use eventsender #

Total comments: 3

Patch Set 7 : fix for drag events and test updates #

Patch Set 8 : EventHandler.cpp moved from page to input dir #

Total comments: 1

Patch Set 9 : changed description of new test #

Patch Set 10 : TIL, gclient sync may rebase changes back in time #

Unified diffs Side-by-side diffs Delta from patch set Stats (+127 lines, -71 lines) Patch
M LayoutTests/fast/dom/HTMLSelectElement/remove-element-from-within-focus-handler-crash.html View 1 2 3 4 5 6 1 chunk +7 lines, -5 lines 0 comments Download
M LayoutTests/fast/dom/HTMLSelectElement/remove-element-from-within-focus-handler-crash-expected.txt View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
A LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html View 1 2 3 4 5 6 7 8 1 chunk +32 lines, -0 lines 0 comments Download
A + LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -2 lines 0 comments Download
M LayoutTests/fast/forms/listbox-onchange.html View 1 2 3 4 5 6 2 chunks +27 lines, -15 lines 0 comments Download
M LayoutTests/fast/forms/range/slider-transformed.html View 1 2 3 4 5 1 chunk +4 lines, -10 lines 0 comments Download
M LayoutTests/fast/forms/range/slider-zoomed.html View 1 2 3 4 5 1 chunk +3 lines, -10 lines 0 comments Download
M LayoutTests/fast/forms/select-list-box-mouse-focus.html View 1 2 3 4 5 6 2 chunks +12 lines, -6 lines 0 comments Download
M LayoutTests/fast/forms/select-list-box-mouse-focus-expected.txt View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/plugins/user-gesture.html View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/plugins/user-gesture-expected.txt View 1 2 3 4 5 6 1 chunk +1 line, -5 lines 0 comments Download
M Source/core/dom/Node.h View 1 2 3 4 5 6 7 9 3 chunks +3 lines, -0 lines 0 comments Download
M Source/core/dom/Node.cpp View 1 2 3 4 5 6 7 9 2 chunks +9 lines, -2 lines 0 comments Download
M Source/core/events/EventDispatcher.cpp View 1 2 3 4 5 6 7 9 1 chunk +7 lines, -1 line 0 comments Download
M Source/core/events/MouseEvent.h View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -5 lines 0 comments Download
M Source/core/events/MouseEvent.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +7 lines, -6 lines 0 comments Download
M Source/core/input/EventHandler.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download
M Source/platform/PlatformMouseEvent.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 94 (22 generated)
kirkshoop_msft
5 years, 10 months ago (2015-02-02 23:05:36 UTC) #1
bokan
Looks like this also disables the exception carved out for the 'click' event: "Most untrusted ...
5 years, 10 months ago (2015-02-03 01:27:01 UTC) #3
Rick Byers
This approach will change the value of the Event.defaultPrevented bit (visible from JavaScript) for these ...
5 years, 10 months ago (2015-02-03 03:19:36 UTC) #4
kirkshoop_msft
Thank you Rick and bokan for the feedback. We are working on tests and discussing ...
5 years, 10 months ago (2015-02-03 17:23:36 UTC) #5
kirkshoop_msft
On 2015/02/03 17:23:36, kirkshoop_msft wrote: > Thank you Rick and bokan for the feedback. > ...
5 years, 9 months ago (2015-03-04 00:23:04 UTC) #6
bokan
Looks like this still doesn't address the exception (for 'click' events) I mentioned in my ...
5 years, 9 months ago (2015-03-04 23:17:55 UTC) #7
kirkshoop_msft
On 2015/03/04 23:17:55, bokan wrote: > Looks like this still doesn't address the exception (for ...
5 years, 9 months ago (2015-03-04 23:57:47 UTC) #8
Rick Byers
This approach seems reasonable to me modulo a couple small changes. I'm still concerned that ...
5 years, 9 months ago (2015-03-05 16:34:18 UTC) #9
kirkshoop_msft
On 2015/03/05 16:34:18, Rick Byers wrote: > I'm still concerned that we don't have much ...
5 years, 9 months ago (2015-03-09 17:32:28 UTC) #10
Rick Byers
This is looking close, thanks! Note that rietveld (the code review tool) lets you respond ...
5 years, 9 months ago (2015-03-12 16:59:15 UTC) #11
kirkshoop_msft
I have some html files for the cases that this change affects, is there a ...
5 years, 9 months ago (2015-03-12 20:49:05 UTC) #12
kirkshoop_msft
On 2015/03/12 20:49:05, kirkshoop_msft wrote: > I have some html files for the cases that ...
5 years, 9 months ago (2015-03-12 22:34:14 UTC) #13
kirkshoop_msft
Is any more data needed for these changes?
5 years, 9 months ago (2015-03-24 22:22:41 UTC) #14
Rick Byers
On 2015/03/12 22:34:14, kirkshoop_msft wrote: > On 2015/03/12 20:49:05, kirkshoop_msft wrote: > > I have ...
5 years, 9 months ago (2015-03-26 21:27:04 UTC) #15
Rick Byers
On 2015/03/12 22:34:14, kirkshoop_msft wrote: > On 2015/03/12 20:49:05, kirkshoop_msft wrote: > > I have ...
5 years, 9 months ago (2015-03-26 21:36:45 UTC) #16
Rick Byers
LGTM
5 years, 9 months ago (2015-03-26 21:37:26 UTC) #17
Rick Byers
+pdr for OWNERS stamp in Source/platform
5 years, 9 months ago (2015-03-26 21:39:10 UTC) #19
kirkshoop_msft
> Shoot - sorry for the delay. I've been swamped and missed these e-mails (in ...
5 years, 9 months ago (2015-03-26 21:42:59 UTC) #20
pdr.
lgtm
5 years, 9 months ago (2015-03-26 21:43:20 UTC) #21
kirkshoop_msft
On 2015/03/26 21:36:45, Rick Byers wrote: > On 2015/03/12 22:34:14, kirkshoop_msft wrote: > > On ...
5 years, 9 months ago (2015-03-26 21:47:03 UTC) #22
Rick Byers
Just click the "CQ" button to run tests and attempt to land your CL. I'll ...
5 years, 9 months ago (2015-03-27 13:12:26 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/80001
5 years, 9 months ago (2015-03-27 16:41:16 UTC) #25
Rick Byers
On 2015/03/27 16:41:16, I haz the power (commit-bot) wrote: > CQ is trying da patch. ...
5 years, 9 months ago (2015-03-27 17:33:06 UTC) #26
kirkshoop_msft
On 2015/03/27 17:33:06, Rick Byers wrote: > On 2015/03/27 16:41:16, I haz the power (commit-bot) ...
5 years, 9 months ago (2015-03-27 17:35:25 UTC) #27
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/54673)
5 years, 9 months ago (2015-03-27 19:31:55 UTC) #29
Rick Byers
On 2015/03/27 19:31:55, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
5 years, 8 months ago (2015-03-31 18:28:36 UTC) #30
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/100001
5 years, 8 months ago (2015-04-17 15:54:30 UTC) #33
Rick Byers
Kirk, it looks like I need you to follow the external contributors process (sign the ...
5 years, 8 months ago (2015-04-17 16:05:49 UTC) #34
kirkshoop_msft
On 2015/04/17 16:05:49, Rick Byers wrote: > Kirk, it looks like I need you to ...
5 years, 8 months ago (2015-04-17 16:12:50 UTC) #35
Rick Byers
On 2015/04/17 16:12:50, kirkshoop_msft wrote: > On 2015/04/17 16:05:49, Rick Byers wrote: > > Kirk, ...
5 years, 8 months ago (2015-04-17 16:15:25 UTC) #36
Rick Byers
On 2015/04/17 16:15:25, Rick Byers wrote: > On 2015/04/17 16:12:50, kirkshoop_msft wrote: > > On ...
5 years, 8 months ago (2015-04-17 16:16:00 UTC) #37
commit-bot: I haz the power
Dry run: A disapproval has been posted by following reviewers: rbyers@chromium.org. Please make sure to ...
5 years, 8 months ago (2015-04-17 16:19:09 UTC) #39
kirkshoop_msft
On 2015/04/17 16:16:00, Rick Byers wrote: > On 2015/04/17 16:15:25, Rick Byers wrote: > > ...
5 years, 8 months ago (2015-04-17 16:31:23 UTC) #40
Rick Byers
On 2015/04/17 16:31:23, kirkshoop_msft wrote: > On 2015/04/17 16:16:00, Rick Byers wrote: > > On ...
5 years, 8 months ago (2015-04-17 16:42:02 UTC) #41
kirkshoop_msft
On 2015/04/17 16:42:02, Rick Byers wrote: > No unfortunately that's still in the chromium tree. ...
5 years, 8 months ago (2015-04-17 21:29:18 UTC) #42
kirkshoop_msft
On 2015/04/17 21:29:18, kirkshoop_msft wrote: > On 2015/04/17 16:42:02, Rick Byers wrote: > > No ...
5 years, 8 months ago (2015-04-20 18:19:05 UTC) #43
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/100001
5 years, 8 months ago (2015-04-20 18:40:11 UTC) #45
Rick Byers
Test changes look good, thanks. This is also a nice validation that you're changing only ...
5 years, 8 months ago (2015-04-20 18:41:27 UTC) #46
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/52629)
5 years, 8 months ago (2015-04-20 23:37:17 UTC) #48
Rick Byers
On 2015/04/20 23:37:17, I haz the power (commit-bot) wrote: > Dry run: Try jobs failed ...
5 years, 7 months ago (2015-05-21 17:28:30 UTC) #49
kirkshoop_msft
On 2015/05/21 17:28:30, Rick Byers wrote: > On 2015/04/20 23:37:17, I haz the power (commit-bot) ...
5 years, 6 months ago (2015-05-28 20:28:40 UTC) #50
kirkshoop_msft
kirkshoop_msft wrote: > On 2015/05/21 17:28:30, Rick Byers wrote: > > These are using eventSender ...
5 years, 6 months ago (2015-05-29 20:32:04 UTC) #51
Rick Byers
On 2015/05/29 20:32:04, kirkshoop_msft wrote: > kirkshoop_msft wrote: > > On 2015/05/21 17:28:30, Rick Byers ...
5 years, 6 months ago (2015-06-05 20:13:48 UTC) #52
kirkshoop_msft
On 2015/06/05 20:13:48, Rick Byers wrote: > I'd suggest the following: > - Add a ...
5 years, 6 months ago (2015-06-09 21:22:38 UTC) #53
Rick Byers
On 2015/06/09 21:22:38, kirkshoop_msft wrote: > On 2015/06/05 20:13:48, Rick Byers wrote: > > I'd ...
5 years, 6 months ago (2015-06-10 21:52:16 UTC) #54
Rick Byers
Was just reviewing again and then realized you haven't actually uploaded your latest patch (to ...
5 years, 6 months ago (2015-06-10 21:56:57 UTC) #55
kirkshoop_msft
On 2015/06/10 21:56:57, Rick Byers wrote: > Was just reviewing again and then realized you ...
5 years, 6 months ago (2015-06-10 23:07:34 UTC) #56
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/120001
5 years, 6 months ago (2015-06-10 23:13:32 UTC) #59
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_blink_compile_dbg on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/mac_blink_compile_dbg/builds/47136) mac_blink_rel on ...
5 years, 6 months ago (2015-06-10 23:16:58 UTC) #61
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/140001
5 years, 6 months ago (2015-06-10 23:56:53 UTC) #64
Rick Byers
LGTM https://codereview.chromium.org/894913002/diff/140001/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html File LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html (right): https://codereview.chromium.org/894913002/diff/140001/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html#newcode7 LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html:7: description("Tests to ensure that default action does not ...
5 years, 6 months ago (2015-06-11 00:06:48 UTC) #65
kirkshoop_msft
ah shucks.. I updated the failure message instead of the test description. I decided to ...
5 years, 6 months ago (2015-06-11 00:31:44 UTC) #66
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/66066)
5 years, 6 months ago (2015-06-11 01:02:24 UTC) #68
Rick Byers
On 2015/06/11 00:31:44, kirkshoop_msft wrote: > ah shucks.. I updated the failure message instead of ...
5 years, 6 months ago (2015-06-11 01:16:55 UTC) #69
Rick Byers
On 2015/06/11 01:02:24, commit-bot: I haz the power wrote: > Dry run: Try jobs failed ...
5 years, 6 months ago (2015-06-11 01:21:28 UTC) #70
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/160001
5 years, 6 months ago (2015-06-11 16:51:33 UTC) #73
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_blink_compile_dbg on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/mac_blink_compile_dbg/builds/47236) mac_blink_rel on ...
5 years, 6 months ago (2015-06-11 16:55:57 UTC) #75
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/180001
5 years, 6 months ago (2015-06-11 17:08:38 UTC) #78
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 6 months ago (2015-06-11 18:34:31 UTC) #80
kirkshoop_msft
On 2015/06/11 18:34:31, commit-bot: I haz the power wrote: > Dry run: This issue passed ...
5 years, 6 months ago (2015-06-11 21:22:07 UTC) #81
dcheng
On 2015/06/11 at 21:22:07, kirk.shoop wrote: > On 2015/06/11 18:34:31, commit-bot: I haz the power ...
5 years, 6 months ago (2015-06-11 23:29:07 UTC) #82
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/894913002/180001
5 years, 6 months ago (2015-06-12 00:58:12 UTC) #84
commit-bot: I haz the power
Committed patchset #10 (id:180001) as https://src.chromium.org/viewvc/blink?view=rev&revision=196987
5 years, 6 months ago (2015-06-12 01:02:19 UTC) #85
kochi
On 2015/06/12 01:02:19, commit-bot: I haz the power wrote: > Committed patchset #10 (id:180001) as ...
5 years, 6 months ago (2015-06-12 08:41:08 UTC) #86
Rick Byers
I'm away from my desk for a few hours but sounds like we should revert ...
5 years, 6 months ago (2015-06-12 17:02:56 UTC) #87
Rick Byers
Actually, the right fix will almost certainly be to the test. Maybe just disable the ...
5 years, 6 months ago (2015-06-12 17:04:46 UTC) #88
kirkshoop_msft
On 2015/06/12 17:02:56, Rick Byers wrote: > I'm away from my desk for a few ...
5 years, 6 months ago (2015-06-12 17:06:24 UTC) #89
kirkshoop_msft
On 2015/06/12 17:06:24, kirkshoop_msft wrote: > this test is using initMouseEvent for mousedown. I have ...
5 years, 6 months ago (2015-06-12 19:13:07 UTC) #90
kirkshoop_msft
@rbyers - once the other issue is finished, how do I re-commit this one?
5 years, 6 months ago (2015-06-12 20:24:12 UTC) #91
Rick Byers
On 2015/06/12 17:02:56, Rick Byers wrote: > I'm away from my desk for a few ...
5 years, 6 months ago (2015-06-12 20:53:02 UTC) #92
Rick Byers
On 2015/06/12 20:24:12, kirkshoop_msft wrote: > @rbyers - once the other issue is finished, how ...
5 years, 6 months ago (2015-06-12 21:02:38 UTC) #93
dtapuska
5 years, 5 months ago (2015-07-10 20:10:48 UTC) #94
On 2015/06/12 21:02:38, Rick Byers wrote:
> On 2015/06/12 20:24:12, kirkshoop_msft wrote:
> > @rbyers - once the other issue is finished, how do I re-commit this one?
> 
> The easiest way is probably to revert the revert (by using the 'revert
patchset'
> button at https://codereview.chromium.org/1184693003).  I'm guessing the
system
> won't let a non-committer click this - so I can do it for you once the
chromium
> side lands.  But first we can ask it to run the blink CL against the chromium
> trybots to make sure there aren't any other issues (I didn't see any other
> failures in the roll attempt, but we should make double sure that test is
indeed
> now passing).

The dispatch-synthetic-mouseevent-no-action.html is incorrect.

The focus event isn't generated via the defaultEventHandler code path. It is
generated via the EventHandler code path
which if dispatchEvent returns false then it adjust the focus. Calling
node.dispatchEvent doesn't follow that code path.
So although the test case looks correct I think it will pass even without this
change.

I am working on isTrusted event support and was going to pick up that test
because that support will pretty much negate
this change but just wanted to bring it up on this review.

Powered by Google App Engine
This is Rietveld 408576698