<?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>161615</bug_id>
          
          <creation_ts>2016-09-05 20:10:15 -0700</creation_ts>
          <short_desc>[GTK] User script message handlers broken in related web views</short_desc>
          <delta_ts>2016-09-05 22:36:04 -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>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          <see_also>https://bugzilla.gnome.org/show_bug.cgi?id=769627</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>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1226552</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 20:10:15 -0700</bug_when>
    <thetext>webkit_web_view_new_with_related_view() creates a new WebKitWebView with the same WebKitUserContentManager as the related view. It works in the UI process, but in the web process the new WebKit::WebPage object gets created with a different WebKit::WebUserContentController object. Hence, script message handlers never get executed in related views.

Sad!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226577</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 21:50:34 -0700</bug_when>
    <thetext>OK, so our API works fine: the problem only occurs when the related view is created via JavaScript on a web site. In that case, priv-&gt;userContentManager is unset when webkitWebViewConstructed() calls webkitWebContextCreatePageForWebView(), because there&apos;s no code to set it anywhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226578</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 22:00:33 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; OK, so our API works fine: the problem only occurs when the related view is
&gt; created via JavaScript on a web site.

This is incorrect, please disregard.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226579</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 22:19:28 -0700</bug_when>
    <thetext>(In reply to comment #0)
&gt; webkit_web_view_new_with_related_view() creates a new WebKitWebView with the
&gt; same WebKitUserContentManager as the related view. It works in the UI
&gt; process

This is wrong too. The failure is in the UI process. webkit_web_view_new_with_related_view() results in a WebKitWebView with a null WebKitUserContentManager. It gets set properly in webkitWebViewSetProperty, but somehow gets nulled out before webkitWebViewConstructed is called.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226581</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 22:28:40 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; It gets set properly in webkitWebViewSetProperty, but somehow gets nulled out before webkitWebViewConstructed is called.

Even this is wrong. It doesn&apos;t get set properly; I accidentally printed a smart pointer location when debugging, instead of the actual null pointer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226582</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 22:29:54 -0700</bug_when>
    <thetext>It&apos;s an Epiphany bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1226585</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-09-05 22:36:04 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; It&apos;s an Epiphany bug.

Sorry for being terrible at Bugzilla and making six comments in a row.

Anyway, the problem is we have this ephy_web_view_new_with_related_view function, which I misread as webkit_web_view_new_with_related_view. The WebKit API function is just fine. The Epiphany function uses g_object_new directly, assuming that setting the related-view property guarantees that the user content manager and settings will be set appropriately. That&apos;s not right, since they&apos;re only set by the webkit_web_view_new_with_related_view convenience func.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>