Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2013-06-25 16:37:52 +0000
committerGrant Gayed2013-06-25 16:37:52 +0000
commita59b6fabc99a8df2b83df5400ce5a7fa2acc24a3 (patch)
treeab822db1c548995411a5c3fb9ce945c807f48058
parent8c4c9f977636102945c1cc11875675a2b5dbdcd5 (diff)
downloadeclipse.platform.swt-a59b6fabc99a8df2b83df5400ce5a7fa2acc24a3.tar.gz
eclipse.platform.swt-a59b6fabc99a8df2b83df5400ce5a7fa2acc24a3.tar.xz
eclipse.platform.swt-a59b6fabc99a8df2b83df5400ce5a7fa2acc24a3.zip
Bug 178918 - Flexible Mozilla profile support - new API request
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java2
3 files changed, 17 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java
index dd8e286ae5..6fcb469cca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java
@@ -30,6 +30,7 @@ class AppFileLocProvider {
static final String HISTORY_FILE = "history.dat"; //$NON-NLS-1$
static final String LOCALSTORE_FILE = "localstore.rdf"; //$NON-NLS-1$
static final String MIMETYPES_FILE = "mimeTypes.rdf"; //$NON-NLS-1$
+ static final String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$
static final String PLUGINS_DIR = "plugins"; //$NON-NLS-1$
static final String USER_PLUGINS_DIR = ".mozilla" + SEPARATOR_OS + "plugins"; //$NON-NLS-1$ //$NON-NLS-2$
static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$
@@ -154,7 +155,7 @@ int getFiles (long /*int*/ prop, long /*int*/ _retval) {
if (pluginDirs == null) {
int index = 0;
/* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */
- long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_PLUGIN_PATH, true));
+ long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, MOZILLA_PLUGIN_PATH, true));
if (ptr != 0) {
int length = C.strlen (ptr);
byte[] buffer = new byte[length];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
index 5a18a2dd5a..e881e49088 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
@@ -89,6 +89,8 @@ class Mozilla extends WebBrowser {
static final String HEADER_CONTENTLENGTH = "content-length"; //$NON-NLS-1
static final String HEADER_CONTENTTYPE = "content-type"; //$NON-NLS-1
static final String MIMETYPE_FORMURLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
+ static final String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$
+ static final String MOZILLA_PROFILE_PATH = "MOZ_PROFILE_PATH"; //$NON-NLS-1$
static final String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$
static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
static final String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$
@@ -633,7 +635,7 @@ static void LoadLibraries () {
if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + MozillaPath); //$NON-NLS-1$
/* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */
- long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
+ long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, MOZILLA_FIVE_HOME, true));
if (ptr == 0) {
IsXULRunner = false;
} else {
@@ -703,7 +705,17 @@ public void create (Composite parent, int style) {
if (!Initialized) {
/* create LocationProvider, which tells mozilla where to find things on the file system */
- String profilePath = MozillaDelegate.getProfilePath ();
+ String profilePath = System.getProperty (MOZILLA_PROFILE_PATH);
+ if (profilePath != null && profilePath.length() > 0) {
+ /* ensure that client-supplied path is using correct separators */
+ if (SEPARATOR_OS == '/') {
+ profilePath = profilePath.replace ('\\', SEPARATOR_OS);
+ } else {
+ profilePath = profilePath.replace ('/', SEPARATOR_OS);
+ }
+ } else {
+ profilePath = MozillaDelegate.getProfilePath ();
+ }
String cacheParentPath = MozillaDelegate.getCacheParentPath ();
LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner);
LocationProvider.AddRef ();
@@ -1975,7 +1987,7 @@ void initJavaXPCOM (String mozillaPath) {
String initMozilla (String mozillaPath) {
/* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
- long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
+ long /*int*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, MOZILLA_FIVE_HOME, true));
if (ptr != 0) {
int length = C.strlen (ptr);
byte[] buffer = new byte[length];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
index 8beae68f0e..42e98cc651 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
@@ -31,8 +31,6 @@ import org.eclipse.swt.internal.*;
/** @jniclass flags=cpp */
public class XPCOM extends C {
- public static final String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$
- public static final String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$
public static final String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$
public static final String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$
public static final String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$

Back to the top