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);
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ function InitMsgWindow()
|
||||
msgWindow.SetDOMWindow(window);
|
||||
mailSession.AddMsgWindow(msgWindow);
|
||||
document.getElementById("messagepane").docShell.allowAuth = false;
|
||||
msgWindow.rootDocShell.allowAuth = true;
|
||||
}
|
||||
|
||||
function AddDataSources()
|
||||
|
||||
@@ -36,15 +36,21 @@
|
||||
|
||||
var gRSSServer = null;
|
||||
|
||||
function doLoad() {
|
||||
// extract the server argument
|
||||
if (window.arguments[0].server)
|
||||
gRSSServer = window.arguments[0].server;
|
||||
function doLoad()
|
||||
{
|
||||
// extract the server argument
|
||||
if (window.arguments[0].server)
|
||||
gRSSServer = window.arguments[0].server;
|
||||
|
||||
var ds = getSubscriptionsDS(gRSSServer);
|
||||
var tree = document.getElementById('subscriptions');
|
||||
tree.database.AddDataSource(ds);
|
||||
tree.builder.rebuild();
|
||||
var ds = getSubscriptionsDS(gRSSServer);
|
||||
var tree = document.getElementById('subscriptions');
|
||||
tree.database.AddDataSource(ds);
|
||||
tree.builder.rebuild();
|
||||
|
||||
var docshell = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell);
|
||||
docshell.allowAuth = true;
|
||||
}
|
||||
|
||||
function onAccept()
|
||||
|
||||
@@ -222,6 +222,7 @@ function InitMsgWindow()
|
||||
|
||||
var messagepane = document.getElementById("messagepane");
|
||||
messagepane.docShell.allowAuth = false;
|
||||
msgWindow.rootDocShell.allowAuth = true;
|
||||
}
|
||||
|
||||
function messagePaneOnClick(event)
|
||||
|
||||
Reference in New Issue
Block a user