From 76d7d429442fe73692a90b1854cf0455cb3d83fa Mon Sep 17 00:00:00 2001 From: Grant Gayed Date: Tue, 25 Jun 2013 11:46:25 -0400 Subject: Bug 400626 - Crash webkitWebViewRegisterForIconNotification --- .../Eclipse SWT WebKit/gtk/library/webkitgtk.c | 40 +++++++++++++++++++++- .../gtk/library/webkitgtk_stats.c | 4 ++- .../gtk/library/webkitgtk_stats.h | 4 ++- .../gtk/org/eclipse/swt/browser/WebKit.java | 11 ++++++ .../org/eclipse/swt/internal/webkit/WebKitGTK.java | 22 ++++++++++++ 5 files changed, 78 insertions(+), 3 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 bc1a839c5a..6eab165bee 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 2013 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 @@ -1460,6 +1460,24 @@ JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1download_1start) } #endif +#ifndef NO__1webkit_1favicon_1database_1set_1path +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1favicon_1database_1set_1path) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1favicon_1database_1set_1path_FUNC); +/* + webkit_favicon_database_set_path(arg0, arg1); +*/ + { + WebKitGTK_LOAD_FUNCTION(fp, webkit_favicon_database_set_path) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1); + } + } + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1favicon_1database_1set_1path_FUNC); +} +#endif + #ifndef NO__1webkit_1get_1default_1session JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1get_1default_1session) (JNIEnv *env, jclass that) @@ -1480,6 +1498,26 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1get_1default_1session) } #endif +#ifndef NO__1webkit_1get_1favicon_1database +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1get_1favicon_1database) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1get_1favicon_1database_FUNC); +/* + rc = (jintLong)webkit_get_favicon_database(); +*/ + { + WebKitGTK_LOAD_FUNCTION(fp, webkit_get_favicon_database) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1get_1favicon_1database_FUNC); + return rc; +} +#endif + #ifndef NO__1webkit_1major_1version JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1major_1version) (JNIEnv *env, jclass that) 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 c0d22658fc..5b59ba12e3 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 2013 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 @@ -91,7 +91,9 @@ char * WebKitGTK_nativeFunctionNames[] = { "_1webkit_1download_1new", "_1webkit_1download_1set_1destination_1uri", "_1webkit_1download_1start", + "_1webkit_1favicon_1database_1set_1path", "_1webkit_1get_1default_1session", + "_1webkit_1get_1favicon_1database", "_1webkit_1major_1version", "_1webkit_1micro_1version", "_1webkit_1minor_1version", 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 8056ac9d08..c5771a66cf 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 2013 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 @@ -101,7 +101,9 @@ typedef enum { _1webkit_1download_1new_FUNC, _1webkit_1download_1set_1destination_1uri_FUNC, _1webkit_1download_1start_FUNC, + _1webkit_1favicon_1database_1set_1path_FUNC, _1webkit_1get_1default_1session_FUNC, + _1webkit_1get_1favicon_1database_FUNC, _1webkit_1major_1version_FUNC, _1webkit_1micro_1version_FUNC, _1webkit_1minor_1version_FUNC, 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 f253856721..fa826ecfe9 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 @@ -665,6 +665,17 @@ public void create (Composite parent, int style) { size.x -= minSize.width; size.y -= minSize.height; browser.setSize (size); } + + /* + * WebKitGTK version 1.10.x, and possibly other versions as well, crash + * sporadically in webkitWebViewRegisterForIconNotification(). Work + * around this crash by disabling WebKit's icon database, which is fine + * to do since the Browser does not make use of it in any way. + */ + long /*int*/ database = WebKitGTK.webkit_get_favicon_database (); + if (database != 0) { + WebKitGTK.webkit_favicon_database_set_path (database, 0); + } } void addEventHandlers (long /*int*/ web_view, boolean top) { 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 029041b089..ceac57968b 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 @@ -830,6 +830,17 @@ public static final void webkit_download_start (long /*int*/ download) { } } +/** @method flags=dynamic */ +public static final native void _webkit_favicon_database_set_path (long /*int*/ database, long /*int*/ path); +public static final void webkit_favicon_database_set_path (long /*int*/ database, long /*int*/ path) { + lock.lock(); + try { + _webkit_favicon_database_set_path (database, path); + } finally { + lock.unlock(); + } +} + /** @method flags=dynamic */ public static final native long /*int*/ _webkit_get_default_session (); public static final long /*int*/ webkit_get_default_session () { @@ -841,6 +852,17 @@ public static final long /*int*/ webkit_get_default_session () { } } +/** @method flags=dynamic */ +public static final native long /*int*/ _webkit_get_favicon_database (); +public static final long /*int*/ webkit_get_favicon_database () { + lock.lock(); + try { + return _webkit_get_favicon_database (); + } finally { + lock.unlock(); + } +} + /** @method flags=dynamic */ public static final native int _webkit_major_version (); public static final int webkit_major_version () { -- cgit