Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-07-12 16:14:54 -0400
committerEric Williams2018-08-14 10:51:19 -0400
commitf0fe56670826e5b46e2c9a52c132ec39f531e136 (patch)
treef6d509251f92ea8e583bd09986c1e0ec1ae88e17 /bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library
parentdfb0cb3dbe3b038908c695231ad8a8f200ee1500 (diff)
downloadeclipse.platform.swt-f0fe56670826e5b46e2c9a52c132ec39f531e136.tar.gz
eclipse.platform.swt-f0fe56670826e5b46e2c9a52c132ec39f531e136.tar.xz
eclipse.platform.swt-f0fe56670826e5b46e2c9a52c132ec39f531e136.zip
Bug 536141: [Webkit2][Gtk] BrowserFunction lost after page reload on
Linux/GTK The main cause of this bug is that web pages load too quickly -- by the time the BrowserFunctions are re-registered asynchronously from Java, the extension has loaded the page. BEFORE THIS PATCH: BrowserFunctions were registered asynchronously from Java into the web extension (C). This was done either at the outset (WebBrowser.createFunction()), or after every page load (Webkit.webkit_load_changed() callback). AFTER THIS PATCH: The fix is relatively straightforward, yet GDBus adds a lot of overhead. Instead of constantly registering BrowserFunctions from Java, we load them into the web extension on creation. This hands off the responsibility of re-registering BrowserFunctions to the web extension, which reduces overhead and ensures the functions are registered/executed before the page loads. The BrowserFunctions are stored at the C level in the extension, using a linked list. Whenever the "object-cleared" callback is triggered in the extension, the linked list is iterated over and any BrowserFunctions for that page are re-registered. Chronological ordering of information flow from SWT -> web extension via GDBus. 1) SWT Webkit class is loaded. SWT GDBus server is created. 2) SWT Webkit creates the extension, passing it the information of the SWT Webkit GDBus server. 3) The extension's initialization callback is called in C. 4) In this callback the extension contacts the SWT Webkit GDBus server and provides it with information such as its PID and name. 5) SWT Webkit acknowledges this information, and sends back any BrowserFunctions that were created before the extension loaded. 6) The extension adds these BrowserFunctions to its linked list. 7) Any subsequent BrowserFunctions are added to the extension's linked list by calling the extension's GDBus server synchronously. In the event of a GDBus timeout (happens sometimes when running tests), the GDBus call is made asynchronously. This functionality can be tested with the attached snippet. AllBrowserTests pass without issue, and there are no visible Browser issues in the IDE. The plugin attached to the initial bug report is now functional. Change-Id: Iddc5f2e69f0a7fd4500bd8228f0bc46c4b3a6322 Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c169
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h11
4 files changed, 192 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 08e24009d6..596c69a177 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -16235,6 +16235,91 @@ fail:
}
#endif
+#ifndef NO__1g_1dbus_1proxy_1call
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1dbus_1proxy_1call)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jint arg3, jint arg4, jintLong arg5, jintLong arg6, jintLongArray arg7)
+{
+ jbyte *lparg1=NULL;
+ jintLong *lparg7=NULL;
+ OS_NATIVE_ENTER(env, that, _1g_1dbus_1proxy_1call_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg7) if ((lparg7 = (*env)->GetIntLongArrayElements(env, arg7, NULL)) == NULL) goto fail;
+/*
+ g_dbus_proxy_call((GDBusProxy *)arg0, (const gchar *)lparg1, (GVariant *)arg2, arg3, arg4, (GCancellable *)arg5, arg6, (GError **)lparg7);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, g_dbus_proxy_call)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GDBusProxy *, const gchar *, GVariant *, jint, jint, GCancellable *, jintLong, GError **))fp)((GDBusProxy *)arg0, (const gchar *)lparg1, (GVariant *)arg2, arg3, arg4, (GCancellable *)arg5, arg6, (GError **)lparg7);
+ }
+ }
+fail:
+ if (arg7 && lparg7) (*env)->ReleaseIntLongArrayElements(env, arg7, lparg7, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1dbus_1proxy_1call_FUNC);
+}
+#endif
+
+#ifndef NO__1g_1dbus_1proxy_1call_1finish
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1dbus_1proxy_1call_1finish)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2)
+{
+ jintLong *lparg2=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1dbus_1proxy_1call_1finish_FUNC);
+ if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ rc = (jintLong)g_dbus_proxy_call_finish((GDBusProxy *)arg0, (GAsyncResult *)arg1, (GError **)lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1dbus_1proxy_1call_1finish_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1dbus_1proxy_1call_1sync
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1dbus_1proxy_1call_1sync)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jint arg3, jint arg4, jintLong arg5, jintLongArray arg6)
+{
+ jbyte *lparg1=NULL;
+ jintLong *lparg6=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1dbus_1proxy_1call_1sync_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg6) if ((lparg6 = (*env)->GetIntLongArrayElements(env, arg6, NULL)) == NULL) goto fail;
+ rc = (jintLong)g_dbus_proxy_call_sync((GDBusProxy *)arg0, (const gchar *)lparg1, (GVariant *)arg2, arg3, arg4, (GCancellable *)arg5, (GError **)lparg6);
+fail:
+ if (arg6 && lparg6) (*env)->ReleaseIntLongArrayElements(env, arg6, lparg6, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1dbus_1proxy_1call_1sync_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1dbus_1proxy_1new_1for_1bus_1sync
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1dbus_1proxy_1new_1for_1bus_1sync)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jintLong arg2, jbyteArray arg3, jbyteArray arg4, jbyteArray arg5, jintLong arg6, jintLongArray arg7)
+{
+ jbyte *lparg3=NULL;
+ jbyte *lparg4=NULL;
+ jbyte *lparg5=NULL;
+ jintLong *lparg7=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1dbus_1proxy_1new_1for_1bus_1sync_FUNC);
+ if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail;
+ if (arg7) if ((lparg7 = (*env)->GetIntLongArrayElements(env, arg7, NULL)) == NULL) goto fail;
+ rc = (jintLong)g_dbus_proxy_new_for_bus_sync(arg0, arg1, (GDBusInterfaceInfo *)arg2, (const gchar *)lparg3, (const gchar *)lparg4, (const gchar *)lparg5, (GCancellable *)arg6, (GError **)lparg7);
+fail:
+ if (arg7 && lparg7) (*env)->ReleaseIntLongArrayElements(env, arg7, lparg7, 0);
+ if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
+ if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1dbus_1proxy_1new_1for_1bus_1sync_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1error_1free
JNIEXPORT void JNICALL OS_NATIVE(_1g_1error_1free)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -17970,6 +18055,50 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1value_1peek_1pointer)
}
#endif
+#ifndef NO__1g_1variant_1builder_1add_1value
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1variant_1builder_1add_1value)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1builder_1add_1value_FUNC);
+ g_variant_builder_add_value((GVariantBuilder *)arg0, (GVariant *)arg1);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1builder_1add_1value_FUNC);
+}
+#endif
+
+#ifndef NO__1g_1variant_1builder_1end
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1builder_1end)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1builder_1end_FUNC);
+ rc = (jintLong)g_variant_builder_end((GVariantBuilder *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1builder_1end_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1variant_1builder_1new
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1builder_1new)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1builder_1new_FUNC);
+ rc = (jintLong)g_variant_builder_new((const GVariantType *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1builder_1new_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1variant_1builder_1unref
+JNIEXPORT void JNICALL OS_NATIVE(_1g_1variant_1builder_1unref)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1builder_1unref_FUNC);
+ g_variant_builder_unref((GVariantBuilder *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1builder_1unref_FUNC);
+}
+#endif
+
#ifndef NO__1g_1variant_1get_1boolean
JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1variant_1get_1boolean)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -18070,6 +18199,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1get_1type_1string)
}
#endif
+#ifndef NO__1g_1variant_1get_1uint64
+JNIEXPORT jlong JNICALL OS_NATIVE(_1g_1variant_1get_1uint64)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jlong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1get_1uint64_FUNC);
+ rc = (jlong)g_variant_get_uint64((GVariant *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1get_1uint64_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1variant_1is_1of_1type
JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1variant_1is_1of_1type)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
@@ -18178,6 +18319,34 @@ fail:
}
#endif
+#ifndef NO__1g_1variant_1new_1uint64
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1new_1uint64)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1new_1uint64_FUNC);
+ rc = (jintLong)g_variant_new_uint64(arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1new_1uint64_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1g_1variant_1type_1new
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1type_1new)
+ (JNIEnv *env, jclass that, jbyteArray arg0)
+{
+ jbyte *lparg0=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1type_1new_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ rc = (jintLong)g_variant_type_new((const gchar *)lparg0);
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1type_1new_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1getpid
JNIEXPORT jint JNICALL OS_NATIVE(_1getpid)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index bcce6b32a0..9ccc85811c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -67,6 +67,7 @@
#define g_thread_init_LIB LIB_GTHREAD
#define ubuntu_menu_proxy_get_LIB LIB_GTK
#define FcConfigAppFontAddFile_LIB LIB_FONTCONFIG
+#define g_dbus_proxy_call_LIB LIB_GLIB
// GTK3 only
#define g_bytes_new_LIB LIB_GLIB
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index d5e53977d1..6491dd15eb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -1333,6 +1333,10 @@ char * OS_nativeFunctionNames[] = {
"_1g_1dbus_1method_1invocation_1return_1value",
"_1g_1dbus_1node_1info_1lookup_1interface",
"_1g_1dbus_1node_1info_1new_1for_1xml",
+ "_1g_1dbus_1proxy_1call",
+ "_1g_1dbus_1proxy_1call_1finish",
+ "_1g_1dbus_1proxy_1call_1sync",
+ "_1g_1dbus_1proxy_1new_1for_1bus_1sync",
"_1g_1error_1free",
"_1g_1error_1get_1message",
"_1g_1file_1get_1uri",
@@ -1513,6 +1517,10 @@ char * OS_nativeFunctionNames[] = {
"_1g_1utf8_1to_1utf16___3BJ_3J_3J_3J",
#endif
"_1g_1value_1peek_1pointer",
+ "_1g_1variant_1builder_1add_1value",
+ "_1g_1variant_1builder_1end",
+ "_1g_1variant_1builder_1new",
+ "_1g_1variant_1builder_1unref",
"_1g_1variant_1get_1boolean",
"_1g_1variant_1get_1byte",
"_1g_1variant_1get_1child_1value",
@@ -1521,6 +1529,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1variant_1get_1string",
"_1g_1variant_1get_1type",
"_1g_1variant_1get_1type_1string",
+ "_1g_1variant_1get_1uint64",
"_1g_1variant_1is_1of_1type",
"_1g_1variant_1n_1children",
"_1g_1variant_1new_1boolean",
@@ -1529,6 +1538,8 @@ char * OS_nativeFunctionNames[] = {
"_1g_1variant_1new_1int32",
"_1g_1variant_1new_1string",
"_1g_1variant_1new_1tuple",
+ "_1g_1variant_1new_1uint64",
+ "_1g_1variant_1type_1new",
"_1gdk_1keymap_1translate_1keyboard_1state",
"_1getpid",
"_1glib_1major_1version",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index fd55aea6d2..70894d8d40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1319,6 +1319,10 @@ typedef enum {
_1g_1dbus_1method_1invocation_1return_1value_FUNC,
_1g_1dbus_1node_1info_1lookup_1interface_FUNC,
_1g_1dbus_1node_1info_1new_1for_1xml_FUNC,
+ _1g_1dbus_1proxy_1call_FUNC,
+ _1g_1dbus_1proxy_1call_1finish_FUNC,
+ _1g_1dbus_1proxy_1call_1sync_FUNC,
+ _1g_1dbus_1proxy_1new_1for_1bus_1sync_FUNC,
_1g_1error_1free_FUNC,
_1g_1error_1get_1message_FUNC,
_1g_1file_1get_1uri_FUNC,
@@ -1499,6 +1503,10 @@ typedef enum {
_1g_1utf8_1to_1utf16___3BJ_3J_3J_3J_FUNC,
#endif
_1g_1value_1peek_1pointer_FUNC,
+ _1g_1variant_1builder_1add_1value_FUNC,
+ _1g_1variant_1builder_1end_FUNC,
+ _1g_1variant_1builder_1new_FUNC,
+ _1g_1variant_1builder_1unref_FUNC,
_1g_1variant_1get_1boolean_FUNC,
_1g_1variant_1get_1byte_FUNC,
_1g_1variant_1get_1child_1value_FUNC,
@@ -1507,6 +1515,7 @@ typedef enum {
_1g_1variant_1get_1string_FUNC,
_1g_1variant_1get_1type_FUNC,
_1g_1variant_1get_1type_1string_FUNC,
+ _1g_1variant_1get_1uint64_FUNC,
_1g_1variant_1is_1of_1type_FUNC,
_1g_1variant_1n_1children_FUNC,
_1g_1variant_1new_1boolean_FUNC,
@@ -1515,6 +1524,8 @@ typedef enum {
_1g_1variant_1new_1int32_FUNC,
_1g_1variant_1new_1string_FUNC,
_1g_1variant_1new_1tuple_FUNC,
+ _1g_1variant_1new_1uint64_FUNC,
+ _1g_1variant_1type_1new_FUNC,
_1gdk_1keymap_1translate_1keyboard_1state_FUNC,
_1getpid_FUNC,
_1glib_1major_1version_FUNC,

Back to the top