[GTK] Support script message handlers WebKitUserContentManager
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Oct 2014 19:04:19 +0000 (19:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Oct 2014 19:04:19 +0000 (19:04 +0000)
commit87b00f21c758038b1699969b4d464f8499db6f43
tree4ce58060bd3ff113ac46c7473fc0834d62fd1335
parent5b0b0798aee98a18988338a168fc91968c554df3
[GTK] Support script message handlers WebKitUserContentManager
https://bugs.webkit.org/show_bug.cgi?id=133730

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2014-10-31
Reviewed by Carlos Garcia Campos.

Support user script message handlers in WebKitUserContentManager.
This needs building with ENABLE_USER_MESSAGE_HANDLERS, for which
an option is added to the CMake build files. The option is disabled
globally by default, and the WebKitGTK port enables it. On the API
level, two new methods to register and unregister names are provided
in the "window.webkit" namespace, and on message reception the
"WebKitUserContentManager::script-message-received" signal is
emitted, using the registered names as signal detail.

.:

* Source/cmake/OptionsGTK.cmake: For the GTK port, enable the
ENABLE_USER_MESSAGE_HANDLERS feature by default.
* Source/cmake/WebKitFeatures.cmake: Add feature description for
ENABLE_USER_MESSAGE_HANDLERS, disabled by default.

Source/WebCore:

* CMakeLists.txt: Conditionally add the needed files to the build
when the ENABLE_USER_MESSAGE_HANDLERS feature is enabled.

Source/WebKit2:

* UIProcess/API/gtk/WebKitJavascriptResult.cpp: Add a new private
function to construct a WebKitJavascriptResult directly from a
WebCore::SerializedScriptValue.
(_WebKitJavascriptResult::_WebKitJavascriptResult): Ditto.
(webkitJavascriptResultCreate): Ditto.
* UIProcess/API/gtk/WebKitJavascriptResultPrivate.h: Ditto.
* UIProcess/API/gtk/WebKitUserContentManager.cpp:
(webkit_user_content_manager_class_init): Install the
"script-message-received" signal.
(webkit_user_content_manager_register_script_message_handler):
Added.
(webkit_user_content_manager_unregister_script_message_handler):
Added.
* UIProcess/API/gtk/WebKitUserContentManager.h: Added the new
public API methods.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Ditto.
* UIProcess/API/gtk/docs/webkit2gtk.types: Add
webkit_user_content_manager_get_type() to the list in order to make
gtk-doc to generate documentation for signals.

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp:
Add test case for user script message handlers.
(scriptMessageReceived):
(testUserContentManagerScriptMessageReceived):
(beforeAll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175414 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
ChangeLog
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResult.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitJavascriptResultPrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitUserContentManager.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
Source/cmake/OptionsGTK.cmake
Source/cmake/WebKitFeatures.cmake
Source/cmakeconfig.h.cmake
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp