Bug 153741 - REGRESSION(r195899): ASSERTION FAILED: is<Target>(source) in EventPath::retargetTouch() since r195899
Summary: REGRESSION(r195899): ASSERTION FAILED: is<Target>(source) in EventPath::retar...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk, LayoutTestFailure, Regression
Depends on:
Blocks:
 
Reported: 2016-02-01 05:57 PST by Carlos Garcia Campos
Modified: 2016-02-02 08:16 PST (History)
7 users (show)

See Also:


Attachments
Fix an EventContext downcast. (1.33 KB, patch)
2016-02-01 06:30 PST, Adrien Plazas
darin: review+
mcatanzaro: commit-queue-
Details | Formatted Diff | Diff
Remove wrong and useless downcast to MouseOrFocusEventContext (1.31 KB, patch)
2016-02-01 23:38 PST, Adrien Plazas
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2016-02-01 05:57:29 PST
Several touch tests are crashing do to an assert in the GTK+ debug bot since r195899. It seems to be caused by an incorrect cast.

STDERR: ASSERTION FAILED: is<Target>(source)
STDERR: ../../Source/WTF/wtf/TypeCasts.h(80) : typename WTF::match_constness<Source, Target>::type& WTF::downcast(Source&) [with Target = WebCore::MouseOrFocusEventContext; Source = WebCore::EventContext; typename WTF::match_constness<Source, Target>::type = WebCore::MouseOrFocusEventContext]
STDERR: 1   0x7ff5fc7fb68c /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrashWithSecurityImplication+0x1e) [0x7ff5fc7fb68c]
STDERR: 2   0x7ff603423954 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WTF::match_constness<WebCore::EventContext, WebCore::MouseOrFocusEventContext>::type& WTF::downcast<WebCore::MouseOrFocusEventContext, WebCore::EventContext>(WebCore::EventContext&)+0x43) [0x7ff603423954]
STDERR: 3   0x7ff603421934 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::EventPath::retargetTouch(WebCore::TouchEventContext::TouchListType, WebCore::Touch const&)+0x8e) [0x7ff603421934]
STDERR: 4   0x7ff603421b6f /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::EventPath::retargetTouchLists(WebCore::TouchEvent const&)+0x61) [0x7ff603421b6f]
STDERR: 5   0x7ff603420a67 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WebCore::Event&)+0x167) [0x7ff603420a67]
STDERR: 6   0x7ff60346447f /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::Node::dispatchTouchEvent(WebCore::TouchEvent&)+0x23) [0x7ff60346447f]
STDERR: 7   0x7ff6039e31a0 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::EventHandler::handleTouchEvent(WebCore::PlatformTouchEvent const&)+0x10ee) [0x7ff6039e31a0]
STDERR: 8   0x7ff602b2736d /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x504b36d) [0x7ff602b2736d]
STDERR: 9   0x7ff602b273fa /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebPage::touchEvent(WebKit::WebTouchEvent const&)+0x5a) [0x7ff602b273fa]
STDERR: 10  0x7ff602d3f96c /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(void IPC::callMemberFunctionImpl<WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&), std::tuple<WebKit::WebTouchEvent>, 0ul>(WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&), std::tuple<WebKit::WebTouchEvent>&&, std::index_sequence<0ul>)+0x80) [0x7ff602d3f96c]
STDERR: 11  0x7ff602d3dd54 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(void IPC::callMemberFunction<WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&), std::tuple<WebKit::WebTouchEvent>, std::make_index_sequence<1ul> >(std::tuple<WebKit::WebTouchEvent>&&, WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&))+0x41) [0x7ff602d3dd54]
STDERR: 12  0x7ff602d36f05 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(void IPC::handleMessage<Messages::WebPage::TouchEvent, WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&)>(IPC::MessageDecoder&, WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::WebTouchEvent const&))+0xa3) [0x7ff602d36f05]
STDERR: 13  0x7ff602d32069 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebPage::didReceiveWebPageMessage(IPC::Connection&, IPC::MessageDecoder&)+0x6b5) [0x7ff602d32069]
STDERR: 14  0x7ff602b2c896 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebPage::didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&)+0x18a) [0x7ff602b2c896]
STDERR: 15  0x7ff60279c59c /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::MessageDecoder&)+0x120) [0x7ff60279c59c]
STDERR: 16  0x7ff6029be846 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebProcess::didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&)+0x4c) [0x7ff6029be846]
STDERR: 17  0x7ff602789bd0 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::dispatchMessage(IPC::MessageDecoder&)+0x3a) [0x7ff602789bd0]
STDERR: 18  0x7ff602789d33 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::dispatchMessage(std::unique_ptr<IPC::MessageDecoder, std::default_delete<IPC::MessageDecoder> >)+0x161) [0x7ff602789d33]
STDERR: 19  0x7ff602785412 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::SyncMessageState::dispatchMessages(IPC::Connection*)+0x158) [0x7ff602785412]
STDERR: 20  0x7ff60278976c /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::dispatchSyncMessage(IPC::MessageDecoder&)+0x27e) [0x7ff60278976c]
STDERR: 21  0x7ff602789d13 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::dispatchMessage(std::unique_ptr<IPC::MessageDecoder, std::default_delete<IPC::MessageDecoder> >)+0x141) [0x7ff602789d13]
STDERR: 22  0x7ff602785412 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::SyncMessageState::dispatchMessages(IPC::Connection*)+0x158) [0x7ff602785412]
STDERR: 23  0x7ff60278779a /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::waitForSyncReply(unsigned long, std::chrono::duration<long, std::ratio<1l, 1000l> >, unsigned int)+0x86) [0x7ff60278779a]
STDERR: 24  0x7ff602787225 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(IPC::Connection::sendSyncMessage(unsigned long, std::unique_ptr<IPC::MessageEncoder, std::default_delete<IPC::MessageEncoder> >, std::chrono::duration<long, std::ratio<1l, 1000l> >, unsigned int)+0x265) [0x7ff602787225]
STDERR: 25  0x7ff602b446ea /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(bool IPC::Connection::sendSync<Messages::WebPageProxy::HandleSynchronousMessage>(Messages::WebPageProxy::HandleSynchronousMessage&&, Messages::WebPageProxy::HandleSynchronousMessage::Reply&&, unsigned long, std::chrono::duration<long, std::ratio<1l, 1000l> >, unsigned int)+0xf2) [0x7ff602b446ea]
STDERR: 26  0x7ff602b408de /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(bool IPC::MessageSender::sendSync<Messages::WebPageProxy::HandleSynchronousMessage>(Messages::WebPageProxy::HandleSynchronousMessage&&, Messages::WebPageProxy::HandleSynchronousMessage::Reply&&, unsigned long, std::chrono::duration<long, std::ratio<1l, 1000l> >, unsigned int)+0xba) [0x7ff602b408de]
STDERR: 27  0x7ff602b3a014 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(bool IPC::MessageSender::sendSync<Messages::WebPageProxy::HandleSynchronousMessage>(Messages::WebPageProxy::HandleSynchronousMessage&&, Messages::WebPageProxy::HandleSynchronousMessage::Reply&&, std::chrono::duration<long, std::ratio<1l, 1000l> >, unsigned int)+0x76) [0x7ff602b3a014]
STDERR: 28  0x7ff602b2fe53 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::WebPage::postSynchronousMessageForTesting(WTF::String const&, API::Object*, WTF::RefPtr<API::Object>&)+0xb3) [0x7ff602b2fe53]
STDERR: 29  0x7ff602a2c80b /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WKBundlePagePostSynchronousMessageForTesting+0x7d) [0x7ff602a2c80b]
STDERR: 30  0x7ff5a8432790 /home/slave/webkitgtk/gtk-linux-64-debug-tests/build/WebKitBuild/Debug/lib/libTestRunnerInjectedBundle.so(WTR::EventSendingController::touchStart()+0x106) [0x7ff5a8432790]
STDERR: 31  0x7ff5a845fe4c /home/slave/webkitgtk/gtk-linux-64-debug-tests/build/WebKitBuild/Debug/lib/libTestRunnerInjectedBundle.so(WTR::JSEventSendingController::touchStart(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**)+0x58) [0x7ff5a845fe4c]
Comment 1 Adrien Plazas 2016-02-01 06:30:14 PST
Created attachment 270384 [details]
Fix an EventContext downcast.
Comment 2 Michael Catanzaro 2016-02-01 08:01:09 PST
Comment on attachment 270384 [details]
Fix an EventContext downcast.

