Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 372134 - Prompter.getBrowser() not working with XULRunner 10
Summary: Prompter.getBrowser() not working with XULRunner 10
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-21 11:38 EST by Grant Gayed CLA
Modified: 2012-03-09 12:10 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2012-02-21 11:38:36 EST
This method always returns null.  Having it return the correct Browser is needed for proper parenting of JS-triggered dialogs, and also for proper handling of encountered invalid certificates.

It's not obvious how to do this since this handle is not passed to the methods in Prompter the way it is for PromptService2.  My guess is that perhaps there's a service that can be queried for the current active/focused Mozilla instance.
Comment 1 Lakshmi P Shanmugam CLA 2012-02-23 06:01:52 EST
Used nsIFocusManager.GetActiveWindow() to get the nsIDOMWindow.

Pushed to xulrunner-work branch --> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=xulrunner-work&id=65dd96247b1f002653bbf60044c8687bff1299c2
Comment 2 Grant Gayed CLA 2012-02-23 16:13:16 EST
Lakshmi can you amend a change to your patch?  Since you're using getActiveWindow() you don't have to getTop() on it because it is always the top-level window (I've verified this with a case involving frames).  So the two places where you invoke Mozilla.getBrowser() can be simplified to:

if (rc == XPCOM.NS_OK && result[0] != 0) {
	Browser returnValue = Mozilla.getBrowser (result[0]);
	new nsISupports (result[0]).Release ();
	return returnValue;
}
Comment 3 Lakshmi P Shanmugam CLA 2012-02-27 05:46:03 EST
Hi Grant,
I have made a different fix for this. 
nsIFocusManager.GetActiveWindow() returns null sometimes (eg, when using prompt auth dialog). I noticed that nsIPromptFactory.GetPrompt() has the parent handle. This fix uses the handle directly. Can you please see if it looks fine?

--> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=xulrunner-work&id=b61ae33ff2ea5e11534c3f3d7248268dd89fc4e5
Comment 4 Grant Gayed CLA 2012-02-27 11:07:18 EST
Yes, looks good, thanks!