<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>195886</bug_id>
          
          <creation_ts>2019-03-18 08:01:24 -0700</creation_ts>
          <short_desc>webkitWebViewPopulateContextMenu emits context-menu signal with NULL event (illegal)</short_desc>
          <delta_ts>2019-10-22 01:38:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=1687185</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aperez</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1517682</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2019-03-18 08:01:24 -0700</bug_when>
    <thetext>Truncated backtrace:
Thread no. 1 (10 frames)
 #0 ephy_embed_event_new at ../embed/ephy-embed-event.c:68
 #1 populate_context_menu at ../src/ephy-window.c:1459
 #2 ffi_call_unix64 at ../src/x86/unix64.S:76
 #3 ffi_call at ../src/x86/ffi64.c:525
 #4 g_cclosure_marshal_generic at gclosure.c:1496
 #9 webkitWebViewPopulateContextMenu at /usr/src/debug/webkit2gtk3-2.22.6-1.fc29.x86_64/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:2319
 #10 ContextMenuClient::getContextMenuFromProposedMenu at /usr/src/debug/webkit2gtk3-2.22.6-1.fc29.x86_64/Source/WebKit/UIProcess/API/glib/WebKitContextMenuClient.cpp:50
 #11 WebKit::WebContextMenuProxyGtk::show at /usr/src/debug/webkit2gtk3-2.22.6-1.fc29.x86_64/x86_64-redhat-linux-gnu/DerivedSources/ForwardingHeaders/wtf/Vector.h:365
 #12 WebKit::WebPageProxy::showContextMenu at /usr/src/debug/webkit2gtk3-2.22.6-1.fc29.x86_64/x86_64-redhat-linux-gnu/DerivedSources/ForwardingHeaders/wtf/DumbPtrTraits.h:41
 #13 IPC::callMemberFunctionImpl&lt;WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WebKit::ContextMenuContextData&amp;&amp;, WebKit::UserData const&amp;), std::tuple&lt;WebKit::ContextMenuContextData, WebKit::UserData&gt;, 0ul, 1ul&gt; at /usr/src/debug/webkit2gtk3-2.22.6-1.fc29.x86_64/Source/WebKit/Platform/IPC/HandleMessage.h:45

(full backtrace in the downstream bug)

This looks like a WebKit bug (or a GTK bug). The documentation of WebKitWebView&apos;s context-menu signal says this of the event parameter:

&quot;&quot;&quot;
The event is expected to be one of the following types:

a GdkEventButton of type GDK_BUTTON_PRESS when the context menu was triggered with mouse.

a GdkEventKey of type GDK_KEY_PRESS if the keyboard was used to show the menu.

a generic GdkEvent of type GDK_NOTHING when the “popup-menu” signal was used to show the context menu.
&quot;&quot;&quot;

Epiphany just assumes it&apos;s non-NULL, but here WebKit is emitting context-menu with a NULL event. It&apos;s not Epiphany&apos;s job to handle that: it&apos;s WebKit&apos;s job to ensure it doesn&apos;t happen. (Actually, Epiphany is wrong to cast it to a GdkEventButton without checking the type of the event. So there is an Epiphany bug here too. But that can&apos;t cause this crash, and it&apos;s not what happened in this backtrace.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521656</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2019-03-27 04:25:29 -0700</bug_when>
    <thetext>We need a way to reproduce this. The web process is sending the ShowContextMenu message without a right click event. We need to understand why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521683</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2019-03-27 08:29:07 -0700</bug_when>
    <thetext>I&apos;ve asked in the downstream bug, but usually reporters don&apos;t know anything about how it crashes.

Jan-Michael asked elsewhere about what happens when the context menu is opened via a touch event (long press or something?). Maybe this is related to touch? The documentation seems to indicate this can&apos;t happen, but perhaps the documentation is outdated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1582110</commentid>
    <comment_count>3</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2019-10-21 16:06:57 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #2)
&gt; I&apos;ve asked in the downstream bug, but usually reporters don&apos;t know anything
&gt; about how it crashes.
&gt; 
&gt; Jan-Michael asked elsewhere about what happens when the context menu is
&gt; opened via a touch event (long press or something?). Maybe this is related
&gt; to touch? The documentation seems to indicate this can&apos;t happen, but perhaps
&gt; the documentation is outdated.

I *suppose* that another way of opening a context menu without using
a mouse event would be with the menu key from the keyboard ¬_¬</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1582297</commentid>
    <comment_count>4</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2019-10-22 01:38:42 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #3)
&gt; (In reply to Michael Catanzaro from comment #2)
&gt; &gt; I&apos;ve asked in the downstream bug, but usually reporters don&apos;t know anything
&gt; &gt; about how it crashes.
&gt; &gt; 
&gt; &gt; Jan-Michael asked elsewhere about what happens when the context menu is
&gt; &gt; opened via a touch event (long press or something?). Maybe this is related
&gt; &gt; to touch? The documentation seems to indicate this can&apos;t happen, but perhaps
&gt; &gt; the documentation is outdated.
&gt; 
&gt; I *suppose* that another way of opening a context menu without using
&gt; a mouse event would be with the menu key from the keyboard ¬_¬

In that case we pass the keyboard event, see the first comment:

&quot;&quot;&quot;
The event is expected to be one of the following types:

a GdkEventButton of type GDK_BUTTON_PRESS when the context menu was triggered with mouse.

a GdkEventKey of type GDK_KEY_PRESS if the keyboard was used to show the menu.

a generic GdkEvent of type GDK_NOTHING when the “popup-menu” signal was used to show the context menu.
&quot;&quot;&quot;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>