Bug 485396 - Crash in [@ NS_GetInnermostURI - nsDOMStorage::InitAsLocalStorage] with Chromebug running, r=dcamp

This commit is contained in:
Honza Bambas 2009-04-01 23:26:34 +02:00
parent 76cc4c16be
commit 3351eafdf6

View File

@ -528,6 +528,11 @@ nsDOMStorage::InitAsLocalStorage(nsIPrincipal *aPrincipal)
rv = aPrincipal->GetURI(getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
// Check if we really got any URI. System principal doesn't return a URI
// instance and we would crash in NS_GetInnermostURI bellow.
if (!uri)
return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsIURI> innerUri = NS_GetInnermostURI(uri);
if (!innerUri)
return NS_ERROR_UNEXPECTED;