I didn't look closely at this, but I'm suspicious that there is a downcast there if the result of the downcast can be changed without breaking the build....
Comment 3 Carlos Garcia Campos 2016-02-01 08:34:05 PST
(In reply to comment #2)
> Comment on attachment 270384 [details]
> Fix an EventContext downcast.
> 
> I didn't look closely at this, but I'm suspicious that there is a downcast
> there if the result of the downcast can be changed without breaking the
> build....

MouseOrFocusEventContext also derives from EventContext, so the cast is valid form the compiler point of view. That's why we have the type traits thing to check the cast is valid at runtime. It ended up calling EventContext::isMouseOrFocusEventContext() that return false, because the concrete type in this case is TouchEventContext.
Comment 4 Carlos Garcia Campos 2016-02-01 09:27:55 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Comment on attachment 270384 [details]
> > Fix an EventContext downcast.
> > 
> > I didn't look closely at this, but I'm suspicious that there is a downcast
> > there if the result of the downcast can be changed without breaking the
> > build....
> 
> MouseOrFocusEventContext also derives from EventContext, so the cast is
> valid form the compiler point of view. That's why we have the type traits
> thing to check the cast is valid at runtime. It ended up calling
> EventContext::isMouseOrFocusEventContext() that return false, because the
> concrete type in this case is TouchEventContext.

But it's true that we are using EventContext::node(), and *m_path[0] is already an EventContext, so we don't even need the downcast, I would say.
Comment 5 Michael Catanzaro 2016-02-01 10:27:18 PST
Comment on attachment 270384 [details]
Fix an EventContext downcast.

Let's try getting rid of the downcast!
Comment 6 Adrien Plazas 2016-02-01 23:38:38 PST
Created attachment 270476 [details]
Remove wrong and useless downcast to MouseOrFocusEventContext
Comment 7 WebKit Commit Bot 2016-02-02 08:16:38 PST
Comment on attachment 270476 [details]
Remove wrong and useless downcast to MouseOrFocusEventContext

Clearing flags on attachment: 270476

Committed r196009: <http://trac.webkit.org/changeset/196009>
Comment 8 WebKit Commit Bot 2016-02-02 08:16:45 PST
All reviewed patches have been landed.  Closing bug.