RESOLVED FIXED 93060
Avoid dispatching gesture events of unknown types
https://bugs.webkit.org/show_bug.cgi?id=93060
Summary Avoid dispatching gesture events of unknown types
Sadrul Habib Chowdhury
Reported 2012-08-02 18:56:35 PDT
Avoid dispatching gesture events of unknown types
Attachments
Patch (2.47 KB, patch)
2012-08-02 18:58 PDT, Sadrul Habib Chowdhury
no flags
Patch (2.53 KB, patch)
2012-08-02 19:24 PDT, Sadrul Habib Chowdhury
no flags
Patch (2.51 KB, patch)
2012-08-02 19:28 PDT, Sadrul Habib Chowdhury
no flags
Sadrul Habib Chowdhury
Comment 1 2012-08-02 18:58:14 PDT
Adam Barth
Comment 2 2012-08-02 19:01:38 PDT
Comment on attachment 156235 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156235&action=review > Source/WebCore/dom/GestureEvent.cpp:63 > ASSERT_NOT_REACHED(); > + return 0; Does that means this ASSERT isn't valid?
Sadrul Habib Chowdhury
Comment 3 2012-08-02 19:10:01 PDT
Comment on attachment 156235 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156235&action=review >> Source/WebCore/dom/GestureEvent.cpp:63 >> + return 0; > > Does that means this ASSERT isn't valid? WebCore does not currently have event-types corresponding to pinch, long-press etc that are there in Platform gesture-events. Ideally, if one of these events is dispatched into WebCore, then we would want to process them appropriately. So the ASSERT here would be useful for development purposes. However, the ASSERT becomes a no-op on release builds. So it is necessary to guard against that too. Would you rather remove the ASSERT and just return 0?
Adam Barth
Comment 4 2012-08-02 19:15:07 PDT
Either the case can occur or it can't. If the case can occur, then ASSERT_NOT_REACHED is inappropriate because that line of code can be reached. If the case cannot occur, then the return is not needed. If you want protection in a release build, we can use CRASH() rather than ASSERT_NOT_REACHED.
Sadrul Habib Chowdhury
Comment 5 2012-08-02 19:24:26 PDT
Adam Barth
Comment 6 2012-08-02 19:26:54 PDT
Comment on attachment 156241 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156241&action=review > Source/WebCore/dom/GestureEvent.cpp:63 > + return 0; There's no point in returning zero after a crash :)
Sadrul Habib Chowdhury
Comment 7 2012-08-02 19:28:12 PDT
Sadrul Habib Chowdhury
Comment 8 2012-08-02 19:29:59 PDT
(In reply to comment #6) > (From update of attachment 156241 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=156241&action=review > > > Source/WebCore/dom/GestureEvent.cpp:63 > > + return 0; > > There's no point in returning zero after a crash :) Indeed. :) Sorry, I misunderstood. We do not want to trigger a crash in release build. I was more trying to trigger a crash in a debug build with the ASSERT (so that we know some gesture events are reaching WebCore and we need to add support for those), but handle gracefully in a release build. I have changed to remove the ASSERT instead, and always return 0.
Adam Barth
Comment 9 2012-08-03 11:20:18 PDT
Comment on attachment 156242 [details] Patch Ok.
WebKit Review Bot
Comment 10 2012-08-03 11:39:47 PDT
Comment on attachment 156242 [details] Patch Clearing flags on attachment: 156242 Committed r124633: <http://trac.webkit.org/changeset/124633>
WebKit Review Bot
Comment 11 2012-08-03 11:39:51 PDT
All reviewed patches have been landed. Closing bug.
Allan Sandfeld Jensen
Comment 12 2012-08-04 05:30:20 PDT
(In reply to comment #3) > (From update of attachment 156235 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=156235&action=review > > >> Source/WebCore/dom/GestureEvent.cpp:63 > >> + return 0; > > > > Does that means this ASSERT isn't valid? > > WebCore does not currently have event-types corresponding to pinch, long-press etc that are there in Platform gesture-events. Ideally, if one of these events is dispatched into WebCore, then we would want to process them appropriately. So the ASSERT here would be useful for development purposes. However, the ASSERT becomes a no-op on release builds. So it is necessary to guard against that too. > > Would you rather remove the ASSERT and just return 0? I think assert and returning 0 would be correct. Types that have not been specified should not be send into webcore and should be caught in debug mode, but the return was missing for release build to also act correctly.
Adam Barth
Comment 13 2012-08-04 12:14:37 PDT
> I think assert and returning 0 would be correct. Types that have not been specified should not be send into webcore and should be caught in debug mode, but the return was missing for release build to also act correctly. Can the case occur or can the case not occur?
Note You need to log in before you can comment on or make changes to this bug.