зеркало из https://github.com/mozilla/pjs.git
Bug 180749 - when remembering granted privileges for file://pages, grant privilege for that page only, not the whole local file system. r=jst, sr=heikki.
This commit is contained in:
Родитель
5268e6a55c
Коммит
fcf841a105
|
@ -69,14 +69,39 @@ NSBASEPRINCIPALS_RELEASE(nsCodebasePrincipal);
|
|||
///////////////////////////////////////
|
||||
NS_IMETHODIMP
|
||||
nsCodebasePrincipal::ToString(char **result)
|
||||
{
|
||||
{
|
||||
*result = nsnull;
|
||||
PRBool isFile = PR_TRUE;
|
||||
if(NS_FAILED(mURI->SchemeIs("file", &isFile)))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (isFile)
|
||||
{
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
if (url)
|
||||
{
|
||||
nsCAutoString directory;
|
||||
nsresult rv = url->GetDirectory(directory);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCAutoString fileName;
|
||||
rv = url->GetFileName(fileName);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
*result =
|
||||
ToNewCString(NS_LITERAL_CSTRING("file://") + directory + fileName);
|
||||
if (!*result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return GetOrigin(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCodebasePrincipal::ToUserVisibleString(char **result)
|
||||
{
|
||||
return GetOrigin(result);
|
||||
return ToString(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче