Bug 161615

Summary: [GTK] User script message handlers broken in related web views
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: aperez, bugs-noreply, mcatanzaro
Priority: P2    
Version: Other   
Hardware: PC   
OS: Linux   
See Also: https://bugzilla.gnome.org/show_bug.cgi?id=769627

Michael Catanzaro
Reported 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!
Attachments
Michael Catanzaro
Comment 1 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.
Michael Catanzaro
Comment 2 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.
Michael Catanzaro
Comment 3 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.
Michael Catanzaro
Comment 4 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.
Michael Catanzaro
Comment 5 2016-09-05 22:29:54 PDT
It's an Epiphany bug.
Michael Catanzaro
Comment 6 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.
Note You need to log in before you can comment on or make changes to this bug.