<?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>247089</bug_id>
          
          <creation_ts>2022-10-26 14:39:46 -0700</creation_ts>
          <short_desc>[GTK] UI process crash when opening video settings</short_desc>
          <delta_ts>2022-11-25 06:30:25 -0800</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>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=247092</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=246716</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=247141</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>
          
          <blocked>210100</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Carlos Garcia Campos">cgarcia</assigned_to>
          <cc>alicem</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>1908542</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-26 14:39:46 -0700</bug_when>
    <thetext>Moving this from https://gitlab.gnome.org/GNOME/epiphany/-/issues/1891. When clicking the settings cog at the bottom-right corner of an HTML video element, the Epiphany UI process crashes because the WebKitWebView::context-menu signal is emitted with a NULL event parameter, which is illegal as that parameter is not documented to be nullable. Our documentation says:

&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 GtkWidget::popup-menu signal was used to show the context menu.&quot;

WebKitWebViewBase is not prepared to handle the case where the context menu is opened by a Messages::WebPageProxy::ShowContextMenu message sent by the web process.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908549</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-26 15:10:04 -0700</bug_when>
    <thetext>This is easy enough to fix for GTK 3, but I fear we might need an API change for GTK 4. I don&apos;t see how to generate a dummy GdkEvent with GTK 4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908681</commentid>
    <comment_count>2</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-10-27 05:22:18 -0700</bug_when>
    <thetext>I think we are still in time to try different approach in the new API. I would just stop using GdkEvent in context and popup menu signals. We can add a custom boxed type that can be shared with wpe and provide the info we want there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908690</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-27 06:12:37 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #2)
&gt; I think we are still in time to try different approach in the new API.

Yes.

&gt; I would just stop using GdkEvent in context and popup menu signals. We can add
&gt; a custom boxed type that can be shared with wpe and provide the info we want
&gt; there.

Hmm, that could work, and would resolve a separate problem with the WPE API as well... although we&apos;d need to agree on what info this type would need to convey. Epiphany only looks at gdk_event_get_type() to check for GDK_BUTTON_PRESS, then in that case, it uses gdk_event_get_modifier_state() and passes the GdkModifierType along to WebExtensions to decide what to do with it. That code is probably new, which would explain why we didn&apos;t notice before now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908692</commentid>
    <comment_count>4</comment_count>
    <who name="Alice Mikhaylenko">alicem</who>
    <bug_when>2022-10-27 06:14:24 -0700</bug_when>
    <thetext>Right, it needs modifiers for WebExtensions and it&apos;s from this cycle. Previously it didn&apos;t look at the event at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908758</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-27 10:17:13 -0700</bug_when>
    <thetext>Well adding a new type is more complicated than I was expected. I think I&apos;ll do a quick fix for GTK 3 in a separate bug, to ensure a dummy GdkEvent always gets created, and leave this bug for deciding how to fix GTK 4 where dummy GdkEvents are no longer possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908781</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-27 11:11:05 -0700</bug_when>
    <thetext>Also we need to consider what to do with the show-option-menu signal as well. That&apos;s the other place where we pass a GdkEvent via a signal handler. See bug #246716.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1908785</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-10-27 11:14:01 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #5)
&gt; Well adding a new type is more complicated than I was expected. I think I&apos;ll
&gt; do a quick fix for GTK 3 in a separate bug, to ensure a dummy GdkEvent
&gt; always gets created,

Bug #247141

&gt; and leave this bug for deciding how to fix GTK 4 where
&gt; dummy GdkEvents are no longer possible.

Any proposals for how this API should look? For GTK, it might be reasonable to just make the GdkEvent nullable, although that won&apos;t do anything to help WPE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1914651</commentid>
    <comment_count>8</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-11-25 01:59:11 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/6809</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1914686</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-11-25 06:30:22 -0800</bug_when>
    <thetext>Committed 257023@main (f4b30ff111b4): &lt;https://commits.webkit.org/257023@main&gt;

Reviewed commits have been landed. Closing PR #6809 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>