aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2012-02-23 05:30:21 (EST)
committerGrant Gayed2012-03-06 16:45:33 (EST)
commit45b9943e2cf7dcb6df6ebdaf1accf9be50534b90 (patch)
tree93551d7f1a5ae27ed4b16b32a46bd427ed5f51d1
parent1f40f1305a2185832d54c106b90af381ca8fb125 (diff)
downloadeclipse.platform.swt-45b9943e2cf7dcb6df6ebdaf1accf9be50534b90.zip
eclipse.platform.swt-45b9943e2cf7dcb6df6ebdaf1accf9be50534b90.tar.gz
eclipse.platform.swt-45b9943e2cf7dcb6df6ebdaf1accf9be50534b90.tar.bz2
Bug 372134-Prompter.getBrowser() not working
and Bug 372143-authentication listener never invoked with XULR10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptAuth2.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Prompter.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java15
4 files changed, 47 insertions, 14 deletions
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 3620e10..1b66c52 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
@@ -966,7 +966,7 @@ public void create (Composite parent, int style) {
nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
result[0] = 0;
byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, nsIFocusManager.NS_IFOCUSMANAGER_IID, result);
+ rc = serviceManager.GetServiceByContractID (aContractID, !IsPre_4 ? nsIFocusManager.NS_IFOCUSMANAGER_10_IID : nsIFocusManager.NS_IFOCUSMANAGER_IID, result);
serviceManager.Release ();
if (rc == XPCOM.NS_OK && result[0] != 0) {
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 5be3696..4ab9d4d 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
@@ -89,17 +89,28 @@ int Release () {
Browser getBrowser() {
int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetComponentManager (result);
+ 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) {
- nsIComponentManager componentManager = new nsIComponentManager (result[0]);
+ nsIFocusManager focusManager = new nsIFocusManager (result[0]);
result[0] = 0;
- componentManager.GetClassObject(XPCOM.NS_IWEBBROWSER_CID, !Mozilla.IsPre_4 ? nsIWebBrowser.NS_IWEBBROWSER_10_IID : nsIWebBrowser.NS_IWEBBROWSER_IID, result);
+ rc = focusManager.GetActiveWindow (result);
+ focusManager.Release ();
if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIWebBrowser browser = new nsIWebBrowser(result[0]);
+ nsIDOMWindow domWindow = new nsIDOMWindow (result[0]);
result[0] = 0;
- rc = browser.GetContentDOMWindow(result);
+ rc = domWindow.GetTop(result);
+ domWindow.Release();
if (rc == XPCOM.NS_OK && result[0] != 0) {
- return Mozilla.getBrowser(result[0]);
+ return Mozilla.getBrowser(result[0]);
}
}
}
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 31303d9..173f55f 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
@@ -146,15 +146,26 @@ int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) {
Browser getBrowser() {
int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetComponentManager (result);
+ 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) {
- nsIComponentManager componentManager = new nsIComponentManager (result[0]);
+ nsIFocusManager focusManager = new nsIFocusManager (result[0]);
result[0] = 0;
- componentManager.GetClassObject(XPCOM.NS_IWEBBROWSER_CID, !Mozilla.IsPre_4 ? nsIWebBrowser.NS_IWEBBROWSER_10_IID : nsIWebBrowser.NS_IWEBBROWSER_IID, result);
+ rc = focusManager.GetActiveWindow (result);
+ focusManager.Release ();
if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIWebBrowser browser = new nsIWebBrowser(result[0]);
+ nsIDOMWindow domWindow = new nsIDOMWindow (result[0]);
result[0] = 0;
- rc = browser.GetContentDOMWindow(result);
+ rc = domWindow.GetTop(result);
+ domWindow.Release();
if (rc == XPCOM.NS_OK && result[0] != 0) {
return Mozilla.getBrowser(result[0]);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java
index db7af82..6c4bd5b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java
@@ -29,13 +29,19 @@ package org.eclipse.swt.internal.mozilla;
public class nsIFocusManager extends nsISupports {
- static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 17;
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 18 : 17);
public static final String NS_IFOCUSMANAGER_IID_STR =
- "cd6040a8-243f-412a-8a16-0bf2aa1083b9";
+ "cd6040a8-243f-412a-8a16-0bf2aa1083b9";
+
+ public static final String NS_IFOCUSMANAGER_10_IID_STR =
+ "51db277b-7ee7-4bce-9b84-fd2efcd2c8bd";
public static final nsID NS_IFOCUSMANAGER_IID =
new nsID(NS_IFOCUSMANAGER_IID_STR);
+
+ public static final nsID NS_IFOCUSMANAGER_10_IID =
+ new nsID(NS_IFOCUSMANAGER_10_IID_STR);
public nsIFocusManager(int /*long*/ address) {
super(address);
@@ -123,4 +129,9 @@ public class nsIFocusManager extends nsISupports {
public int FireDelayedEvents(int /*long*/ aDocument) {
return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aDocument);
}
+
+ public int FocusPlugin(int /*long*/ aPlugin) {
+ if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aPlugin);
+ }
}