This patch is complicated enough that it really needs test.
--
>+ , mAuthRetryAsync(PR_FALSE)
I'm not sure what the point of this variable is. You only check it in OnCredentialsAcquired, and when would that be called with mAuthRetryAsync == PR_FALSE?
>+ if (NS_ERROR_IN_PROGRESS == rv) {
Style in this file is generally the other way round:
if (rv == NS_ERROR_IN_PROGRESS)
So, this means that cancelling a channel while it's waiting for an auth prompt does not immediately cancel it. That seems unfortunate. Can you find a fix that doesn't require suspending the channel?
>+ else if (NS_ERROR_IN_PROGRESS == rv)
>+ return rv;
>+ /*
>+ gHttpHandler keeps a hash table of prompt tracks ('locks') for
Multiline comment style in this file is using C++ comments, i.e. a // on each line.
>+ each "realm | authType".
Why just for each realm + authType, why not also hostname?
I also note that this will do nothing to fix the master PW problem mentioned in the bug. If you have two URLs with different realms you still have the problem, right?
>+ is still open (awating user input) it is not allowed to popup
awating -> awaiting
>+ if (promptLock)
>+ promptLock->CredentialsAcquired(rv);
I know it's not strictly necessary to call this when the user cancelled the dialog, but it may still be better to preserve the original error code.
>+ class PromptForIdentityLock : public nsISupports
I think this would be simpler if you notified the channels in CredentialsReceived instead of in the destructor.
Why did you derive this from nsISupports? I don't really see what advantages the refcounting gives you here, and you don't care about QI either.
And why the split between this and PromptForIdentityLockInternal?
Also, classes should be declared at the beginning of a public/protected/internal section, not in the middle of functions.
+ nsCOMArray<nsIHttpChannel> mChannels;
Why not use an array of nsHttpChannel instead? As in nsTArray<nsRefPtr<nsHttpChannel> >, although I don't see why this can't be nsTArray<nsHttpChannel*>.
(From update of attachment 356180)
This patch is complicated enough that it really needs test.
-- (PR_FALSE)
>+ , mAuthRetryAsync
I'm not sure what the point of this variable is. You only check it in OnCredentialsAc quired, and when would that be called with mAuthRetryAsync == PR_FALSE?
>+ if (NS_ERROR_ IN_PROGRESS == rv) {
Style in this file is generally the other way round: IN_PROGRESS)
if (rv == NS_ERROR_
>+ mAuthRetryAsync = PR_TRUE;
>+ return Suspend();
So, this means that cancelling a channel while it's waiting for an auth prompt does not immediately cancel it. That seems unfortunate. Can you find a fix that doesn't require suspending the channel?
>+ else if (NS_ERROR_ IN_PROGRESS == rv)
>+ return rv;
Same style comment as above.
>+ nsRefPtr< nsHttpHandler: :PromptForIdent ityLock> promptLock;
Don't really see why this has to be refcounted...
>+ /*
>+ gHttpHandler keeps a hash table of prompt tracks ('locks') for
Multiline comment style in this file is using C++ comments, i.e. a // on each line.
>+ each "realm | authType".
Why just for each realm + authType, why not also hostname?
I also note that this will do nothing to fix the master PW problem mentioned in the bug. If you have two URLs with different realms you still have the problem, right?
>+ is still open (awating user input) it is not allowed to popup
awating -> awaiting
>+ if (promptLock) >CredentialsAcq uired(rv) ;
>+ promptLock-
I know it's not strictly necessary to call this when the user cancelled the dialog, but it may still be better to preserve the original error code.
>diff --git a/netwerk/ protocol/ http/src/ nsHttpHandler. cpp b/netwerk/ protocol/ http/src/ nsHttpHandler. cpp protocol/ http/src/ nsHttpHandler. cpp protocol/ http/src/ nsHttpHandler. cpp al("|") ;
>--- a/netwerk/
>+++ b/netwerk/
>+ nsCAutoString key(aRealm);
>+ key.AppendLiter
key.Append('|');
>+ key.Append( aAuthType) ;
>diff --git a/netwerk/ protocol/ http/src/ nsHttpHandler. h b/netwerk/ protocol/ http/src/ nsHttpHandler. h protocol/ http/src/ nsHttpHandler. h protocol/ http/src/ nsHttpHandler. h
>--- a/netwerk/
>+++ b/netwerk/
>@@ -42,36 +42,40 @@
>+#include "nsHashKeys.h"
>+#include "nsBaseHashtable.h"
Shouldn't you instead use nsClassHashtable? As in:
nsClassHashta ble<nsCStringHa shKey, PromptForIdenti tyLock>
>+ class PromptForIdenti tyLock : public nsISupports
I think this would be simpler if you notified the channels in CredentialsReceived instead of in the destructor.
Why did you derive this from nsISupports? I don't really see what advantages the refcounting gives you here, and you don't care about QI either.
And why the split between this and PromptForIdenti tyLockInternal?
Also, classes should be declared at the beginning of a public/ protected/ internal section, not in the middle of functions.
+ nsCOMArray< nsIHttpChannel> mChannels;
Why not use an array of nsHttpChannel instead? As in nsTArray< nsRefPtr< nsHttpChannel> >, although I don't see why this can't be nsTArray< nsHttpChannel* >.
>+ typedef nsBaseHashtable <nsCStringHashK ey, PromptForIdenti tyLockInternal* , PromptForIdenti tyLockInternal* > TPromptLockHash table;
As mentioned I think this should use nsClassHashtable.
Why the T prefix? That seems highly unsual in Mozilla code. PromptLockHashtable seems good enough.