mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 802366 - Prelude, part 4: Use and simplify nsScriptSecurityManager::GetDocShellCodebasePrincipal. r=bz
--HG-- extra : rebase_source : 9987bd127ffbfdc6b34302dd05bfac1d6e481a33
This commit is contained in:
parent
f0cecd2f62
commit
e81c256481
@ -335,19 +335,15 @@ nsScriptSecurityManager::GetChannelPrincipal(nsIChannel* aChannel,
|
||||
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t appId = UNKNOWN_APP_ID;
|
||||
bool isInBrowserElement = false;
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
NS_QueryNotificationCallbacks(aChannel, docShell);
|
||||
|
||||
if (docShell) {
|
||||
docShell->GetAppId(&appId);
|
||||
docShell->GetIsInBrowserElement(&isInBrowserElement);
|
||||
return GetDocShellCodebasePrincipal(uri, docShell, aPrincipal);
|
||||
}
|
||||
|
||||
return GetCodebasePrincipalInternal(uri, appId, isInBrowserElement,
|
||||
aPrincipal);
|
||||
return GetCodebasePrincipalInternal(uri, UNKNOWN_APP_ID,
|
||||
/* isInBrowserElement */ false, aPrincipal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1891,14 +1887,9 @@ nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
MOZ_ASSERT(aDocShell);
|
||||
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement;
|
||||
aDocShell->GetAppId(&appId);
|
||||
aDocShell->GetIsInBrowserElement(&isInBrowserElement);
|
||||
|
||||
return GetCodebasePrincipalInternal(aURI, appId, isInBrowserElement,
|
||||
return GetCodebasePrincipalInternal(aURI,
|
||||
aDocShell->GetAppId(),
|
||||
aDocShell->GetIsInBrowserElement(),
|
||||
aPrincipal);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user