Bug 161615 - [GTK] User script message handlers broken in related web views
Summary: [GTK] User script message handlers broken in related web views
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-05 20:10 PDT by Michael Catanzaro
Modified: 2016-09-05 22:36 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-09-05 20:10:15 PDT
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!
Comment 1 Michael Catanzaro 2016-09-05 21:50:34 PDT
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->userContentManager is unset when webkitWebViewConstructed() calls webkitWebContextCreatePageForWebView(), because there's no code to set it anywhere.
Comment 2 Michael Catanzaro 2016-09-05 22:00:33 PDT
(In reply to comment #1)
> OK, so our API works fine: the problem only occurs when the related view is
> created via JavaScript on a web site.

This is incorrect, please disregard.
Comment 3 Michael Catanzaro 2016-09-05 22:19:28 PDT
(In reply to comment #0)
> 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

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.
Comment 4 Michael Catanzaro 2016-09-05 22:28:40 PDT
(In reply to comment #3)
> It gets set properly in webkitWebViewSetProperty, but somehow gets nulled out before webkitWebViewConstructed is called.

Even this is wrong. It doesn't get set properly; I accidentally printed a smart pointer location when debugging, instead of the actual null pointer.
Comment 5 Michael Catanzaro 2016-09-05 22:29:54 PDT
It's an Epiphany bug.
Comment 6 Michael Catanzaro 2016-09-05 22:36:04 PDT
(In reply to comment #5)
> It'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's not right, since they're only set by the webkit_web_view_new_with_related_view convenience func.