[WPE] User script messages don't work
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jun 2017 11:11:22 +0000 (11:11 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jun 2017 11:11:22 +0000 (11:11 +0000)
commitf92dd015509812feb1ab6d60271fbfc65fa9e1b0
tree65e10644263c0dcc54d3b2a07433437f3f13363f
parent10f5f113650c051b275ea8bc244d9730abea1206
[WPE] User script messages don't work
https://bugs.webkit.org/show_bug.cgi?id=173712

Reviewed by Žan Doberšek.

.:

Enable user script messages.

* Source/cmake/OptionsWPE.cmake:

Source/WebKit2:

When a user script message is received we need to create a WebKitJavascriptResult to deserialize the script
value. WebKitJavascriptResult is created with a WebKitWebView for two reasons: to get its JavaScript global
context and to take a reference that ensures the JavaScript context will be alive while the results is
alive. However, we could create the WebKitJavascriptResult with the JavaScript global context and take a
reference of the context itself. This way we don't need to access the WebKitWebView from the
WebScriptMessageHandler client. But we still need access to the JavaScript context, so I've added a
javascriptGlobalContext() method to WebPageProxy for GTK+ and WPE that is implemented from the page client.

Fixes /wpe/WebKitUserContentManager/script-message-received.

* UIProcess/API/glib/WebKitJavascriptResult.cpp:
(_WebKitJavascriptResult::_WebKitJavascriptResult): Create the WebKitJavascriptResult with a JSGlobalContextRef
instead of a WEbKitWebView.
(webkitJavascriptResultCreate): Pass the js context to the constructor.
(webkit_javascript_result_get_global_context): Return the js context.
* UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
* UIProcess/API/glib/WebKitUserContentManager.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(_WebKitWebViewPrivate::~_WebKitWebViewPrivate): Use JSRetainPtr
(webkit_web_view_get_javascript_global_context):
(webkitWebViewRunJavaScriptCallback):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::javascriptGlobalContext):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/wpe/APIViewClient.h:
(API::ViewClient::javascriptGlobalContext):
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::javascriptGlobalContext):
* UIProcess/API/wpe/PageClientImpl.h:
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::View::javascriptGlobalContext):
* UIProcess/API/wpe/WPEView.h:
* UIProcess/PageClient.h:
(WebKit::PageClient::javascriptGlobalContext):
* UIProcess/WebPageProxy.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::javascriptGlobalContext):
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::javascriptGlobalContext):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218740 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/glib/WebKitJavascriptResult.cpp
Source/WebKit2/UIProcess/API/glib/WebKitJavascriptResultPrivate.h
Source/WebKit2/UIProcess/API/glib/WebKitUserContentManager.cpp
Source/WebKit2/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
Source/WebKit2/UIProcess/API/wpe/APIViewClient.h
Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/wpe/PageClientImpl.h
Source/WebKit2/UIProcess/API/wpe/WPEView.cpp
Source/WebKit2/UIProcess/API/wpe/WPEView.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
Source/WebKit2/UIProcess/wpe/WebPageProxyWPE.cpp
Source/cmake/OptionsWPE.cmake