Bug 1686616 - make ThirdPartyUtil use Components instead of Services. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D105523
This commit is contained in:
Alexis Beingessner 2021-02-18 13:26:29 +00:00
Родитель ade0725530
Коммит bd14ca539e
7 изменённых файлов: 21 добавлений и 11 удалений

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

@ -100,7 +100,7 @@
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SMILTimeContainer.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/Components.h"
#include "mozilla/ServoCSSPropList.h"
#include "mozilla/ServoStyleConsts.h"
#include "mozilla/ServoStyleSet.h"
@ -16911,7 +16911,8 @@ bool Document::HasThirdPartyChannel() {
// We assume that the channel is a third-party by default.
bool thirdParty = true;
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
if (!thirdPartyUtil) {
return thirdParty;
}

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

@ -17,7 +17,7 @@
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/Logging.h"
#include "mozilla/MacroForEach.h"
#include "mozilla/Services.h"
#include "mozilla/Components.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Unused.h"
@ -88,7 +88,7 @@ ThirdPartyUtil* ThirdPartyUtil::GetInstance() {
return gService;
}
nsCOMPtr<mozIThirdPartyUtil> tpuService =
mozilla::services::GetThirdPartyUtil();
mozilla::components::ThirdPartyUtil::Service();
if (!tpuService) {
return nullptr;
}

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

@ -23,7 +23,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/InputStreamLengthHelper.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/Services.h"
#include "mozilla/Components.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_security.h"
#include "mozilla/Telemetry.h"
@ -2070,7 +2070,7 @@ nsresult HttpBaseChannel::GetTopWindowURI(nsIURI* aURIBeingLoaded,
// Only compute the top window URI once. In e10s, this must be computed in the
// child. The parent gets the top window URI through HttpChannelOpenArgs.
if (!mTopWindowURI) {
util = services::GetThirdPartyUtil();
util = components::ThirdPartyUtil::Service();
if (!util) {
return NS_ERROR_NOT_AVAILABLE;
}

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

@ -9,6 +9,7 @@
#include "ClassifierDummyChannel.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/dom/WindowGlobalParent.h"
@ -218,7 +219,8 @@ nsresult UrlClassifierCommon::SetBlockedContent(nsIChannel* channel,
// to correct top-level window), we need to do this in the parent process
// instead (find the top-level window in the parent and send an IPC to child
// processes to report console).
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
if (NS_WARN_IF(!thirdPartyUtil)) {
return NS_OK;
}

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

@ -8,6 +8,7 @@
#include "AntiTrackingLog.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/net/CookieJarSettings.h"
@ -649,7 +650,8 @@ bool AntiTrackingUtils::IsThirdPartyWindow(nsPIDOMWindowInner* aWindow,
if (!doc || !doc->GetChannel()) {
// If we can't get channel from the window, ex, about:blank, fallback to use
// IsThirdPartyWindow check that examine the whole hierarchy.
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
Unused << thirdPartyUtil->IsThirdPartyWindow(aWindow->GetOuterWindow(),
nullptr, &thirdParty);
return thirdParty;

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

@ -9,6 +9,7 @@
#include "AntiTrackingUtils.h"
#include "TemporaryAccessGrantObserver.h"
#include "mozilla/Components.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/ContentBlockingUserInteraction.h"
#include "mozilla/dom/BrowsingContext.h"
@ -989,7 +990,8 @@ bool ContentBlocking::ShouldAllowAccessFor(nsPIDOMWindowInner* aWindow,
}
#ifdef DEBUG
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
if (thirdPartyUtil) {
bool thirdParty = false;
nsresult rv = thirdPartyUtil->IsThirdPartyWindow(aWindow->GetOuterWindow(),
@ -1110,7 +1112,8 @@ bool ContentBlocking::ShouldAllowAccessFor(nsIChannel* aChannel, nsIURI* aURI,
return false;
}
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
if (!thirdPartyUtil) {
LOG(("No thirdPartyUtil, bail out early"));
return true;

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

@ -17,6 +17,7 @@
#include "mozilla/AddonManagerWebAPI.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/Unused.h"
@ -987,7 +988,8 @@ void ChannelWrapper::GetUrlClassification(
}
bool ChannelWrapper::ThirdParty() const {
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
components::ThirdPartyUtil::Service();
if (NS_WARN_IF(!thirdPartyUtil)) {
return true;
}