summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Mozilla
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2012-03-24 23:49:04 -0400
committerGrant Gayed <grant_gayed@ca.ibm.com>2012-03-24 23:49:04 -0400
commit925a13ca36585501cfd4633effa1686ff264daa0 (patch)
tree4e04b93b7e45e374c7c5dd8308f4ff854ddaf397 /bundles/org.eclipse.swt/Eclipse SWT Mozilla
parent6830930de71edad5f8649775f7895007a0d06f17 (diff)
downloadeclipse.platform.swt-925a13ca36585501cfd4633effa1686ff264daa0.tar.gz
eclipse.platform.swt-925a13ca36585501cfd4633effa1686ff264daa0.tar.xz
eclipse.platform.swt-925a13ca36585501cfd4633effa1686ff264daa0.zip
Bug 367216 - XulRunner leaves cache files in Roaming Profile (windows)
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Mozilla')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/MozillaDelegate.java46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/motif/org/eclipse/swt/browser/MozillaDelegate.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java33
7 files changed, 80 insertions, 53 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
index 29418234a4..88c2d85c48 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
@@ -41,6 +41,10 @@ static Browser findBrowser (int handle) {
return null;
}
+static String getCacheParentPath () {
+ return getProfilePath ();
+}
+
static String getLibraryName () {
return "libxpcom.dylib"; //$NON-NLS-1$
}
@@ -53,6 +57,11 @@ static String getJSLibraryName_Pre4 () {
return "libmozjs.dylib"; //$NON-NLS-1$
}
+static String getProfilePath () {
+ String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
+ return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
+}
+
static String getSWTInitLibraryName () {
return "swt-xulrunner"; //$NON-NLS-1$
}
@@ -248,11 +257,6 @@ int getHandle () {
return embedHandle;
}
-String getProfilePath () {
- String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
- return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-
void handleFocus () {
if (hasFocus) return;
hasFocus = true;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
index c230e3da8c..e891a89150 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
@@ -33,6 +33,10 @@ static Browser findBrowser (int /*long*/ handle) {
return (Browser)display.findWidget (handle);
}
+static String getCacheParentPath () {
+ return getProfilePath ();
+}
+
static String getJSLibraryName () {
return "libxpcom.dylib"; //$NON-NLS-1$
}
@@ -45,6 +49,11 @@ static String getLibraryName () {
return "libxpcom.dylib"; //$NON-NLS-1$
}
+static String getProfilePath () {
+ String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
+ return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
+}
+
static String getSWTInitLibraryName () {
return "swt-xulrunner"; //$NON-NLS-1$
}
@@ -125,11 +134,6 @@ int /*long*/ getHandle () {
return browser.view.id;
}
-String getProfilePath () {
- String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
- return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-
void handleFocus () {
if (hasFocus) return;
hasFocus = true;
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 7de3b85ba9..cb4b2d2955 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
@@ -20,7 +20,7 @@ class AppFileLocProvider {
XPCOMObject directoryServiceProvider;
XPCOMObject directoryServiceProvider2;
int refCount = 0;
- String mozillaPath, profilePath;
+ String mozillaPath, profilePath, cacheParentPath;
String[] pluginDirs;
boolean isXULRunner;
@@ -41,9 +41,10 @@ class AppFileLocProvider {
IsSparc = (osName.startsWith ("sunos") || osName.startsWith ("solaris")) && osArch.startsWith("sparc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-AppFileLocProvider (String mozillaPath, String profilePath, boolean isXULRunner) {
+AppFileLocProvider (String mozillaPath, String profilePath, String cacheParentPath, boolean isXULRunner) {
this.mozillaPath = mozillaPath + SEPARATOR_OS;
this.profilePath = profilePath + SEPARATOR_OS;
+ this.cacheParentPath = cacheParentPath;
this.isXULRunner = isXULRunner;
if (!Compatibility.fileExists (profilePath, "")) { //$NON-NLS-1$
int /*long*/[] result = new int /*long*/[1];
@@ -271,7 +272,7 @@ int getFile(int /*long*/ prop, int /*long*/ persistent, int /*long*/ _retval) {
} else if (propertyName.equals (XPCOM.NS_APP_LOCALSTORE_50_FILE)) {
propertyValue = profilePath + LOCALSTORE_FILE;
} else if (propertyName.equals (XPCOM.NS_APP_CACHE_PARENT_DIR)) {
- propertyValue = profilePath;
+ propertyValue = cacheParentPath;
} else if (propertyName.equals (XPCOM.NS_OS_HOME_DIR)) {
propertyValue = System.getProperty("user.home"); //$NON-NLS-1$
} else if (propertyName.equals (XPCOM.NS_OS_TEMP_DIR)) {
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 0a974224ea..135ced910d 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
@@ -689,8 +689,9 @@ public void create (Composite parent, int style) {
if (!Initialized) {
/* create LocationProvider, which tells mozilla where to find things on the file system */
- String profilePath = delegate.getProfilePath ();
- LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, IsXULRunner);
+ String profilePath = MozillaDelegate.getProfilePath ();
+ String cacheParentPath = MozillaDelegate.getCacheParentPath ();
+ LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner);
LocationProvider.AddRef ();
/* write external.xpt to the file system if needed */
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 59ee84bb5b..d61093ec56 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
@@ -69,6 +69,10 @@ static Browser findBrowser (int /*long*/ handle) {
return (Browser)display.findWidget (parent);
}
+static String getCacheParentPath () {
+ return getProfilePath ();
+}
+
static String getJSLibraryName () {
return "libxul.so"; //$NON-NLS-1$
}
@@ -81,6 +85,27 @@ static String getLibraryName () {
return "libxpcom.so"; //$NON-NLS-1$
}
+static String getProfilePath () {
+ String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
+
+ /*
+ * Bug in Sun JRE. Under some circumstances the value of java property "user.home" is
+ * "?", even when the HOME environment variable has a valid value. If this happens
+ * then attempt to read the value from the environment directly.
+ */
+ if (baseDir.equals ("?")) { //$NON-NLS-1$
+ int /*long*/ ptr = C.getenv (wcsToMbcs (null, "HOME", true)); //$NON-NLS-1$
+ if (ptr != 0) {
+ int length = C.strlen (ptr);
+ byte[] bytes = new byte[length];
+ C.memmove (bytes, ptr, length);
+ baseDir = new String (mbcsToWcs (null, bytes));
+ }
+ }
+
+ return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
+}
+
static String getSWTInitLibraryName () {
return "swt-xpcominit"; //$NON-NLS-1$
}
@@ -131,27 +156,6 @@ int /*long*/ getHandle () {
return embedHandle;
}
-String getProfilePath () {
- String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
-
- /*
- * Bug in Sun JRE. Under some circumstances the value of java property "user.home" is
- * "?", even when the HOME environment variable has a valid value. If this happens
- * then attempt to read the value from the environment directly.
- */
- if (baseDir.equals ("?")) { //$NON-NLS-1$
- int /*long*/ ptr = C.getenv (wcsToMbcs (null, "HOME", true)); //$NON-NLS-1$
- if (ptr != 0) {
- int length = C.strlen (ptr);
- byte[] bytes = new byte[length];
- C.memmove (bytes, ptr, length);
- baseDir = new String (mbcsToWcs (null, bytes));
- }
- }
-
- return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-
int /*long*/ gtk_event (int /*long*/ handle, int /*long*/ gdkEvent, int /*long*/ pointer) {
GdkEvent event = new GdkEvent ();
OS.memmove (event, gdkEvent, GdkEvent.sizeof);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/motif/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/motif/org/eclipse/swt/browser/MozillaDelegate.java
index a7c8a64f40..ebd5eb8f92 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/motif/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/motif/org/eclipse/swt/browser/MozillaDelegate.java
@@ -77,6 +77,10 @@ static Browser findBrowser (Control control, int gtkHandle) {
return null;
}
+static String getCacheParentPath () {
+ return getProfilePath ();
+}
+
static String getLibraryName () {
return "libxpcom.so"; //$NON-NLS-1$
}
@@ -89,6 +93,11 @@ static String getJSLibraryName_Pre4() {
return "libxpcom.so"; //$NON-NLS-1$
}
+static String getProfilePath () {
+ String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
+ return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
+}
+
static String getSWTInitLibraryName () {
return "swt-xpcominit"; //$NON-NLS-1$
}
@@ -142,11 +151,6 @@ int getHandle() {
return result;
}
-String getProfilePath () {
- String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$
- return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-
void handleFocus () {
if (hasFocus) return;
hasFocus = true;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
index f6c47cfb71..e32a072b98 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
@@ -31,6 +31,15 @@ static Browser findBrowser (int /*long*/ handle) {
return (Browser)display.findWidget (handle);
}
+static String getCacheParentPath () {
+ /* Use the character encoding for the default locale */
+ TCHAR buffer = new TCHAR (0, OS.MAX_PATH);
+ if (OS.SHGetFolderPath (0, OS.CSIDL_LOCAL_APPDATA, 0, OS.SHGFP_TYPE_CURRENT, buffer) == OS.S_OK) {
+ return buffer.toString (0, buffer.strlen ()) + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$
+ }
+ return getProfilePath ();
+}
+
static String getJSLibraryName () {
return "mozjs.dll"; //$NON-NLS-1$
}
@@ -43,6 +52,18 @@ static String getLibraryName () {
return "xpcom.dll"; //$NON-NLS-1$
}
+static String getProfilePath () {
+ String baseDir;
+ /* Use the character encoding for the default locale */
+ TCHAR buffer = new TCHAR (0, OS.MAX_PATH);
+ if (OS.SHGetFolderPath (0, OS.CSIDL_APPDATA, 0, OS.SHGFP_TYPE_CURRENT, buffer) == OS.S_OK) {
+ baseDir = buffer.toString (0, buffer.strlen ());
+ } else {
+ baseDir = System.getProperty("user.home"); //$NON-NLS-1$
+ }
+ return baseDir + Mozilla.SEPARATOR_OS + "Mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
+}
+
static String getSWTInitLibraryName () {
return "swt-xulrunner"; //$NON-NLS-1$
}
@@ -109,18 +130,6 @@ int /*long*/ getHandle () {
return browser.handle;
}
-String getProfilePath () {
- String baseDir;
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, OS.MAX_PATH);
- if (OS.SHGetFolderPath (0, OS.CSIDL_APPDATA, 0, OS.SHGFP_TYPE_CURRENT, buffer) == OS.S_OK) {
- baseDir = buffer.toString (0, buffer.strlen ());
- } else {
- baseDir = System.getProperty("user.home"); //$NON-NLS-1$
- }
- return baseDir + Mozilla.SEPARATOR_OS + "Mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-
void handleFocus () {
}