Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-07-28 16:09:03 -0400
committerAlexander Kurtakov2016-07-28 16:09:03 -0400
commitf13eef212dfebffe35da38a9b0f525b0474ffcd9 (patch)
treef5b31f4417c277ecf3597c04a93623af7d0b0ab5
parentdc8815d9555beb9ed272acb0814c86041366cea3 (diff)
downloadeclipse.platform.swt-f13eef212dfebffe35da38a9b0f525b0474ffcd9.tar.gz
eclipse.platform.swt-f13eef212dfebffe35da38a9b0f525b0474ffcd9.tar.xz
eclipse.platform.swt-f13eef212dfebffe35da38a9b0f525b0474ffcd9.zip
Bug 498829 - Load webkit2 so file if webkit 1.x is not available
When libwebkitgtk-3.0.so.0 can't be dlopen, try to dlopen libwebkit2gtk to run in webkit2 mode. As the SWT_WEBKIT2 env variable is not set in this case try calling webkit_get_major_version which is Webkit2 function and due to dlsym failing it will always return 0. If result is not 0 libwebkit2gtk so file was loaded as fallback. Change-Id: I5a7f66d2b122a5e2368b20bd6ed76b04e654643c Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java4
2 files changed, 7 insertions, 0 deletions
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 96a3bf0688..8621fef9c3 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
@@ -33,6 +33,9 @@
handle = dlopen("libwebkit2gtk-4.0.so.37", LOAD_FLAGS); /* webkit2 */ \
} else { \
handle = dlopen("libwebkitgtk-3.0.so.0", LOAD_FLAGS); /* webkitgtk >= 3.x lib */ \
+ if (!handle) { \
+ handle = dlopen("libwebkit2gtk-4.0.so.37", LOAD_FLAGS); /* webkit2 as machine doesn't have webkitgtk 3.x*/ \
+ } \
} \
} else { \
handle = dlopen("libwebkit-1.0.so.2", LOAD_FLAGS); /* webkitgtk 1.2.x lib */ \
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 42c7450bed..a4abe6e53f 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
@@ -112,6 +112,10 @@ class WebKit extends WebBrowser {
if (LibraryLoaded) {
String webkit2 = System.getenv("SWT_WEBKIT2"); // $NON-NLS-1$
+ int webkit2VersionFunction = WebKitGTK.webkit_get_major_version();
+ if (webkit2VersionFunction != 0) { // SWT_WEBKIT2 env variable is not set but webkit2 was loaded as fallback
+ webkit2 = "1";
+ }
WEBKIT2 = webkit2 != null && webkit2.equals("1") && OS.GTK3; // $NON-NLS-1$
WebViewType = WebKitGTK.webkit_web_view_get_type ();

Back to the top