diff options
author | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-04-02 10:23:56 -0400 |
---|---|---|
committer | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-04-02 10:25:38 -0400 |
commit | ff8ec8fc1484c7eedcc70981458ecc23d5a64f37 (patch) | |
tree | b7ca46329bd2fcaf36ada6d0289d180a15aca1d2 /bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk | |
parent | 3550033b997d0fa2bf95b0dc245702b98b5325bd (diff) | |
download | eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.tar.gz eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.tar.xz eclipse.platform.swt-ff8ec8fc1484c7eedcc70981458ecc23d5a64f37.zip |
Bug 327696 - implement support for xulrunner >= 4.0 (jemalloc workaround
for Linux)
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java index d61093ec56..afe1f0fd5a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.swt.browser; +import java.io.*; + import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.internal.*; @@ -111,13 +113,38 @@ static String getSWTInitLibraryName () { } static void loadAdditionalLibraries (String mozillaPath) { -// the following is intentionally commented + if (Mozilla.IsPre_4) return; -// if (!Mozilla.IsPre_4) { -// System.loadLibrary ("swt-xulrunner10"); // get it extracted -// byte[] bytes = Converter.wcsToMbcs (null, /* path to libswt-xulrunner10.so */ "", true); //$NON-NLS-1$ -// OS.dlopen (bytes, OS.RTLD_NOW | OS.RTLD_GLOBAL); -// } + /* + * The use of the swt-xulrunner-fix library works around mozilla bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=720682 (XULRunner 10). + */ + String libName = "libswt-xulrunner-fix.so"; //$NON-NLS-1$ + File libsDir = new File (getProfilePath () + "/libs/" + Mozilla.OS() + '/' + Mozilla.Arch ()); //$NON-NLS-1$ + File file = new File (libsDir, libName); + java.io.InputStream is = Library.class.getResourceAsStream ('/' + libName); + if (is != null) { + if (!libsDir.exists ()) { + libsDir.mkdirs (); + } + int read; + byte [] buffer = new byte [4096]; + try { + FileOutputStream os = new FileOutputStream (file); + while ((read = is.read (buffer)) != -1) { + os.write(buffer, 0, read); + } + os.close (); + is.close (); + } catch (FileNotFoundException e) { + } catch (IOException e) { + } + } + + if (file.exists ()) { + byte[] bytes = Converter.wcsToMbcs (null, file.getAbsolutePath (), true); + OS.dlopen (bytes, OS.RTLD_NOW | OS.RTLD_GLOBAL); + } } static char[] mbcsToWcs (String codePage, byte [] buffer) { |