[GTK] Add support for running JavaScript from GResources
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 13:31:18 +0000 (13:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 13:31:18 +0000 (13:31 +0000)
commit20bacb5b9488b9bc745d990443b8cbf5da0de531
treea4eda0935374afee9d90fa5d7f526f23dcdb60df
parent67f533664b2848c8f29e2440c258e610b90d1d67
[GTK] Add support for running JavaScript from GResources
https://bugs.webkit.org/show_bug.cgi?id=98488

Patch by Simon Pena <spena@igalia.com> on 2012-10-09
Reviewed by Carlos Garcia Campos.

GResources allow embedding certain resources, frequently used, in a "bundle"
which can be kept separated or stored in the binary. This patch adds
support for running JavaScript from GResources.

.:

* configure.ac: Add support for compiling GResources

Source/WebKit2:

For this, methods run_javascript_from_gresource and
run_javascript_from_gresource_finish are added, which load the resource
asynchronously and, when it is ready, run the JavaScript.

* UIProcess/API/gtk/WebKitWebView.cpp: Include the new methods.
(resourcesStreamReadCallback):
(webkit_web_view_run_javascript_from_gresource):
(webkit_web_view_run_javascript_from_gresource_finish):
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Include the new
methods in the documentation.
* UIProcess/API/gtk/tests/GNUmakefile.am: Add the test resources to the
build infrastructure.
* UIProcess/API/gtk/tests/TestMain.cpp: Register the resources in the tests,
so that they can be accessed in all of them.
(register_gresource):
(main):
* UIProcess/API/gtk/tests/TestWebKitWebView.cpp: Test the
run_javascript_from_gresource method.
(testWebViewRunJavaScript):
* UIProcess/API/gtk/tests/WebViewTest.cpp: Add a method for testing the
new run_javascript_from_gresource method.
(runJavaScriptFromGResourceReadyCallback):
(WebViewTest::runJavaScriptFromGResourceAndWaitUntilFinished):
* UIProcess/API/gtk/tests/WebViewTest.h:
* UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml: Added.
Resource bundle containing the resources.
* UIProcess/API/gtk/tests/resources/webkit2gtk-tests.test.js: Added.
Example JavaScript file to test the GResources support.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130755 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
Source/WebKit2/UIProcess/API/gtk/tests/TestMain.cpp
Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
Source/WebKit2/UIProcess/API/gtk/tests/resources/link-title.js [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml [new file with mode: 0644]
configure.ac