mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1645406 - Remove getContentBlockingAllowListPrincipalFromWindow from mozIThirdPartyUtil.idl r=timhuang,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D79464
This commit is contained in:
parent
7571dc2667
commit
a10e95cd91
@ -150,43 +150,6 @@ ThirdPartyUtil::GetURIFromWindow(mozIDOMWindowProxy* aWin, nsIURI** result) {
|
||||
return basePrin->GetURI(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ThirdPartyUtil::GetContentBlockingAllowListPrincipalFromWindow(
|
||||
mozIDOMWindowProxy* aWin, nsIURI* aURIBeingLoaded, nsIPrincipal** result) {
|
||||
nsPIDOMWindowOuter* outerWindow = nsPIDOMWindowOuter::From(aWin);
|
||||
nsPIDOMWindowInner* innerWindow = outerWindow->GetCurrentInnerWindow();
|
||||
Document* doc = innerWindow ? innerWindow->GetExtantDoc() : nullptr;
|
||||
if (!doc) {
|
||||
return GetPrincipalFromWindow(aWin, result);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
doc->GetContentBlockingAllowListPrincipal();
|
||||
if (aURIBeingLoaded && principal && principal->GetIsNullPrincipal()) {
|
||||
// If we have an initial principal during navigation, recompute it to get
|
||||
// the real content blocking allow list principal.
|
||||
nsIDocShell* docShell = doc->GetDocShell();
|
||||
OriginAttributes attrs =
|
||||
docShell ? nsDocShell::Cast(docShell)->GetOriginAttributes()
|
||||
: OriginAttributes();
|
||||
ContentBlockingAllowList::RecomputePrincipal(aURIBeingLoaded, attrs,
|
||||
getter_AddRefs(principal));
|
||||
}
|
||||
|
||||
if (!principal || !principal->GetIsContentPrincipal()) {
|
||||
// This is for compatibility with GetURIFromWindow. Null principals are
|
||||
// explicitly special cased there. GetURI returns nullptr for
|
||||
// SystemPrincipal and ExpandedPrincipal.
|
||||
LOG(
|
||||
("ThirdPartyUtil::GetContentBlockingAllowListPrincipalFromWindow can't "
|
||||
"use null principal\n"));
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
principal.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Determine if aFirstURI is third party with respect to aSecondURI. See docs
|
||||
// for mozIThirdPartyUtil.
|
||||
NS_IMETHODIMP
|
||||
|
@ -198,15 +198,6 @@ interface mozIThirdPartyUtil : nsISupports
|
||||
*/
|
||||
nsIPrincipal getPrincipalFromWindow(in mozIDOMWindowProxy aWindow);
|
||||
|
||||
/**
|
||||
* getContentBlockingAllowListPrincipalFromWindow
|
||||
*
|
||||
* Returns the content blocking allow list principal for the window.
|
||||
*/
|
||||
[noscript]
|
||||
nsIPrincipal getContentBlockingAllowListPrincipalFromWindow(in mozIDOMWindowProxy aWindow,
|
||||
[optional] in nsIURI aURIBeingLoaded);
|
||||
|
||||
/**
|
||||
* getTopWindowForChannel
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user