Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2012-02-27 10:36:53 +0000
committerGrant Gayed2012-03-06 21:45:34 +0000
commitc0e8b19693a09635ee2e2549501800c6e492284d (patch)
treef69406a63a365eac8f4b353bda1dba7b425f68d6 /bundles/org.eclipse.swt
parent45b9943e2cf7dcb6df6ebdaf1accf9be50534b90 (diff)
downloadeclipse.platform.swt-c0e8b19693a09635ee2e2549501800c6e492284d.tar.gz
eclipse.platform.swt-c0e8b19693a09635ee2e2549501800c6e492284d.tar.xz
eclipse.platform.swt-c0e8b19693a09635ee2e2549501800c6e492284d.zip
changed the fix for Bug 372134-Prompter.getBrowser() not working. Also
fixes 372143.
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptFactory.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptFactory.java4
4 files changed, 22 insertions, 61 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java
index 4ab9d4daf3..69813f2261 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java
@@ -19,6 +19,7 @@ class PromptAuth2 {
XPCOMObject supports;
XPCOMObject promptAuth;
int refCount = 0;
+ int /*long*/ parent;
PromptAuth2 () {
createCOMInterfaces ();
@@ -87,36 +88,14 @@ int Release () {
return refCount;
}
-Browser getBrowser() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
- result[0] = 0;
- byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, !Mozilla.IsPre_4 ? nsIFocusManager.NS_IFOCUSMANAGER_10_IID : nsIFocusManager.NS_IFOCUSMANAGER_IID, result);
- serviceManager.Release ();
-
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIFocusManager focusManager = new nsIFocusManager (result[0]);
- result[0] = 0;
- rc = focusManager.GetActiveWindow (result);
- focusManager.Release ();
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIDOMWindow domWindow = new nsIDOMWindow (result[0]);
- result[0] = 0;
- rc = domWindow.GetTop(result);
- domWindow.Release();
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- return Mozilla.getBrowser(result[0]);
- }
- }
- }
- return null;
+Browser getBrowser () {
+ if (parent == 0) return null;
+ return Mozilla.getBrowser (parent);
}
+void setParent(int /*long*/ aParent) {
+ parent = aParent;
+}
int PromptAuth(int /*long*/ aChannel, int level, int /*long*/ authInfo, int /*long*/ _retval) {
nsIAuthInformation auth = new nsIAuthInformation (authInfo);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptFactory.java
index ea4339d408..f2b4c70d8b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptFactory.java
@@ -86,13 +86,14 @@ int Release () {
/* nsIPromptFactory */
-int GetPrompt (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+int GetPrompt (int /*long*/ aParent, int /*long*/ iid, int /*long*/ result) {
nsID guid = new nsID ();
XPCOM.memmove (guid, iid, nsID.sizeof);
if (guid.Equals (nsIPrompt.NS_IPROMPT_IID)) {
Prompter prompter = new Prompter ();
prompter.AddRef ();
+ prompter.setParent (aParent);
XPCOM.memmove (result, new int /*long*/[] {prompter.getAddress ()}, C.PTR_SIZEOF);
AddRef ();
return XPCOM.NS_OK;
@@ -100,6 +101,7 @@ int GetPrompt (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
if (guid.Equals (nsIAuthPrompt2.NS_IAUTHPROMPT2_IID)) {
PromptAuth2 promptAuth = new PromptAuth2();
promptAuth.AddRef ();
+ promptAuth.setParent (aParent);
XPCOM.memmove (result, new int /*long*/[] {promptAuth.getAddress ()}, C.PTR_SIZEOF);
AddRef ();
return XPCOM.NS_OK;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java
index 173f55fdbd..1541d1fdc1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java
@@ -19,6 +19,7 @@ class Prompter {
XPCOMObject supports;
XPCOMObject prompt;
int refCount = 0;
+ int /*long*/ parent;
Prompter () {
createCOMInterfaces ();
@@ -93,6 +94,11 @@ int Release () {
return refCount;
}
+Browser getBrowser () {
+ if (parent == 0) return null;
+ return Mozilla.getBrowser (parent);
+}
+
String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) {
String label = null;
int flag = (buttonFlag & (0xff * index)) / index;
@@ -112,6 +118,10 @@ String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) {
return label;
}
+void setParent(int /*long*/ aParent) {
+ parent = aParent;
+}
+
/* nsIPrompt */
int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) {
@@ -144,36 +154,6 @@ int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) {
return XPCOM.NS_OK;
}
-Browser getBrowser() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
- result[0] = 0;
- byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, !Mozilla.IsPre_4 ? nsIFocusManager.NS_IFOCUSMANAGER_10_IID : nsIFocusManager.NS_IFOCUSMANAGER_IID, result);
- serviceManager.Release ();
-
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIFocusManager focusManager = new nsIFocusManager (result[0]);
- result[0] = 0;
- rc = focusManager.GetActiveWindow (result);
- focusManager.Release ();
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIDOMWindow domWindow = new nsIDOMWindow (result[0]);
- result[0] = 0;
- rc = domWindow.GetTop(result);
- domWindow.Release();
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- return Mozilla.getBrowser(result[0]);
- }
- }
- }
- return null;
-}
-
int AlertCheck (int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) {
Browser browser = getBrowser ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptFactory.java
index fada150e7c..6f692c923a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIPromptFactory.java
@@ -41,7 +41,7 @@ public class nsIPromptFactory extends nsISupports {
super(address);
}
- public int Alert(char[] aDialogTitle, char[] aText) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aDialogTitle, aText);
+ public int getPrompt(int /*long*/ aParent, nsID iid, int /*long*/[] result) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aParent, iid, result);
}
}

Back to the top