Bug #267665, Bug #260836 --> TB0.9 does not do proxy authentication for RSS feeds

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
This commit is contained in:
scott%scott-macgregor.org 2004-11-24 17:45:44 +00:00
parent 351a0623ea
commit f088f54df3
4 changed files with 22 additions and 28 deletions

View File

@ -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);

View File

@ -199,6 +199,7 @@ function InitMsgWindow()
msgWindow.SetDOMWindow(window);
mailSession.AddMsgWindow(msgWindow);
document.getElementById("messagepane").docShell.allowAuth = false;
msgWindow.rootDocShell.allowAuth = true;
}
function AddDataSources()

View File

@ -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()

View File

@ -222,6 +222,7 @@ function InitMsgWindow()
var messagepane = document.getElementById("messagepane");
messagepane.docShell.allowAuth = false;
msgWindow.rootDocShell.allowAuth = true;
}
function messagePaneOnClick(event)