Bug 307310 - "crash [@ nsAbout::NewChannel]" [p=b.jacques@planet.nl (Bastiaan Jacques) r=timeless a1.9=schrep]

This commit is contained in:
reed@reedloden.com 2008-01-06 19:10:09 -08:00
Родитель 906552a37c
Коммит 305f28b0a9
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -54,21 +54,20 @@ nsAbout::NewChannel(nsIURI *aURI, nsIChannel **result)
{
nsresult rv;
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
if ( NS_FAILED(rv) )
return rv;
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIChannel> tempChannel;
rv = ioService->NewChannel(NS_LITERAL_CSTRING(kURI), nsnull, nsnull, getter_AddRefs(tempChannel));
rv = ioService->NewChannel(NS_LITERAL_CSTRING(kURI), nsnull, nsnull,
getter_AddRefs(tempChannel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptSecurityManager> securityManager =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal;
rv = securityManager->GetCodebasePrincipal(aURI, getter_AddRefs(principal));
if (NS_FAILED(rv))
return rv;
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> owner = do_QueryInterface(principal);
rv = tempChannel->SetOwner(owner);