Comment 136 for bug 195698

Revision history for this message
In , Kai Engert (kaie) wrote :

In my test case where I have 3 MP prompts, I see we're going 3 times recursively through nsHttpChannel::PromptForIdentity and PK11PasswordPrompt.

PK11PasswordPrompt brings up the MP prompt, but what should happen when it detects one prompt is already active?

Failing is not an option, IMHO. It would cause all pages but the first one to not restore automatically. Blocking is not an option either, because that would cause a deadlock - the prompt further up on the stack wouldn't have a chance to unblock.

I think a solution is to avoid the recursion at the networking level.

Multiple calls to nsHttpChannel::PromptForIdentity should be avoided.

nsHttpChannel::GetCredentialsForChallenge (which calls PromptForIdentity) should detect whether a prompt is already active, and avoid another one.

I think we need even a platform wide solution.
We should have a singleton that tracks whether any authentication prompt is currently being shown.
Any other code desiring to shown an auth prompt should check whether a prompt is already active.
If "busy", the context can decide to fail, or register for wakeup, using a callback mechanism.