aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2014-01-09 15:53:23 (EST)
committerSami Wagiaalla2014-02-27 15:16:36 (EST)
commit6c6dfbde54f73e110515be4b620f4ab18c1f4c84 (patch)
treea5669fc85b21eb8bc933ff19510d6f94b1e37bad
parente68f6dd7961c12937e9660a6a57b980c17ed895a (diff)
downloadeclipse.platform.swt-6c6dfbde54f73e110515be4b620f4ab18c1f4c84.zip
eclipse.platform.swt-6c6dfbde54f73e110515be4b620f4ab18c1f4c84.tar.gz
eclipse.platform.swt-6c6dfbde54f73e110515be4b620f4ab18c1f4c84.tar.bz2
Bug 425123 - Port SWT Browser to webkit2gtkrefs/changes/21/20521/17
- Load webkit2gtk .so when GTK3 is enabled. - Wrap missing functions. - Remove scrolledWindow wrapper since WebKitWebView is itself a scrolled window. - Update the way favicon database is disabled. - Remove signals no longer available in WebKit2, and update signals that were renamed. - Remove scrolledWindow signal handling. - Port navigation policy code. - Port progress events (progressing, and finishing) - Port and test custom HTTP authentication. - Port and test adding custom HTTP headers Change-Id: I3310cb4aead845a8016810dc06193d60d03b6074 Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c502
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java573
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java315
6 files changed, 1316 insertions, 135 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
index 6eab165..9edffe4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
@@ -1038,6 +1038,107 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1uri_1to_1string)
}
#endif
+#ifndef NO__1webkit_1authentication_1request_1authenticate
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1authentication_1request_1authenticate)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1authentication_1request_1authenticate_FUNC);
+/*
+ webkit_authentication_request_authenticate(arg0, arg1);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_authentication_request_authenticate)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1authentication_1request_1authenticate_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1authentication_1request_1cancel
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1authentication_1request_1cancel)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1authentication_1request_1cancel_FUNC);
+/*
+ webkit_authentication_request_cancel(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_authentication_request_cancel)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1authentication_1request_1cancel_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1authentication_1request_1is_1retry
+JNIEXPORT jboolean JNICALL WebKitGTK_NATIVE(_1webkit_1authentication_1request_1is_1retry)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jboolean rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1authentication_1request_1is_1retry_FUNC);
+/*
+ rc = (jboolean)webkit_authentication_request_is_retry(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_authentication_request_is_retry)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1authentication_1request_1is_1retry_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1credential_1free
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1credential_1free)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1credential_1free_FUNC);
+/*
+ webkit_credential_free(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_credential_free)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1credential_1free_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1credential_1new
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1credential_1new)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2)
+{
+ jbyte *lparg0=NULL;
+ jbyte *lparg1=NULL;
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1credential_1new_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)webkit_credential_new(lparg0, lparg1, arg2);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_credential_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *, jbyte *, jint))fp)(lparg0, lparg1, arg2);
+ }
+ }
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1credential_1new_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1dom_1event_1target_1add_1event_1listener
JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1dom_1event_1target_1add_1event_1listener)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jint arg3, jintLong arg4)
@@ -1518,6 +1619,126 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1get_1favicon_1database)
}
#endif
+#ifndef NO__1webkit_1get_1major_1version
+JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1get_1major_1version)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1get_1major_1version_FUNC);
+/*
+ rc = (jint)webkit_get_major_version();
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_get_major_version)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)())fp)();
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1get_1major_1version_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1get_1micro_1version
+JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1get_1micro_1version)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1get_1micro_1version_FUNC);
+/*
+ rc = (jint)webkit_get_micro_version();
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_get_micro_version)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)())fp)();
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1get_1micro_1version_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1get_1minor_1version
+JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1get_1minor_1version)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1get_1minor_1version_FUNC);
+/*
+ rc = (jint)webkit_get_minor_version();
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_get_minor_version)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)())fp)();
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1get_1minor_1version_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1hit_1test_1result_1context_1is_1link
+JNIEXPORT jboolean JNICALL WebKitGTK_NATIVE(_1webkit_1hit_1test_1result_1context_1is_1link)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jboolean rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1hit_1test_1result_1context_1is_1link_FUNC);
+/*
+ rc = (jboolean)webkit_hit_test_result_context_is_link(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_hit_test_result_context_is_link)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1hit_1test_1result_1context_1is_1link_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1hit_1test_1result_1get_1link_1title
+JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(_1webkit_1hit_1test_1result_1get_1link_1title)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jlong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1hit_1test_1result_1get_1link_1title_FUNC);
+/*
+ rc = (jlong)webkit_hit_test_result_get_link_title(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_hit_test_result_get_link_title)
+ if (fp) {
+ rc = (jlong)((jlong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1hit_1test_1result_1get_1link_1title_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1hit_1test_1result_1get_1link_1uri
+JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(_1webkit_1hit_1test_1result_1get_1link_1uri)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jlong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1hit_1test_1result_1get_1link_1uri_FUNC);
+/*
+ rc = (jlong)webkit_hit_test_result_get_link_uri(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_hit_test_result_get_link_uri)
+ if (fp) {
+ rc = (jlong)((jlong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1hit_1test_1result_1get_1link_1uri_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1major_1version
JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1major_1version)
(JNIEnv *env, jclass that)
@@ -1578,6 +1799,26 @@ JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1minor_1version)
}
#endif
+#ifndef NO__1webkit_1navigation_1policy_1decision_1get_1request
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1navigation_1policy_1decision_1get_1request)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1navigation_1policy_1decision_1get_1request_FUNC);
+/*
+ rc = (jintLong)webkit_navigation_policy_decision_get_request(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_navigation_policy_decision_get_request)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1navigation_1policy_1decision_1get_1request_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1network_1request_1get_1message
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1network_1request_1get_1message)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -1642,6 +1883,62 @@ fail:
}
#endif
+#ifndef NO__1webkit_1policy_1decision_1download
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1policy_1decision_1download)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1policy_1decision_1download_FUNC);
+/*
+ webkit_policy_decision_download(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_policy_decision_download)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1policy_1decision_1download_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1policy_1decision_1ignore
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1policy_1decision_1ignore)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1policy_1decision_1ignore_FUNC);
+/*
+ webkit_policy_decision_ignore(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_policy_decision_ignore)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1policy_1decision_1ignore_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1response_1policy_1decision_1get_1response
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1response_1policy_1decision_1get_1response)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1response_1policy_1decision_1get_1response_FUNC);
+/*
+ rc = (jintLong)webkit_response_policy_decision_get_response(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_response_policy_decision_get_response)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1response_1policy_1decision_1get_1response_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1soup_1auth_1dialog_1get_1type
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1soup_1auth_1dialog_1get_1type)
(JNIEnv *env, jclass that)
@@ -1662,6 +1959,130 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1soup_1auth_1dialog_1get_1t
}
#endif
+#ifndef NO__1webkit_1uri_1request_1get_1http_1headers
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1uri_1request_1get_1http_1headers)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1uri_1request_1get_1http_1headers_FUNC);
+/*
+ rc = (jintLong)webkit_uri_request_get_http_headers(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_uri_request_get_http_headers)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1uri_1request_1get_1http_1headers_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1uri_1request_1get_1uri
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1uri_1request_1get_1uri)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1uri_1request_1get_1uri_FUNC);
+/*
+ rc = (jintLong)webkit_uri_request_get_uri(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_uri_request_get_uri)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1uri_1request_1get_1uri_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1uri_1request_1new
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1uri_1request_1new)
+ (JNIEnv *env, jclass that, jbyteArray arg0)
+{
+ jbyte *lparg0=NULL;
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1uri_1request_1new_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)webkit_uri_request_new(lparg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_uri_request_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *))fp)(lparg0);
+ }
+ }
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1uri_1request_1new_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1uri_1response_1get_1mime_1type
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1uri_1response_1get_1mime_1type)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1uri_1response_1get_1mime_1type_FUNC);
+/*
+ rc = (jintLong)webkit_uri_response_get_mime_type(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_uri_response_get_mime_type)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1uri_1response_1get_1mime_1type_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1web_1context_1get_1default
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1get_1default)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1context_1get_1default_FUNC);
+/*
+ rc = (jintLong)webkit_web_context_get_default();
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_context_get_default)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1context_1get_1default_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1webkit_1web_1context_1set_1favicon_1database_1directory
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1set_1favicon_1database_1directory)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1context_1set_1favicon_1database_1directory_FUNC);
+/*
+ rc = (jintLong)webkit_web_context_set_favicon_database_directory(arg0, arg1);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_context_set_favicon_database_directory)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1context_1set_1favicon_1database_1directory_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1web_1data_1source_1get_1data
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1data_1source_1get_1data)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -2000,6 +2421,26 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1dom_1docum
}
#endif
+#ifndef NO__1webkit_1web_1view_1get_1estimated_1load_1progress
+JNIEXPORT jdouble JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1estimated_1load_1progress)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jdouble rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1estimated_1load_1progress_FUNC);
+/*
+ rc = (jdouble)webkit_web_view_get_estimated_load_progress(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_get_estimated_load_progress)
+ if (fp) {
+ rc = (jdouble)((jdouble (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1estimated_1load_1progress_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1web_1view_1get_1load_1status
JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1load_1status)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -2196,6 +2637,49 @@ JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1go_1forward)
}
#endif
+#ifndef NO__1webkit_1web_1view_1load_1html
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1html)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2)
+{
+ jbyte *lparg1=NULL;
+ jbyte *lparg2=NULL;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1load_1html_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail;
+/*
+ webkit_web_view_load_html(arg0, lparg1, lparg2);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_load_html)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jbyte *, jbyte *))fp)(arg0, lparg1, lparg2);
+ }
+ }
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1load_1html_FUNC);
+}
+#endif
+
+#ifndef NO__1webkit_1web_1view_1load_1request
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1request)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1load_1request_FUNC);
+/*
+ webkit_web_view_load_request(arg0, arg1);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_load_request)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1load_1request_FUNC);
+}
+#endif
+
#ifndef NO__1webkit_1web_1view_1load_1string
JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1string)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jbyteArray arg3, jbyteArray arg4)
@@ -2287,6 +2771,24 @@ JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1reload)
}
#endif
+#ifndef NO__1webkit_1web_1view_1run_1javascript
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1run_1javascript)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1run_1javascript_FUNC);
+/*
+ webkit_web_view_run_javascript(arg0, arg1, arg2, arg3, arg4);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_run_javascript)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, jintLong, jintLong, jintLong))fp)(arg0, arg1, arg2, arg3, arg4);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1run_1javascript_FUNC);
+}
+#endif
+
#ifndef NO__1webkit_1web_1view_1stop_1loading
JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1stop_1loading)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
index 547aa00..759a458 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2009, 2012 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -28,7 +28,12 @@
void* handle = 0; \
char *gtk3 = getenv("SWT_GTK3"); \
if (gtk3 == NULL || strcmp(gtk3, "1") == 0) { \
- handle = dlopen("libwebkitgtk-3.0.so.0", LOAD_FLAGS); /* webkitgtk >= 3.x lib */ \
+ char *webkit2 = getenv("SWT_WEBKIT2"); \
+ if (webkit2 != NULL && strcmp(webkit2, "1") == 0) { \
+ handle = dlopen("libwebkit2gtk-3.0.so.25", LOAD_FLAGS); /* webkit2 */ \
+ } else { \
+ handle = dlopen("libwebkitgtk-3.0.so.0", LOAD_FLAGS); /* webkitgtk >= 3.x lib */ \
+ } \
} else { \
handle = dlopen("libwebkit-1.0.so.2", LOAD_FLAGS); /* webkitgtk 1.2.x lib */ \
if (!handle) { \
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
index 5b59ba1..7d5d59c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
@@ -70,6 +70,11 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1soup_1uri_1free",
"_1soup_1uri_1new",
"_1soup_1uri_1to_1string",
+ "_1webkit_1authentication_1request_1authenticate",
+ "_1webkit_1authentication_1request_1cancel",
+ "_1webkit_1authentication_1request_1is_1retry",
+ "_1webkit_1credential_1free",
+ "_1webkit_1credential_1new",
"_1webkit_1dom_1event_1target_1add_1event_1listener",
"_1webkit_1dom_1mouse_1event_1get_1alt_1key",
"_1webkit_1dom_1mouse_1event_1get_1button",
@@ -94,13 +99,30 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1webkit_1favicon_1database_1set_1path",
"_1webkit_1get_1default_1session",
"_1webkit_1get_1favicon_1database",
+ "_1webkit_1get_1major_1version",
+ "_1webkit_1get_1micro_1version",
+ "_1webkit_1get_1minor_1version",
+ "_1webkit_1hit_1test_1result_1context_1is_1link",
+ "_1webkit_1hit_1test_1result_1get_1link_1title",
+ "_1webkit_1hit_1test_1result_1get_1link_1uri",
"_1webkit_1major_1version",
"_1webkit_1micro_1version",
"_1webkit_1minor_1version",
+ "_1webkit_1navigation_1policy_1decision_1get_1request",
"_1webkit_1network_1request_1get_1message",
"_1webkit_1network_1request_1get_1uri",
"_1webkit_1network_1request_1new",
+ "_1webkit_1policy_1decision_1download",
+ "_1webkit_1policy_1decision_1ignore",
+ "_1webkit_1response_1policy_1decision_1get_1response",
+ "_1webkit_1settings_1new",
"_1webkit_1soup_1auth_1dialog_1get_1type",
+ "_1webkit_1uri_1request_1get_1http_1headers",
+ "_1webkit_1uri_1request_1get_1uri",
+ "_1webkit_1uri_1request_1new",
+ "_1webkit_1uri_1response_1get_1mime_1type",
+ "_1webkit_1web_1context_1get_1default",
+ "_1webkit_1web_1context_1set_1favicon_1database_1directory",
"_1webkit_1web_1data_1source_1get_1data",
"_1webkit_1web_1data_1source_1get_1encoding",
"_1webkit_1web_1frame_1get_1data_1source",
@@ -118,6 +140,7 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1webkit_1web_1view_1can_1show_1mime_1type",
"_1webkit_1web_1view_1execute_1script",
"_1webkit_1web_1view_1get_1dom_1document",
+ "_1webkit_1web_1view_1get_1estimated_1load_1progress",
"_1webkit_1web_1view_1get_1load_1status",
"_1webkit_1web_1view_1get_1main_1frame",
"_1webkit_1web_1view_1get_1progress",
@@ -128,10 +151,13 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1webkit_1web_1view_1get_1window_1features",
"_1webkit_1web_1view_1go_1back",
"_1webkit_1web_1view_1go_1forward",
+ "_1webkit_1web_1view_1load_1html",
+ "_1webkit_1web_1view_1load_1request",
"_1webkit_1web_1view_1load_1string",
"_1webkit_1web_1view_1load_1uri",
"_1webkit_1web_1view_1new",
"_1webkit_1web_1view_1reload",
+ "_1webkit_1web_1view_1run_1javascript",
"_1webkit_1web_1view_1stop_1loading",
"memmove",
};
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
index c5771a6..bd4427f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
@@ -80,6 +80,11 @@ typedef enum {
_1soup_1uri_1free_FUNC,
_1soup_1uri_1new_FUNC,
_1soup_1uri_1to_1string_FUNC,
+ _1webkit_1authentication_1request_1authenticate_FUNC,
+ _1webkit_1authentication_1request_1cancel_FUNC,
+ _1webkit_1authentication_1request_1is_1retry_FUNC,
+ _1webkit_1credential_1free_FUNC,
+ _1webkit_1credential_1new_FUNC,
_1webkit_1dom_1event_1target_1add_1event_1listener_FUNC,
_1webkit_1dom_1mouse_1event_1get_1alt_1key_FUNC,
_1webkit_1dom_1mouse_1event_1get_1button_FUNC,
@@ -104,13 +109,30 @@ typedef enum {
_1webkit_1favicon_1database_1set_1path_FUNC,
_1webkit_1get_1default_1session_FUNC,
_1webkit_1get_1favicon_1database_FUNC,
+ _1webkit_1get_1major_1version_FUNC,
+ _1webkit_1get_1micro_1version_FUNC,
+ _1webkit_1get_1minor_1version_FUNC,
+ _1webkit_1hit_1test_1result_1context_1is_1link_FUNC,
+ _1webkit_1hit_1test_1result_1get_1link_1title_FUNC,
+ _1webkit_1hit_1test_1result_1get_1link_1uri_FUNC,
_1webkit_1major_1version_FUNC,
_1webkit_1micro_1version_FUNC,
_1webkit_1minor_1version_FUNC,
+ _1webkit_1navigation_1policy_1decision_1get_1request_FUNC,
_1webkit_1network_1request_1get_1message_FUNC,
_1webkit_1network_1request_1get_1uri_FUNC,
_1webkit_1network_1request_1new_FUNC,
+ _1webkit_1policy_1decision_1download_FUNC,
+ _1webkit_1policy_1decision_1ignore_FUNC,
+ _1webkit_1response_1policy_1decision_1get_1response_FUNC,
+ _1webkit_1settings_1new_FUNC,
_1webkit_1soup_1auth_1dialog_1get_1type_FUNC,
+ _1webkit_1uri_1request_1get_1http_1headers_FUNC,
+ _1webkit_1uri_1request_1get_1uri_FUNC,
+ _1webkit_1uri_1request_1new_FUNC,
+ _1webkit_1uri_1response_1get_1mime_1type_FUNC,
+ _1webkit_1web_1context_1get_1default_FUNC,
+ _1webkit_1web_1context_1set_1favicon_1database_1directory_FUNC,
_1webkit_1web_1data_1source_1get_1data_FUNC,
_1webkit_1web_1data_1source_1get_1encoding_FUNC,
_1webkit_1web_1frame_1get_1data_1source_FUNC,
@@ -128,6 +150,7 @@ typedef enum {
_1webkit_1web_1view_1can_1show_1mime_1type_FUNC,
_1webkit_1web_1view_1execute_1script_FUNC,
_1webkit_1web_1view_1get_1dom_1document_FUNC,
+ _1webkit_1web_1view_1get_1estimated_1load_1progress_FUNC,
_1webkit_1web_1view_1get_1load_1status_FUNC,
_1webkit_1web_1view_1get_1main_1frame_FUNC,
_1webkit_1web_1view_1get_1progress_FUNC,
@@ -138,10 +161,13 @@ typedef enum {
_1webkit_1web_1view_1get_1window_1features_FUNC,
_1webkit_1web_1view_1go_1back_FUNC,
_1webkit_1web_1view_1go_1forward_FUNC,
+ _1webkit_1web_1view_1load_1html_FUNC,
+ _1webkit_1web_1view_1load_1request_FUNC,
_1webkit_1web_1view_1load_1string_FUNC,
_1webkit_1web_1view_1load_1uri_FUNC,
_1webkit_1web_1view_1new_FUNC,
_1webkit_1web_1view_1reload_FUNC,
+ _1webkit_1web_1view_1run_1javascript_FUNC,
_1webkit_1web_1view_1stop_1loading_FUNC,
memmove_FUNC,
} WebKitGTK_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 931a888..9b86a95 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -12,16 +12,39 @@ package org.eclipse.swt.browser;
import java.io.UnsupportedEncodingException;
-import java.net.*;
-import java.util.*;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.internal.webkit.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Callback;
+import org.eclipse.swt.internal.Compatibility;
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.LONG;
+import org.eclipse.swt.internal.Library;
+import org.eclipse.swt.internal.gtk.GdkEventKey;
+import org.eclipse.swt.internal.gtk.OS;
+import org.eclipse.swt.internal.webkit.JSClassDefinition;
+import org.eclipse.swt.internal.webkit.WebKitGTK;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
@SuppressWarnings({"rawtypes", "unchecked"})
class WebKit extends WebBrowser {
@@ -86,6 +109,11 @@ class WebKit extends WebBrowser {
static final int CLOSE_WEB_VIEW = 13;
static final int WINDOW_OBJECT_CLEARED = 14;
static final int CONSOLE_MESSAGE = 15;
+ static final int LOAD_CHANGED = 16;
+ static final int DECIDE_POLICY = 17;
+ static final int MOUSE_TARGET_CHANGED = 18;
+ static final int CONTEXT_MENU = 19;
+ static final int AUTHENTICATE = 20;
static final String KEY_CHECK_SUBWINDOW = "org.eclipse.swt.internal.control.checksubwindow"; //$NON-NLS-1$
@@ -94,6 +122,8 @@ class WebKit extends WebBrowser {
static Callback JSObjectHasPropertyProc, JSObjectGetPropertyProc, JSObjectCallAsFunctionProc;
static Callback JSDOMEventProc;
+ static boolean WEBKIT2;
+
static {
try {
Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$
@@ -102,6 +132,9 @@ class WebKit extends WebBrowser {
}
if (LibraryLoaded) {
+ String webkit2 = System.getenv("SWT_WEBKIT2"); // $NON-NLS-1$
+ WEBKIT2 = webkit2 != null && webkit2.equals("1") && OS.GTK3; // $NON-NLS-1$
+
WebViewType = WebKitGTK.webkit_web_view_get_type ();
Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$
@@ -214,10 +247,19 @@ class WebKit extends WebBrowser {
}
}
+static String getString (long /*int*/ strPtr) {
+ int length = OS.strlen (strPtr);
+ byte [] buffer = new byte [length];
+ OS.memmove (buffer, strPtr, length);
+ return new String (Converter.mbcsToWcs (null, buffer));
+}
+
static Browser FindBrowser (long /*int*/ webView) {
if (webView == 0) return null;
long /*int*/ parent = OS.gtk_widget_get_parent (webView);
- parent = OS.gtk_widget_get_parent (parent);
+ if (!WEBKIT2){
+ parent = OS.gtk_widget_get_parent (parent);
+ }
return (Browser)Display.getCurrent ().findWidget (parent);
}
@@ -226,9 +268,16 @@ static boolean IsInstalled () {
// TODO webkit_check_version() should take care of the following, but for some
// reason this symbol is missing from the latest build. If it is present in
// Linux distro-provided builds then replace the following with this call.
- int major = WebKitGTK.webkit_major_version ();
- int minor = WebKitGTK.webkit_minor_version ();
- int micro = WebKitGTK.webkit_micro_version ();
+ int major, minor, micro;
+ if (WEBKIT2){
+ major = WebKitGTK.webkit_get_major_version ();
+ minor = WebKitGTK.webkit_get_minor_version ();
+ micro = WebKitGTK.webkit_get_micro_version ();
+ } else {
+ major = WebKitGTK.webkit_major_version ();
+ minor = WebKitGTK.webkit_minor_version ();
+ micro = WebKitGTK.webkit_micro_version ();
+ }
IsWebKit14orNewer = major > 1 ||
(major == 1 && minor > 4) ||
(major == 1 && minor == 4 && micro >= 0);
@@ -352,11 +401,14 @@ static long /*int*/ Proc (long /*int*/ handle, long /*int*/ user_data) {
static long /*int*/ Proc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
long /*int*/ webView;
- if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) {
+ if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_view_get_type ())) {
+ webView = handle;
+ } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) {
webView = WebKitGTK.webkit_web_frame_get_web_view (handle);
} else {
- webView = handle;
+ return 0;
}
+
Browser browser = FindBrowser (webView);
if (browser == null) return 0;
WebKit webkit = (WebKit)browser.webBrowser;
@@ -433,9 +485,41 @@ long /*int*/ sessionProc (long /*int*/ session, long /*int*/ msg, long /*int*/ a
return 0;
}
+long /*int*/ webkit_authenticate (long /*int*/ web_view, long /*int*/ request){
+
+ /* authentication challenges are currently the only notification received from the session */
+ if (!WebKitGTK.webkit_authentication_request_is_retry(request)) {
+ failureCount = 0;
+ } else {
+ if (++failureCount >= 3) return 0;
+ }
+
+ String location = getUrl();
+
+ for (int i = 0; i < authenticationListeners.length; i++) {
+ AuthenticationEvent event = new AuthenticationEvent (browser);
+ event.location = location;
+ authenticationListeners[i].authenticate (event);
+ if (!event.doit) {
+ WebKitGTK.webkit_authentication_request_cancel (request);
+ return 0;
+ }
+ if (event.user != null && event.password != null) {
+ byte[] userBytes = Converter.wcsToMbcs (null, event.user, true);
+ byte[] passwordBytes = Converter.wcsToMbcs (null, event.password, true);
+ long /*int*/ credentials = WebKitGTK.webkit_credential_new (userBytes, passwordBytes, WebKitGTK.WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
+ WebKitGTK.webkit_authentication_request_authenticate(request, credentials);
+ WebKitGTK.webkit_credential_free(credentials);
+ return 0;
+ }
+ }
+ return 0;
+}
+
long /*int*/ webFrameProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
switch ((int)/*64*/user_data) {
case NOTIFY_LOAD_STATUS: return webframe_notify_load_status (handle, arg0);
+ case LOAD_CHANGED: return webkit_load_changed (handle, (int) arg0, user_data);
default: return 0;
}
}
@@ -453,10 +537,12 @@ long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ u
case CREATE_WEB_VIEW: return webkit_create_web_view (handle, arg0);
case DOWNLOAD_REQUESTED: return webkit_download_requested (handle, arg0);
case NOTIFY_LOAD_STATUS: return webkit_notify_load_status (handle, arg0);
+ case LOAD_CHANGED: return webkit_load_changed (handle, (int) arg0, user_data);
case NOTIFY_PROGRESS: return webkit_notify_progress (handle, arg0);
case NOTIFY_TITLE: return webkit_notify_title (handle, arg0);
case POPULATE_POPUP: return webkit_populate_popup (handle, arg0);
case STATUS_BAR_TEXT_CHANGED: return webkit_status_bar_text_changed (handle, arg0);
+ case AUTHENTICATE: return webkit_authenticate (handle, arg0);
default: return 0;
}
}
@@ -464,6 +550,8 @@ long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ u
long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ arg1, long /*int*/ user_data) {
switch ((int)/*64*/user_data) {
case HOVERING_OVER_LINK: return webkit_hovering_over_link (handle, arg0, arg1);
+ case MOUSE_TARGET_CHANGED: return webkit_mouse_target_changed (handle, arg0, arg1);
+ case DECIDE_POLICY: return webkit_decide_policy(handle, arg0, (int)arg1, user_data);
default: return 0;
}
}
@@ -472,6 +560,7 @@ long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ a
switch ((int)/*64*/user_data) {
case CONSOLE_MESSAGE: return webkit_console_message (handle, arg0, arg1, arg2);
case WINDOW_OBJECT_CLEARED: return webkit_window_object_cleared (handle, arg0, arg1, arg2);
+ case CONTEXT_MENU: return webkit_context_menu(handle, arg0, arg1, arg2);
default: return 0;
}
}
@@ -489,9 +578,16 @@ long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ a
public void create (Composite parent, int style) {
if (ExternalClass == 0) {
if (Device.DEBUG) {
- int major = WebKitGTK.webkit_major_version ();
- int minor = WebKitGTK.webkit_minor_version ();
- int micro = WebKitGTK.webkit_micro_version ();
+ int major, minor, micro;
+ if (WEBKIT2){
+ major = WebKitGTK.webkit_get_major_version ();
+ minor = WebKitGTK.webkit_get_minor_version ();
+ micro = WebKitGTK.webkit_get_micro_version ();
+ } else {
+ major = WebKitGTK.webkit_major_version ();
+ minor = WebKitGTK.webkit_minor_version ();
+ micro = WebKitGTK.webkit_micro_version ();
+ }
System.out.println("WebKit version " + major + "." + minor + "." + micro); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
JSClassDefinition jsClassDefinition = new JSClassDefinition ();
@@ -515,37 +611,64 @@ public void create (Composite parent, int style) {
* thread. Work around this crash by disabling the use of WebKitGTK's
* icon database, which should not affect the Browser in any way.
*/
- long /*int*/ database = WebKitGTK.webkit_get_favicon_database ();
- if (database != 0) {
- /* WebKitGTK version is >= 1.8.x */
- WebKitGTK.webkit_favicon_database_set_path (database, 0);
+ if (WEBKIT2){
+ WebKitGTK.webkit_web_context_set_favicon_database_directory(WebKitGTK.webkit_web_context_get_default(), 0);
+ } else {
+ long /*int*/ database = WebKitGTK.webkit_get_favicon_database ();
+ if (database != 0) {
+ /* WebKitGTK version is >= 1.8.x */
+ WebKitGTK.webkit_favicon_database_set_path (database, 0);
+ }
}
}
- scrolledWindow = OS.gtk_scrolled_window_new (0, 0);
- OS.gtk_scrolled_window_set_policy (scrolledWindow, OS.GTK_POLICY_AUTOMATIC, OS.GTK_POLICY_AUTOMATIC);
+ if (!WEBKIT2){
+ scrolledWindow = OS.gtk_scrolled_window_new (0, 0);
+ OS.gtk_scrolled_window_set_policy (scrolledWindow, OS.GTK_POLICY_AUTOMATIC, OS.GTK_POLICY_AUTOMATIC);
+ }
+
webView = WebKitGTK.webkit_web_view_new ();
webViewData = C.malloc (C.PTR_SIZEOF);
C.memmove (webViewData, new long /*int*/[] {webView}, C.PTR_SIZEOF);
- OS.gtk_container_add (scrolledWindow, webView);
- OS.gtk_container_add (browser.handle, scrolledWindow);
- OS.gtk_widget_show (scrolledWindow);
+
+ if (!WEBKIT2){
+ OS.gtk_container_add (scrolledWindow, webView);
+ OS.gtk_container_add (browser.handle, scrolledWindow);
+ OS.gtk_widget_show (scrolledWindow);
+
+ OS.g_signal_connect (webView, WebKitGTK.close_web_view, Proc2.getAddress (), CLOSE_WEB_VIEW);
+ OS.g_signal_connect (webView, WebKitGTK.console_message, Proc5.getAddress (), CONSOLE_MESSAGE);
+ OS.g_signal_connect (webView, WebKitGTK.create_web_view, Proc3.getAddress (), CREATE_WEB_VIEW);
+ OS.g_signal_connect (webView, WebKitGTK.notify_load_status, Proc3.getAddress (), NOTIFY_LOAD_STATUS);
+ OS.g_signal_connect (webView, WebKitGTK.web_view_ready, Proc2.getAddress (), WEB_VIEW_READY);
+ OS.g_signal_connect (webView, WebKitGTK.navigation_policy_decision_requested, Proc6.getAddress (), NAVIGATION_POLICY_DECISION_REQUESTED);
+ OS.g_signal_connect (webView, WebKitGTK.mime_type_policy_decision_requested, Proc6.getAddress (), MIME_TYPE_POLICY_DECISION_REQUESTED);
+ OS.g_signal_connect (webView, WebKitGTK.resource_request_starting, Proc6.getAddress (), RESOURCE_REQUEST_STARTING);
+ OS.g_signal_connect (webView, WebKitGTK.download_requested, Proc3.getAddress (), DOWNLOAD_REQUESTED);
+ OS.g_signal_connect (webView, WebKitGTK.hovering_over_link, Proc4.getAddress (), HOVERING_OVER_LINK);
+ OS.g_signal_connect (webView, WebKitGTK.populate_popup, Proc3.getAddress (), POPULATE_POPUP);
+ OS.g_signal_connect (webView, WebKitGTK.notify_progress, Proc3.getAddress (), NOTIFY_PROGRESS);
+ OS.g_signal_connect (webView, WebKitGTK.window_object_cleared, Proc5.getAddress (), WINDOW_OBJECT_CLEARED);
+ OS.g_signal_connect (webView, WebKitGTK.status_bar_text_changed, Proc3.getAddress (), STATUS_BAR_TEXT_CHANGED);
+ } else {
+ OS.gtk_container_add (browser.handle, webView);
+
+ OS.g_signal_connect (webView, WebKitGTK.close, Proc2.getAddress (), CLOSE_WEB_VIEW);
+ OS.g_signal_connect (webView, WebKitGTK.create, Proc3.getAddress (), CREATE_WEB_VIEW);
+ OS.g_signal_connect (webView, WebKitGTK.load_changed, Proc3.getAddress (), LOAD_CHANGED);
+ OS.g_signal_connect (webView, WebKitGTK.ready_to_show, Proc2.getAddress (), WEB_VIEW_READY);
+ OS.g_signal_connect (webView, WebKitGTK.decide_policy, Proc4.getAddress (), DECIDE_POLICY);
+ OS.g_signal_connect (WebKitGTK.webkit_web_context_get_default(), WebKitGTK.download_started, Proc3.getAddress (), DOWNLOAD_REQUESTED);
+ OS.g_signal_connect (webView, WebKitGTK.mouse_target_changed, Proc4.getAddress (), MOUSE_TARGET_CHANGED);
+ OS.g_signal_connect (webView, WebKitGTK.context_menu, Proc5.getAddress (), CONTEXT_MENU);
+ OS.g_signal_connect (webView, WebKitGTK.notify_estimated_load_progress, Proc3.getAddress (), NOTIFY_PROGRESS);
+ OS.g_signal_connect (webView, WebKitGTK.authenticate, Proc3.getAddress (), AUTHENTICATE);
+ }
+
OS.gtk_widget_show (webView);
- OS.g_signal_connect (webView, WebKitGTK.close_web_view, Proc2.getAddress (), CLOSE_WEB_VIEW);
- OS.g_signal_connect (webView, WebKitGTK.console_message, Proc5.getAddress (), CONSOLE_MESSAGE);
- OS.g_signal_connect (webView, WebKitGTK.create_web_view, Proc3.getAddress (), CREATE_WEB_VIEW);
- OS.g_signal_connect (webView, WebKitGTK.download_requested, Proc3.getAddress (), DOWNLOAD_REQUESTED);
- OS.g_signal_connect (webView, WebKitGTK.hovering_over_link, Proc4.getAddress (), HOVERING_OVER_LINK);
- OS.g_signal_connect (webView, WebKitGTK.mime_type_policy_decision_requested, Proc6.getAddress (), MIME_TYPE_POLICY_DECISION_REQUESTED);
- OS.g_signal_connect (webView, WebKitGTK.navigation_policy_decision_requested, Proc6.getAddress (), NAVIGATION_POLICY_DECISION_REQUESTED);
- OS.g_signal_connect (webView, WebKitGTK.notify_load_status, Proc3.getAddress (), NOTIFY_LOAD_STATUS);
- OS.g_signal_connect (webView, WebKitGTK.notify_progress, Proc3.getAddress (), NOTIFY_PROGRESS);
+ OS.gtk_widget_show (browser.handle);
+
OS.g_signal_connect (webView, WebKitGTK.notify_title, Proc3.getAddress (), NOTIFY_TITLE);
- OS.g_signal_connect (webView, WebKitGTK.populate_popup, Proc3.getAddress (), POPULATE_POPUP);
- OS.g_signal_connect (webView, WebKitGTK.resource_request_starting, Proc6.getAddress (), RESOURCE_REQUEST_STARTING);
- OS.g_signal_connect (webView, WebKitGTK.status_bar_text_changed, Proc3.getAddress (), STATUS_BAR_TEXT_CHANGED);
- OS.g_signal_connect (webView, WebKitGTK.web_view_ready, Proc2.getAddress (), WEB_VIEW_READY);
- OS.g_signal_connect (webView, WebKitGTK.window_object_cleared, Proc5.getAddress (), WINDOW_OBJECT_CLEARED);
/* Callback to get events before WebKit receives and consumes them */
OS.g_signal_connect (webView, OS.button_press_event, JSDOMEventProc.getAddress (), 0);
@@ -561,18 +684,26 @@ public void create (Composite parent, int style) {
* This hook is set after WebKit and is therefore called after WebKit's
* handler because GTK dispatches events in their order of registration.
*/
- OS.g_signal_connect (scrolledWindow, OS.button_press_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
- OS.g_signal_connect (scrolledWindow, OS.button_release_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
- OS.g_signal_connect (scrolledWindow, OS.key_press_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
- OS.g_signal_connect (scrolledWindow, OS.key_release_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
- OS.g_signal_connect (scrolledWindow, OS.scroll_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
- OS.g_signal_connect (scrolledWindow, OS.motion_notify_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ if (!WEBKIT2){
+ OS.g_signal_connect (scrolledWindow, OS.button_press_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ OS.g_signal_connect (scrolledWindow, OS.button_release_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ OS.g_signal_connect (scrolledWindow, OS.key_press_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ OS.g_signal_connect (scrolledWindow, OS.key_release_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ OS.g_signal_connect (scrolledWindow, OS.scroll_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ OS.g_signal_connect (scrolledWindow, OS.motion_notify_event, JSDOMEventProc.getAddress (), STOP_PROPOGATE);
+ }
+
+ byte[] bytes = Converter.wcsToMbcs (null, "UTF-8", true); // $NON-NLS-1$
long /*int*/ settings = WebKitGTK.webkit_web_view_get_settings (webView);
OS.g_object_set (settings, WebKitGTK.javascript_can_open_windows_automatically, 1, 0);
- OS.g_object_set (settings, WebKitGTK.enable_universal_access_from_file_uris, 1, 0);
- byte[] bytes = Converter.wcsToMbcs (null, "UTF-8", true); // $NON-NLS-1$
- OS.g_object_set (settings, WebKitGTK.default_encoding, bytes, 0);
+
+ if (WEBKIT2){
+ OS.g_object_set (settings, WebKitGTK.default_charset, bytes, 0);
+ } else {
+ OS.g_object_set (settings, WebKitGTK.default_encoding, bytes, 0);
+ OS.g_object_set (settings, WebKitGTK.enable_universal_access_from_file_uris, 1, 0);
+ }
Listener listener = new Listener () {
public void handleEvent (Event event) {
@@ -605,46 +736,48 @@ public void create (Composite parent, int style) {
browser.addListener (SWT.KeyDown, listener);
browser.addListener (SWT.Resize, listener);
- /*
- * Ensure that our Authenticate listener is at the front of the signal
- * queue by removing the default Authenticate listener, adding ours,
- * and then re-adding the default listener.
- */
- long /*int*/ session = WebKitGTK.webkit_get_default_session ();
- long /*int*/ originalAuth = WebKitGTK.soup_session_get_feature (session, WebKitGTK.webkit_soup_auth_dialog_get_type ());
- if (originalAuth != 0) {
- WebKitGTK.soup_session_feature_detach (originalAuth, session);
- }
- OS.g_signal_connect (session, WebKitGTK.authenticate, Proc5.getAddress (), webView);
- if (originalAuth != 0) {
- WebKitGTK.soup_session_feature_attach (originalAuth, session);
- }
-
- /*
- * Check for proxy values set as documented java properties and update the
- * session to use these values if needed.
- */
- String proxyHost = System.getProperty (PROPERTY_PROXYHOST);
- String proxyPortString = System.getProperty (PROPERTY_PROXYPORT);
- int port = -1;
- if (proxyPortString != null) {
- try {
- int value = Integer.valueOf (proxyPortString).intValue ();
- if (0 <= value && value <= MAX_PORT) port = value;
- } catch (NumberFormatException e) {
- /* do nothing, java property has non-integer value */
+ if (!WEBKIT2){
+ /*
+ * Ensure that our Authenticate listener is at the front of the signal
+ * queue by removing the default Authenticate listener, adding ours,
+ * and then re-adding the default listener.
+ */
+ long /*int*/ session = WebKitGTK.webkit_get_default_session ();
+ long /*int*/ originalAuth = WebKitGTK.soup_session_get_feature (session, WebKitGTK.webkit_soup_auth_dialog_get_type ());
+ if (originalAuth != 0) {
+ WebKitGTK.soup_session_feature_detach (originalAuth, session);
}
- }
- if (proxyHost != null || port != -1) {
- if (!proxyHost.startsWith (PROTOCOL_HTTP)) {
- proxyHost = PROTOCOL_HTTP + proxyHost;
+ OS.g_signal_connect (session, WebKitGTK.authenticate, Proc5.getAddress (), webView);
+ if (originalAuth != 0) {
+ WebKitGTK.soup_session_feature_attach (originalAuth, session);
+ }
+
+ /*
+ * Check for proxy values set as documented java properties and update the
+ * session to use these values if needed.
+ */
+ String proxyHost = System.getProperty (PROPERTY_PROXYHOST);
+ String proxyPortString = System.getProperty (PROPERTY_PROXYPORT);
+ int port = -1;
+ if (proxyPortString != null) {
+ try {
+ int value = Integer.valueOf (proxyPortString).intValue ();
+ if (0 <= value && value <= MAX_PORT) port = value;
+ } catch (NumberFormatException e) {
+ /* do nothing, java property has non-integer value */
+ }
}
- proxyHost += ":" + port; //$NON-NLS-1$
- bytes = Converter.wcsToMbcs (null, proxyHost, true);
- long /*int*/ uri = WebKitGTK.soup_uri_new (bytes);
- if (uri != 0) {
- OS.g_object_set (session, WebKitGTK.SOUP_SESSION_PROXY_URI, uri, 0);
- WebKitGTK.soup_uri_free (uri);
+ if (proxyHost != null || port != -1) {
+ if (!proxyHost.startsWith (PROTOCOL_HTTP)) {
+ proxyHost = PROTOCOL_HTTP + proxyHost;
+ }
+ proxyHost += ":" + port; //$NON-NLS-1$
+ bytes = Converter.wcsToMbcs (null, proxyHost, true);
+ long /*int*/ uri = WebKitGTK.soup_uri_new (bytes);
+ if (uri != 0) {
+ OS.g_object_set (session, WebKitGTK.SOUP_SESSION_PROXY_URI, uri, 0);
+ WebKitGTK.soup_uri_free (uri);
+ }
}
}
@@ -671,8 +804,14 @@ public void create (Composite parent, int style) {
* it. The workaround is to temporarily give it a size that forces
* the native resize events to fire.
*/
- int major = WebKitGTK.webkit_major_version ();
- int minor = WebKitGTK.webkit_minor_version ();
+ int major, minor;
+ if (WEBKIT2){
+ major = WebKitGTK.webkit_get_major_version ();
+ minor = WebKitGTK.webkit_get_minor_version ();
+ } else {
+ major = WebKitGTK.webkit_major_version ();
+ minor = WebKitGTK.webkit_minor_version ();
+ }
if (major == 1 && minor >= 10) {
Rectangle minSize = browser.computeTrim (0, 0, 2, 2);
Point size = browser.getSize ();
@@ -806,9 +945,6 @@ boolean close (boolean showPrompters) {
@Override
public boolean execute (String script) {
- long /*int*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView);
- long /*int*/ context = WebKitGTK.webkit_web_frame_get_global_context (frame);
-
byte[] bytes = null;
try {
bytes = (script + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$
@@ -822,10 +958,20 @@ public boolean execute (String script) {
} catch (UnsupportedEncodingException e) {
bytes = Converter.wcsToMbcs (null, getUrl (), true);
}
- long /*int*/ urlString = WebKitGTK.JSStringCreateWithUTF8CString (bytes);
+ long /*int*/ result = 0;
+
+ if (WEBKIT2){
+ WebKitGTK.webkit_web_view_run_javascript (webView, scriptString, 0, 0, 0);
+ } else {
+ long /*int*/ urlString = WebKitGTK.JSStringCreateWithUTF8CString (bytes);
+
+ long /*int*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView);
+ long /*int*/ context = WebKitGTK.webkit_web_frame_get_global_context (frame);
+ result = WebKitGTK.JSEvaluateScript (context, scriptString, 0, urlString, 0, null);
+
+ WebKitGTK.JSStringRelease (urlString);
+ }
- long /*int*/ result = WebKitGTK.JSEvaluateScript (context, scriptString, 0, urlString, 0, null);
- WebKitGTK.JSStringRelease (urlString);
WebKitGTK.JSStringRelease (scriptString);
return result != 0;
}
@@ -1300,6 +1446,27 @@ long /*int*/ handleLoadCommitted (long /*int*/ uri, boolean top) {
return 0;
}
+private void fireNewTitleEvent(String title){
+ TitleEvent newEvent = new TitleEvent (browser);
+ newEvent.display = browser.getDisplay ();
+ newEvent.widget = browser;
+ newEvent.title = title;
+ for (int i = 0; i < titleListeners.length; i++) {
+ titleListeners[i].changed (newEvent);
+ }
+}
+
+private void fireProgressCompletedEvent(){
+ ProgressEvent progress = new ProgressEvent (browser);
+ progress.display = browser.getDisplay ();
+ progress.widget = browser;
+ progress.current = MAX_PROGRESS;
+ progress.total = MAX_PROGRESS;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].completed (progress);
+ }
+}
+
long /*int*/ handleLoadFinished (long /*int*/ uri, boolean top) {
int length = OS.strlen (uri);
byte[] bytes = new byte[length];
@@ -1355,25 +1522,12 @@ long /*int*/ handleLoadFinished (long /*int*/ uri, boolean top) {
long /*int*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView);
long /*int*/ title = WebKitGTK.webkit_web_frame_get_title (frame);
if (title == 0) {
- TitleEvent newEvent = new TitleEvent (browser);
- newEvent.display = browser.getDisplay ();
- newEvent.widget = browser;
- newEvent.title = url;
- for (int i = 0; i < titleListeners.length; i++) {
- titleListeners[i].changed (newEvent);
- }
+ fireNewTitleEvent(url);
if (browser.isDisposed ()) return 0;
}
}
- ProgressEvent progress = new ProgressEvent (browser);
- progress.display = browser.getDisplay ();
- progress.widget = browser;
- progress.current = MAX_PROGRESS;
- progress.total = MAX_PROGRESS;
- for (int i = 0; i < progressListeners.length; i++) {
- progressListeners[i].completed (progress);
- }
+ fireProgressCompletedEvent();
}
loadingText = false;
@@ -1418,7 +1572,11 @@ void onDispose (Event e) {
void onResize (Event e) {
Rectangle rect = browser.getClientArea ();
- OS.gtk_widget_set_size_request (scrolledWindow, rect.width, rect.height);
+ if (WEBKIT2){
+ OS.gtk_widget_set_size_request (webView, rect.width, rect.height);
+ } else {
+ OS.gtk_widget_set_size_request (scrolledWindow, rect.width, rect.height);
+ }
}
void openDownloadWindow (final long /*int*/ webkitDownload) {
@@ -1529,10 +1687,22 @@ public boolean setText (String html, boolean trusted) {
boolean blankLoading = htmlBytes != null;
htmlBytes = bytes;
untrustedText = !trusted;
- if (blankLoading) return true;
- byte[] uriBytes = Converter.wcsToMbcs (null, ABOUT_BLANK, true);
- WebKitGTK.webkit_web_view_load_uri (webView, uriBytes);
+ if (WEBKIT2) {
+ byte[] uriBytes;
+ if (untrustedText) {
+ uriBytes = Converter.wcsToMbcs (null, ABOUT_BLANK, true);
+ } else {
+ uriBytes = Converter.wcsToMbcs (null, URI_FILEROOT, true);
+ }
+ WebKitGTK.webkit_web_view_load_html (webView, htmlBytes, uriBytes);
+ } else {
+ if (blankLoading) return true;
+
+ byte[] uriBytes = Converter.wcsToMbcs (null, ABOUT_BLANK, true);
+ WebKitGTK.webkit_web_view_load_uri (webView, uriBytes);
+ }
+
return true;
}
@@ -1590,7 +1760,18 @@ public boolean setUrl (String url, String postData, String[] headers) {
}
}
}
+
byte[] uriBytes = Converter.wcsToMbcs (null, url, true);
+
+ if (WEBKIT2 && headers != null){
+ long /*int*/ request = WebKitGTK.webkit_uri_request_new (uriBytes);
+ long /*int*/ requestHeaders = WebKitGTK.webkit_uri_request_get_http_headers (request);
+ addRequestHeaders(requestHeaders, headers);
+ WebKitGTK.webkit_web_view_load_request (webView, request);
+
+ return true;
+ }
+
WebKitGTK.webkit_web_view_load_uri (webView, uriBytes);
OS.g_object_set (settings, WebKitGTK.user_agent, 0, 0);
return true;
@@ -1699,6 +1880,16 @@ long /*int*/ webkit_download_requested (long /*int*/ web_view, long /*int*/ down
return 1;
}
+long /*int*/ webkit_mouse_target_changed (long /*int*/ web_view, long /*int*/ hit_test_result, long /*int*/ modifiers) {
+ if (WebKitGTK.webkit_hit_test_result_context_is_link(hit_test_result)){
+ long /*int*/ uri = WebKitGTK.webkit_hit_test_result_get_link_uri(hit_test_result);
+ long /*int*/ title = WebKitGTK.webkit_hit_test_result_get_link_title(hit_test_result);
+ return webkit_hovering_over_link(web_view, title, uri);
+ }
+
+ return 0;
+}
+
long /*int*/ webkit_hovering_over_link (long /*int*/ web_view, long /*int*/ title, long /*int*/ uri) {
if (uri != 0) {
int length = OS.strlen (uri);
@@ -1797,6 +1988,68 @@ long /*int*/ webkit_navigation_policy_decision_requested (long /*int*/ web_view,
return 0;
}
+long /*int*/ webkit_decide_policy (long /*int*/ web_view, long /*int*/ decision, int decision_type, long /*int*/ user_data) {
+ switch (decision_type) {
+ case WebKitGTK.WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
+ long /*int*/ request = WebKitGTK. webkit_navigation_policy_decision_get_request(decision);
+ if (request == 0){
+ return 0;
+ }
+ long /*int*/ uri = WebKitGTK.webkit_uri_request_get_uri (request);
+ String url = getString(uri);
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (via setText()) then set it to about:blank to be consistent with IE.
+ */
+ if (url.equals (URI_FILEROOT)) {
+ url = ABOUT_BLANK;
+ } else {
+ int length = URI_FILEROOT.length ();
+ if (url.startsWith (URI_FILEROOT) && url.charAt (length) == '#') {
+ url = ABOUT_BLANK + url.substring (length);
+ }
+ }
+
+ LocationEvent newEvent = new LocationEvent (browser);
+ newEvent.display = browser.getDisplay ();
+ newEvent.widget = browser;
+ newEvent.location = url;
+ newEvent.doit = true;
+ if (locationListeners != null) {
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changing (newEvent);
+ }
+ }
+ if (newEvent.doit && !browser.isDisposed ()) {
+ if (jsEnabled != jsEnabledOnNextPage) {
+ jsEnabled = jsEnabledOnNextPage;
+ DisabledJSCount += !jsEnabled ? 1 : -1;
+ long /*int*/ settings = WebKitGTK.webkit_web_view_get_settings (webView);
+ OS.g_object_set (settings, WebKitGTK.enable_scripts, jsEnabled ? 1 : 0, 0);
+ }
+ }
+ if(!newEvent.doit){
+ WebKitGTK.webkit_policy_decision_ignore (decision);
+ }
+ break;
+ case WebKitGTK.WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
+ break;
+ case WebKitGTK.WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
+ long /*int*/ response = WebKitGTK.webkit_response_policy_decision_get_response(decision);
+ long /*int*/ mime_type = WebKitGTK.webkit_uri_response_get_mime_type(response);
+ boolean canShow = WebKitGTK.webkit_web_view_can_show_mime_type (webView, mime_type) != 0;
+ if (!canShow) {
+ WebKitGTK.webkit_policy_decision_download (decision);
+ return 1;
+ }
+ break;
+ default:
+ /* Making no decision results in webkit_policy_decision_use(). */
+ return 0;
+ }
+ return 0;
+}
+
long /*int*/ webkit_notify_load_status (long /*int*/ web_view, long /*int*/ pspec) {
int status = WebKitGTK.webkit_web_view_get_load_status (webView);
switch (status) {
@@ -1812,11 +2065,38 @@ long /*int*/ webkit_notify_load_status (long /*int*/ web_view, long /*int*/ pspe
return 0;
}
+long /*int*/ webkit_load_changed (long /*int*/ web_view, int status, long user_data) {
+ switch (status) {
+ case WebKitGTK.WEBKIT2_LOAD_COMMITTED: {
+ long /*int*/ uri = WebKitGTK.webkit_web_view_get_uri (webView);
+ return handleLoadCommitted (uri, true);
+ }
+ case WebKitGTK.WEBKIT2_LOAD_FINISHED: {
+ long /*int*/ title = WebKitGTK.webkit_web_view_get_title (webView);
+ if (title == 0) {
+ long /*int*/ uri = WebKitGTK.webkit_web_view_get_uri (webView);
+ fireNewTitleEvent(getString(uri));
+ }
+
+ fireProgressCompletedEvent();
+
+ return 0;
+ }
+ }
+ return 0;
+}
+
long /*int*/ webkit_notify_progress (long /*int*/ web_view, long /*int*/ pspec) {
ProgressEvent event = new ProgressEvent (browser);
event.display = browser.getDisplay ();
event.widget = browser;
- event.current = (int)(WebKitGTK.webkit_web_view_get_progress (webView) * MAX_PROGRESS);
+ double progress = 0;
+ if (WEBKIT2){
+ progress = WebKitGTK.webkit_web_view_get_estimated_load_progress (webView);
+ } else {
+ progress = WebKitGTK.webkit_web_view_get_progress (webView);
+ }
+ event.current = (int) (progress * MAX_PROGRESS);
event.total = MAX_PROGRESS;
for (int i = 0; i < progressListeners.length; i++) {
progressListeners[i].changed (event);
@@ -1845,6 +2125,29 @@ long /*int*/ webkit_notify_title (long /*int*/ web_view, long /*int*/ pspec) {
return 0;
}
+long /*int*/ webkit_context_menu (long /*int*/ web_view, long /*int*/ context_menu, long /*int*/ eventXXX, long /*int*/ hit_test_result) {
+ Point pt = browser.getDisplay ().getCursorLocation ();
+ Event event = new Event ();
+ event.x = pt.x;
+ event.y = pt.y;
+ browser.notifyListeners (SWT.MenuDetect, event);
+ if (!event.doit) {
+ // Do not display the menu
+ return 1;
+ }
+
+ Menu menu = browser.getMenu ();
+ if (menu != null && !menu.isDisposed ()) {
+ if (pt.x != event.x || pt.y != event.y) {
+ menu.setLocation (event.x, event.y);
+ }
+ menu.setVisible (true);
+ // Do not display the webkit menu
+ return 1;
+ }
+ return 0;
+}
+
long /*int*/ webkit_populate_popup (long /*int*/ web_view, long /*int*/ webkit_menu) {
Point pt = browser.getDisplay ().getCursorLocation ();
Event event = new Event ();
@@ -1882,6 +2185,25 @@ long /*int*/ webkit_populate_popup (long /*int*/ web_view, long /*int*/ webkit_m
return 0;
}
+private void addRequestHeaders(long /*int*/ requestHeaders, String[] headers){
+ for (int i = 0; i < headers.length; i++) {
+ String current = headers[i];
+ if (current != null) {
+ int index = current.indexOf (':');
+ if (index != -1) {
+ String key = current.substring (0, index).trim ();
+ String value = current.substring (index + 1).trim ();
+ if (key.length () > 0 && value.length () > 0) {
+ byte[] nameBytes = Converter.wcsToMbcs (null, key, true);
+ byte[] valueBytes = Converter.wcsToMbcs (null, value, true);
+ WebKitGTK.soup_message_headers_append (requestHeaders, nameBytes, valueBytes);
+ }
+ }
+ }
+ }
+
+}
+
long /*int*/ webkit_resource_request_starting (long /*int*/ web_view, long /*int*/ web_frame, long /*int*/ web_resource, long /*int*/ request, long /*int*/ response) {
if (postData != null || headers != null) {
long /*int*/ message = WebKitGTK.webkit_network_request_get_message (request);
@@ -1890,6 +2212,7 @@ long /*int*/ webkit_resource_request_starting (long /*int*/ web_view, long /*int
postData = null;
} else {
if (postData != null) {
+ // Set the message method type to POST
WebKitGTK.SoupMessage_method (message, PostString);
long /*int*/ body = WebKitGTK.SoupMessage_request_body (message);
byte[] bytes = Converter.wcsToMbcs (null, postData, false);
@@ -1921,21 +2244,7 @@ long /*int*/ webkit_resource_request_starting (long /*int*/ web_view, long /*int
/* headers */
long /*int*/ requestHeaders = WebKitGTK.SoupMessage_request_headers (message);
- for (int i = 0; i < headers.length; i++) {
- String current = headers[i];
- if (current != null) {
- int index = current.indexOf (':');
- if (index != -1) {
- String key = current.substring (0, index).trim ();
- String value = current.substring (index + 1).trim ();
- if (key.length () > 0 && value.length () > 0) {
- byte[] nameBytes = Converter.wcsToMbcs (null, key, true);
- byte[] valueBytes = Converter.wcsToMbcs (null, value, true);
- WebKitGTK.soup_message_headers_append (requestHeaders, nameBytes, valueBytes);
- }
- }
- }
- }
+ addRequestHeaders(requestHeaders, headers);
headers = null;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
index ceac579..b141964 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
@@ -33,27 +33,52 @@ public class WebKitGTK extends C {
public static final int WEBKIT_LOAD_COMMITTED = 1;
public static final int WEBKIT_LOAD_FINISHED = 2;
+ public static final int WEBKIT2_LOAD_STARTED = 0;
+ public static final int WEBKIT2_LOAD_REDIRECTED = 1;
+ public static final int WEBKIT2_LOAD_COMMITTED = 2;
+ public static final int WEBKIT2_LOAD_FINISHED = 3;
+
+ public static final int WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION = 0;
+ public static final int WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION = 1;
+ public static final int WEBKIT_POLICY_DECISION_TYPE_RESPONSE = 2;
+
+ public static final int WEBKIT_CREDENTIAL_PERSISTENCE_NONE = 0;
+ public static final int WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION = 1;
+ public static final int WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT = 2;
+
/** Signals */
public static final byte[] authenticate = ascii ("authenticate"); // $NON-NLS-1$
public static final byte[] close_web_view = ascii ("close-web-view"); // $NON-NLS-1$
public static final byte[] console_message = ascii ("console-message"); // $NON-NLS-1$
+ public static final byte[] context_menu = ascii ("context-menu"); // $NON-NLS-1$
+ public static final byte[] close = ascii ("close"); // $NON-NLS-1$
+ public static final byte[] create = ascii ("create"); // $NON-NLS-1$
public static final byte[] create_web_view = ascii ("create-web-view"); // $NON-NLS-1$
+ public static final byte[] decide_policy = ascii ("decide-policy"); // $NON-NLS-1$
public static final byte[] download_requested = ascii ("download-requested"); // $NON-NLS-1$
+ public static final byte[] download_started = ascii ("download-started"); // $NON-NLS-1$
public static final byte[] hovering_over_link = ascii ("hovering-over-link"); // $NON-NLS-1$
+ public static final byte[] load_changed = ascii ("load-changed"); // $NON-NLS-1$
public static final byte[] mime_type_policy_decision_requested = ascii ("mime-type-policy-decision-requested"); // $NON-NLS-1$
+ public static final byte[] mouse_target_changed = ascii ("mouse-target-changed"); // $NON-NLS-1$
public static final byte[] navigation_policy_decision_requested = ascii ("navigation-policy-decision-requested"); // $NON-NLS-1$
public static final byte[] notify_load_status = ascii ("notify::load-status"); // $NON-NLS-1$
public static final byte[] notify_progress = ascii ("notify::progress"); // $NON-NLS-1$
+ public static final byte[] notify_estimated_load_progress = ascii ("notify::estimated-load-progress"); // $NON-NLS-1$
public static final byte[] notify_title = ascii ("notify::title"); // $NON-NLS-1$
public static final byte[] populate_popup = ascii ("populate-popup"); // $NON-NLS-1$
- public static final byte[] resource_request_starting = ascii ("resource_request_starting"); // $NON-NLS-1$
+ public static final byte[] resource_request_starting = ascii ("resource-request-starting"); // $NON-NLS-1$
+ public static final byte[] resource_load_started = ascii ("resource-load-started"); // $NON-NLS-1$
public static final byte[] status_bar_text_changed = ascii ("status-bar-text-changed"); // $NON-NLS-1$
public static final byte[] web_view_ready = ascii ("web-view-ready"); // $NON-NLS-1$
+ public static final byte[] ready_to_show = ascii ("ready-to-show"); // $NON-NLS-1$
public static final byte[] window_object_cleared = ascii ("window-object-cleared"); // $NON-NLS-1$
/** Properties */
public static final byte[] default_encoding = ascii ("default-encoding"); // $NON-NLS-1$
+ public static final byte[] default_charset = ascii ("default-charset"); // $NON-NLS-1$
public static final byte[] enable_scripts = ascii ("enable-scripts"); // $NON-NLS-1$
+ public static final byte[] enable_plugins = ascii("enable-plugins");
public static final byte[] enable_universal_access_from_file_uris = ascii ("enable-universal-access-from-file-uris"); // $NON-NLS-1$
public static final byte[] height = ascii ("height"); // $NON-NLS-1$
public static final byte[] javascript_can_open_windows_automatically = ascii ("javascript-can-open-windows-automatically"); // $NON-NLS-1$
@@ -600,6 +625,62 @@ public static final long /*int*/ soup_uri_to_string (long /*int*/ uri, int just_
/* --------------------- start WebKitGTK natives --------------------- */
/** @method flags=dynamic */
+public static final native void _webkit_authentication_request_authenticate (long /*int*/ request, long /*int*/ credential);
+public static final void webkit_authentication_request_authenticate (long /*int*/ request, long /*int*/ credential) {
+ lock.lock();
+ try {
+ _webkit_authentication_request_authenticate (request, credential);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native void _webkit_authentication_request_cancel (long /*int*/ request);
+public static final void webkit_authentication_request_cancel (long /*int*/ request) {
+ lock.lock();
+ try {
+ _webkit_authentication_request_cancel (request);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native boolean _webkit_authentication_request_is_retry (long /*int*/ request);
+public static final boolean webkit_authentication_request_is_retry (long /*int*/ request) {
+ lock.lock();
+ try {
+ return _webkit_authentication_request_is_retry (request);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native void _webkit_credential_free (long /*int*/ credential);
+public static final void webkit_credential_free (long /*int*/ credential) {
+ lock.lock();
+ try {
+ _webkit_credential_free (credential);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_credential_new (byte[] username, byte[] password, int persistence);
+public static final long /*int*/ webkit_credential_new (byte[] username, byte[] password, int persistence) {
+ lock.lock();
+ try {
+ return _webkit_credential_new (username, password, persistence);
+ } finally {
+ lock.unlock();
+ }
+}
+
+
+/** @method flags=dynamic */
public static final native int _webkit_dom_event_target_add_event_listener (long /*int*/ target, byte[] name, long /*int*/ handler, int bubble, long /*int*/ userData);
public static final int webkit_dom_event_target_add_event_listener (long /*int*/ target, byte[] name, long /*int*/ handler, int bubble, long /*int*/ userData) {
lock.lock();
@@ -864,6 +945,39 @@ public static final long /*int*/ webkit_get_favicon_database () {
}
/** @method flags=dynamic */
+public static final native boolean _webkit_hit_test_result_context_is_link (long /*int*/ hit_test_result);
+public static final boolean webkit_hit_test_result_context_is_link (long /*int*/ hit_test_result) {
+ lock.lock();
+ try {
+ return _webkit_hit_test_result_context_is_link (hit_test_result);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long _webkit_hit_test_result_get_link_uri (long /*int*/ hit_test_result);
+public static final long webkit_hit_test_result_get_link_uri (long /*int*/ hit_test_result) {
+ lock.lock();
+ try {
+ return _webkit_hit_test_result_get_link_uri (hit_test_result);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long _webkit_hit_test_result_get_link_title (long /*int*/ hit_test_result);
+public static final long webkit_hit_test_result_get_link_title (long /*int*/ hit_test_result) {
+ lock.lock();
+ try {
+ return _webkit_hit_test_result_get_link_title (hit_test_result);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native int _webkit_major_version ();
public static final int webkit_major_version () {
lock.lock();
@@ -875,6 +989,17 @@ public static final int webkit_major_version () {
}
/** @method flags=dynamic */
+public static final native int _webkit_get_major_version ();
+public static final int webkit_get_major_version () {
+ lock.lock();
+ try {
+ return _webkit_get_major_version ();
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native int _webkit_micro_version ();
public static final int webkit_micro_version () {
lock.lock();
@@ -886,6 +1011,17 @@ public static final int webkit_micro_version () {
}
/** @method flags=dynamic */
+public static final native int _webkit_get_micro_version ();
+public static final int webkit_get_micro_version () {
+ lock.lock();
+ try {
+ return _webkit_get_micro_version ();
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native int _webkit_minor_version ();
public static final int webkit_minor_version () {
lock.lock();
@@ -897,6 +1033,28 @@ public static final int webkit_minor_version () {
}
/** @method flags=dynamic */
+public static final native int _webkit_get_minor_version ();
+public static final int webkit_get_minor_version () {
+ lock.lock();
+ try {
+ return _webkit_get_minor_version ();
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_navigation_policy_decision_get_request (long /*int*/ decision);
+public static final long /*int*/ webkit_navigation_policy_decision_get_request (long /*int*/ decision) {
+ lock.lock();
+ try {
+ return _webkit_navigation_policy_decision_get_request (decision);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native long /*int*/ _webkit_network_request_get_message (long /*int*/ request);
public static final long /*int*/ webkit_network_request_get_message (long /*int*/ request) {
lock.lock();
@@ -930,6 +1088,28 @@ public static final long /*int*/ webkit_network_request_new (byte[] uri) {
}
/** @method flags=dynamic */
+public static final native void _webkit_policy_decision_download (long /*int*/ decision);
+public static final void webkit_policy_decision_download (long /*int*/ decision) {
+ lock.lock();
+ try {
+ _webkit_policy_decision_download (decision);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native void _webkit_policy_decision_ignore (long /*int*/ decision);
+public static final void webkit_policy_decision_ignore (long /*int*/ decision) {
+ lock.lock();
+ try {
+ _webkit_policy_decision_ignore (decision);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native long /*int*/ _webkit_soup_auth_dialog_get_type ();
public static final long /*int*/ webkit_soup_auth_dialog_get_type () {
lock.lock();
@@ -941,6 +1121,29 @@ public static final long /*int*/ webkit_soup_auth_dialog_get_type () {
}
/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_web_context_get_default ();
+public static final long /*int*/ webkit_web_context_get_default () {
+ lock.lock();
+ try {
+ return _webkit_web_context_get_default ();
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_web_context_set_favicon_database_directory (long /*int*/ context, long /*int*/ path);
+public static final long /*int*/ webkit_web_context_set_favicon_database_directory (long /*int*/ context, long /*int*/ path) {
+ lock.lock();
+ try {
+ return _webkit_web_context_set_favicon_database_directory (context, path);
+ } finally {
+ lock.unlock();
+ }
+}
+
+
+/** @method flags=dynamic */
public static final native long /*int*/ _webkit_web_data_source_get_data (long /*int*/ data_source);
public static final long /*int*/ webkit_web_data_source_get_data (long /*int*/ data_source) {
lock.lock();
@@ -1128,6 +1331,17 @@ public static final long /*int*/ webkit_web_view_get_dom_document (long /*int*/
}
/** @method flags=dynamic */
+public static final native double /*int*/ _webkit_web_view_get_estimated_load_progress (long /*int*/ web_view);
+public static final double /*int*/ webkit_web_view_get_estimated_load_progress (long /*int*/ web_view) {
+ lock.lock();
+ try {
+ return _webkit_web_view_get_estimated_load_progress (web_view);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native int _webkit_web_view_get_load_status (long /*int*/ web_view);
public static final int webkit_web_view_get_load_status (long /*int*/ web_view) {
lock.lock();
@@ -1238,6 +1452,17 @@ public static final void webkit_web_view_go_forward (long /*int*/ web_view) {
}
/** @method flags=dynamic */
+public static final native void _webkit_web_view_load_html (long /*int*/ web_view, byte[] content, byte[] base_uri);
+public static final void webkit_web_view_load_html (long /*int*/ web_view, byte[] content, byte[] base_uri) {
+ lock.lock();
+ try {
+ _webkit_web_view_load_html (web_view, content, base_uri);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native void _webkit_web_view_load_string (long /*int*/ web_view, byte[] content, byte[] mime_type, byte[] encoding, byte[] base_uri);
public static final void webkit_web_view_load_string (long /*int*/ web_view, byte[] content, byte[] mime_type, byte[] encoding, byte[] base_uri) {
lock.lock();
@@ -1249,6 +1474,17 @@ public static final void webkit_web_view_load_string (long /*int*/ web_view, byt
}
/** @method flags=dynamic */
+public static final native void _webkit_web_view_load_request (long /*int*/ web_view, long /*int*/ request);
+public static final void webkit_web_view_load_request (long /*int*/ web_view, long /*int*/ request) {
+ lock.lock();
+ try {
+ _webkit_web_view_load_request (web_view, request);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native void _webkit_web_view_load_uri (long /*int*/ web_view, byte[] uri);
public static final void webkit_web_view_load_uri (long /*int*/ web_view, byte[] uri) {
lock.lock();
@@ -1282,6 +1518,17 @@ public static final void webkit_web_view_reload (long /*int*/ web_view) {
}
/** @method flags=dynamic */
+public static final native void _webkit_web_view_run_javascript (long /*int*/ web_view, long /*int*/ script, long /*int*/ cancellable, long /*int*/ callback, long /*int*/ user_data);
+public static final void webkit_web_view_run_javascript (long /*int*/ web_view, long /*int*/ script, long /*int*/ cancellable, long /*int*/ callback, long /*int*/ user_data) {
+ lock.lock();
+ try {
+ _webkit_web_view_run_javascript (web_view, script, cancellable, callback, user_data);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native void _webkit_web_view_stop_loading (long /*int*/ web_view);
public static final void webkit_web_view_stop_loading (long /*int*/ web_view) {
lock.lock();
@@ -1292,6 +1539,72 @@ public static final void webkit_web_view_stop_loading (long /*int*/ web_view) {
}
}
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_response_policy_decision_get_request (long /*int*/ decision);
+public static final long /*int*/ webkit_response_policy_decision_get_request (long /*int*/ decision) {
+ lock.lock();
+ try {
+ return _webkit_response_policy_decision_get_request (decision);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_response_policy_decision_get_response (long /*int*/ decision);
+public static final long /*int*/ webkit_response_policy_decision_get_response (long /*int*/ decision) {
+ lock.lock();
+ try {
+ return _webkit_response_policy_decision_get_response (decision);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_uri_request_new (byte[] uri);
+public static final long /*int*/ webkit_uri_request_new (byte[] uri) {
+ lock.lock();
+ try {
+ return _webkit_uri_request_new (uri);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_uri_request_get_http_headers (long /*int*/ request);
+public static final long /*int*/ webkit_uri_request_get_http_headers (long /*int*/ request) {
+ lock.lock();
+ try {
+ return _webkit_uri_request_get_http_headers (request);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_uri_request_get_uri (long /*int*/ request);
+public static final long /*int*/ webkit_uri_request_get_uri (long /*int*/ request) {
+ lock.lock();
+ try {
+ return _webkit_uri_request_get_uri (request);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_uri_response_get_mime_type (long /*int*/ responce);
+public static final long /*int*/ webkit_uri_response_get_mime_type (long /*int*/ response) {
+ lock.lock();
+ try {
+ return _webkit_uri_response_get_mime_type (response);
+ } finally {
+ lock.unlock();
+ }
+}
+
/* --------------------- start SWT natives --------------------- */
public static final native int JSClassDefinition_sizeof ();