Last Comment Bug 44161 - improperly parented modal dialogs in nsSmtpProtocol.cpp
: improperly parented modal dialogs in nsSmtpProtocol.cpp
[nsbeta3+] fix in hand
: embed
Product: MailNews Core
Classification: Components
Component: Composition (show other bugs)
: Trunk
: All All
P3 normal (vote)
: M18
Assigned To: Scott MacGregor
: lchiang
Depends on:
Blocks: 25684
  Show dependency treegraph
Reported: 2000-06-28 17:33 PDT by Dan M
Modified: 2008-07-31 01:22 PDT (History)
0 users
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---


Description User image Dan M 2000-06-28 17:33:04 PDT
nsNetSupportDialog should only be used as a backup plan if no other nsIPrompt 
interface is available. It has been used in dozens of places because of its 
seductive convenience. But it's flawed, creating modal windows that don't behave 
correctly; the cause of various blanket bugs like 25684 and 39439 (both currently 
considered nsbeta2+).
  This problem can only be fixed by trying much harder to find a proper window to 
be the modal dialog's parent. nsNetSupportDialog should be relegated to providing 
backup when herculean efforts to locate the actual parent window fail for some 
  As an example, the cookie service has been taught to use a proper parent window 
for its dialog by laboriously storing a reference to that window's nsIPrompt in 
nsHTTPChannel, from which it can be extracted and passed around while processing 
notification events, punting to nsNetSupportDialog only when no other choice is 
available. That same sort of thing needs to be done in many more places.
  Two such places happen in nsSmtpProtocol.cpp: nsExplainErrorDetails and 
  Happy recipients of this bug would spread the happiness most widely if they 
would start using a good nsIPrompt window. The "modal windows don't behave 
nicely" bugs are being made dependent on this bug and its siblings, and will 
eventually be closed as "as fixed as they're going to get" once these have all 
been considered.
Comment 1 User image scottputterman 2000-06-30 14:09:34 PDT
reassigning to mscott
Comment 2 User image Scott MacGregor 2000-07-05 14:54:14 PDT
I believe these bugs are supposed to be nsbeta2. See 44164 for an example.
Comment 3 User image Scott MacGregor 2000-07-21 15:11:01 PDT
Comment 4 User image lchiang 2000-08-01 14:49:21 PDT
+ per mail triage
Comment 5 User image Doug Turner (:dougt) 2000-08-07 15:15:29 PDT
Because of the use of nsCommonDialogs, or the use of the nsIPrompt service, this 
component can not be used for embedding.  Adding the embedding keyword.

How To Bring Up A Modal Dialog: 

You need to know what window you want to have modality against.  This will be a 
nsIDOMWindow.  Using a magic "hidden" window breaks modality and embedding 
application may not have this hack.  One you have the parent DOMWindow, you 

nsCOMPtr<nsIPrompt> prompter; 
if (prompter) 

Any other way that you try to bring up a dialog may not work in an embedding 
application. To reiterate, do not use the nsICommonDialogs interface -or- a
nsIPrompt service if you want your component in a non-seamonkey app. 

I don't have a DOMWindow?! 

If you don't have a DOMWindow, you need to get one.  Just about every place I 
saw that used the hidden window, could have used the real parent window with
some work.  There really is no place in the code where we should be displaying a 
modal dialog without knowing what parent window we are modal against.  If you 
find a case where you don't have a top level window, lets talk. 

Comment 6 User image Scott MacGregor 2000-08-10 15:58:45 PDT
Fix checked in for the window parenting problems in the smtp protocol. 
Comment 7 User image Navin Gupta 2000-09-29 11:33:37 PDT
verifying this bug
Comment 8 User image Navin Gupta 2000-10-02 12:19:36 PDT
nsIPrompt is being used now

Note You need to log in before you can comment on or make changes to this bug.