RSS feeds which require HTTP authentication are rejected as invalid Re-work the docshell auth prompt logic to disable prompts for any url running in chrome unless the chrome window explicitly sets allowAuth on its docshell. r=darin sr=jst git-svn-id: svn://10.0.0.236/trunk@165722 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -388,18 +388,10 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
|
||||
// if auth is not allowed, bail out
|
||||
if (!mAllowAuth)
|
||||
return NS_NOINTERFACE;
|
||||
return NS_SUCCEEDED(
|
||||
GetAuthPrompt(PROMPT_NORMAL, (nsIAuthPrompt **) aSink)) ?
|
||||
NS_OK : NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIAuthPrompt> authPrompter(do_GetInterface(mTreeOwner));
|
||||
if (authPrompter) {
|
||||
*aSink = authPrompter;
|
||||
NS_ADDREF((nsISupports *) * aSink);
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIProgressEventSink))
|
||||
|| aIID.Equals(NS_GET_IID(nsIHttpEventSink))
|
||||
@@ -1709,6 +1701,9 @@ nsDocShell::SetItemType(PRInt32 aItemType)
|
||||
|
||||
mItemType = aItemType;
|
||||
|
||||
// disable auth prompting for anything but content
|
||||
mAllowAuth = mItemType == typeContent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -7080,15 +7075,6 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer)
|
||||
nsresult
|
||||
nsDocShell::GetAuthPrompt(PRUint32 aPromptReason, nsIAuthPrompt **aResult)
|
||||
{
|
||||
// if this docshell is of type chrome and has a chrome URI, then do not
|
||||
// give out an auth prompt. NOTE: it is possible to load a non-chrome
|
||||
// URI into a chrome docshell, so this check is important.
|
||||
if (mCurrentURI && mItemType == typeChrome) {
|
||||
PRBool chrome;
|
||||
if (NS_SUCCEEDED(mCurrentURI->SchemeIs("chrome", &chrome)) && chrome)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
// a priority prompt request will override a false mAllowAuth setting
|
||||
PRBool priorityPrompt = (aPromptReason == PROMPT_PROXY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user