Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2015-05-11 18:14:19 +0000
committerLakshmi Shanmugam2015-05-12 09:12:12 +0000
commit1dcffe779062d10b45151b31325f882a4d9028be (patch)
treef5b7451ff256251c98b770793fb5d06ec85b639b
parentd792aa6f2e2564ef7e20c21fd7733d15992e1183 (diff)
downloadeclipse.platform.swt-1dcffe779062d10b45151b31325f882a4d9028be.tar.gz
eclipse.platform.swt-1dcffe779062d10b45151b31325f882a4d9028be.tar.xz
eclipse.platform.swt-1dcffe779062d10b45151b31325f882a4d9028be.zip
Bug 466975 - XULRunner browser crashes when any file is downloaded.
Fixed the code to return correct method indexes for nsIHelperAppLauncher_1_8.saveToDisk() and nsICancelable.cancel(). Modified getMethodIndex() to throw error if something fails instead of returning -1 and causing a crash eventually.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICancelable.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISupports.java20
4 files changed, 32 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java
index f19ecf72dd..0a395f8b27 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java
@@ -57,7 +57,7 @@ int PromptForSaveToFile (long /*int*/ aLauncher, long /*int*/ aWindowContext, lo
String name = fileDialog.open ();
shell.close ();
if (name == null) {
- nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8 (aLauncher);
+ nsICancelable launcher = new nsICancelable (aLauncher);
int rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED);
if (rc != XPCOM.NS_OK) Mozilla.error (rc);
return XPCOM.NS_ERROR_FAILURE;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICancelable.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICancelable.java
index c0bc6789fe..4500585bc6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICancelable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsICancelable.java
@@ -43,6 +43,6 @@ public class nsICancelable extends nsISupports {
}
public int Cancel(int aReason) {
- return XPCOM.VtblCall(this.getMethodIndex("cancel") + 1, getAddress(), aReason);
+ return XPCOM.VtblCall(this.getMethodIndex("cancel"), getAddress(), aReason);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java
index 24bfc63035..2fcddebd29 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java
@@ -34,10 +34,23 @@ public class nsIHelperAppLauncher_1_8 extends nsICancelable {
static final String NS_IHELPERAPPLAUNCHER_IID_STR = "99a0882d-2ff9-4659-9952-9ac531ba5592";
static final String NS_IHELPERAPPLAUNCHER_1_9_IID_STR = "cc75c21a-0a79-4f68-90e1-563253d0c555";
-
+ static final String NS_IHELPERAPPLAUNCHER_10_IID_STR = "d9a19faf-497b-408c-b995-777d956b72c0";
+ static final String NS_IHELPERAPPLAUNCHER_24_IID_STR = "acf2a516-7d7f-4771-8b22-6c4a559c088e";
+
static {
IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_BASE, new nsID(NS_IHELPERAPPLAUNCHER_IID_STR));
IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR1_9, new nsID(NS_IHELPERAPPLAUNCHER_1_9_IID_STR));
+ IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR10, new nsID(NS_IHELPERAPPLAUNCHER_10_IID_STR));
+ IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR31, new nsID(NS_IHELPERAPPLAUNCHER_24_IID_STR));
+ }
+
+ /*
+ * This method is overridden in this Class because its Java Class name is different from the actual XULRunner Interface name.
+ * This would cause getMethodIndex() to fail as getClass().getSimpleName() returns the Java Class name.
+ */
+ @Override
+ protected String getClassName() {
+ return "nsIHelperAppLauncher";
}
public nsIHelperAppLauncher_1_8(long /*int*/ address) {
@@ -47,4 +60,5 @@ public class nsIHelperAppLauncher_1_8 extends nsICancelable {
public int SaveToDisk(long /*int*/ aNewFileLocation, int aRememberThisPreference) {
return XPCOM.VtblCall(this.getMethodIndex("saveToDisk"), getAddress(), aNewFileLocation, aRememberThisPreference);
}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISupports.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISupports.java
index a47d272ca9..844888861e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISupports.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISupports.java
@@ -27,7 +27,7 @@
* ***** END LICENSE BLOCK ***** */
package org.eclipse.swt.internal.mozilla;
-import org.eclipse.swt.SWTError;
+import org.eclipse.swt.*;
public class nsISupports {
@@ -78,23 +78,33 @@ public class nsISupports {
return getMethodIndex (attribute) + 1;
}
+ protected String getClassName() {
+ return getClass ().getSimpleName ();
+ }
+
protected int getMethodIndex (String methodString) {
long /*int*/[] result = new long /*int*/[1];
result[0] = 0;
int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) return -1;
+ if (rc != XPCOM.NS_OK) {
+ throw new SWTError(rc);
+ }
nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
result[0] = 0;
rc = serviceManager.GetServiceByContractID (toByteArray (XPCOM.NS_INTERFACEINFOMANAGER_CONTRACTID), IIDStore.GetIID (nsIInterfaceInfoManager.class), result);
serviceManager.Release ();
- if (rc != XPCOM.NS_OK) return -1;
+ if (rc != XPCOM.NS_OK) {
+ throw new SWTError(rc);
+ }
nsIInterfaceInfoManager iim = new nsIInterfaceInfoManager (result[0]);
result[0] = 0;
- rc = iim.GetInfoForName (toByteArray (getClass ().getSimpleName ()), result);
+ rc = iim.GetInfoForName (toByteArray (getClassName()), result);
iim.Release ();
- if (rc != XPCOM.NS_OK) return -1;
+ if (rc != XPCOM.NS_OK) {
+ throw new SWTError(rc);
+ }
nsIInterfaceInfo info = new nsIInterfaceInfo (result[0]);
int[] index = new int [1];

Back to the top