From a10e95cd91e521ad0ee84f4783b1e586999201ab Mon Sep 17 00:00:00 2001 From: Dimi Lee Date: Wed, 17 Jun 2020 15:34:21 +0000 Subject: [PATCH] Bug 1645406 - Remove getContentBlockingAllowListPrincipalFromWindow from mozIThirdPartyUtil.idl r=timhuang,necko-reviewers Differential Revision: https://phabricator.services.mozilla.com/D79464 --- dom/base/ThirdPartyUtil.cpp | 37 ----------------------------- netwerk/base/mozIThirdPartyUtil.idl | 9 ------- 2 files changed, 46 deletions(-) diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp index 1ce65f12d6bb..38454e3a9c77 100644 --- a/dom/base/ThirdPartyUtil.cpp +++ b/dom/base/ThirdPartyUtil.cpp @@ -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 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 diff --git a/netwerk/base/mozIThirdPartyUtil.idl b/netwerk/base/mozIThirdPartyUtil.idl index be4c47ac3cff..dccadd7b4458 100644 --- a/netwerk/base/mozIThirdPartyUtil.idl +++ b/netwerk/base/mozIThirdPartyUtil.idl @@ -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 *