Move the safe vs unsafe about: distinction out of the security manager and into

nsIAboutModule implementations.  Bug 337746, r=dveditz, sr=darin
This commit is contained in:
bzbarsky%mit.edu 2006-09-15 09:52:05 +00:00
parent c8fd94f182
commit fa84d90b52

View File

@ -43,6 +43,7 @@
#include "plstr.h"
#include "nsIScriptSecurityManager.h"
#include "nsAboutProtocolUtils.h"
#include "nsSimpleNestedURI.h"
NS_IMPL_ISUPPORTS1(nsAboutRedirector, nsIAboutModule)
@ -129,6 +130,29 @@ nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IMETHODIMP
nsAboutRedirector::GetURIFlags(nsIURI *aURI, PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(aURI);
nsCAutoString name;
nsresult rv = NS_GetAboutModuleName(aURI, name);
NS_ENSURE_SUCCESS(rv, rv);
for (int i=0; i < kRedirTotal; i++)
{
if (name.EqualsASCII(kRedirMap[i].id))
{
*result = kRedirMap[i].dropChromePrivs ?
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT : 0;
return NS_OK;
}
}
NS_ERROR("nsAboutRedirector called for unknown case");
return NS_ERROR_ILLEGAL_VALUE;
}
NS_METHOD
nsAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{