mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1482988 - Handle null arguments in nsContentUtils::StorageDisabledByAntiTracking correctly; r=smaug
This commit is contained in:
parent
d1e5833a37
commit
e01dca1048
@ -8902,16 +8902,24 @@ nsContentUtils::StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME: this is wrong. This method is called also with aWindow and a null
|
||||
// aChannel.
|
||||
nsCOMPtr<mozIDOMWindowProxy> win;
|
||||
nsresult rv = thirdPartyUtil->GetTopWindowForChannel(aChannel,
|
||||
getter_AddRefs(win));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
auto* pwin = nsPIDOMWindowOuter::From(win);
|
||||
nsCOMPtr<nsPIDOMWindowOuter> pwin;
|
||||
if (aWindow) {
|
||||
auto* outer = nsGlobalWindowOuter::Cast(aWindow->GetOuterWindow());
|
||||
if (outer) {
|
||||
pwin = outer->GetTopOuter();
|
||||
}
|
||||
} else if (aChannel) {
|
||||
nsCOMPtr<mozIDOMWindowProxy> win;
|
||||
nsresult rv = thirdPartyUtil->GetTopWindowForChannel(aChannel,
|
||||
getter_AddRefs(win));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
pwin = nsPIDOMWindowOuter::From(win);
|
||||
}
|
||||
|
||||
pwin->NotifyContentBlockingState(
|
||||
nsIWebProgressListener::STATE_BLOCKED_TRACKING_COOKIES, aChannel);
|
||||
if (pwin) {
|
||||
pwin->NotifyContentBlockingState(
|
||||
nsIWebProgressListener::STATE_BLOCKED_TRACKING_COOKIES, aChannel);
|
||||
}
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
|
@ -2953,6 +2953,7 @@ public:
|
||||
/*
|
||||
* Returns true if this window/channel/aPrincipal should disable storages
|
||||
* because of the anti-tracking feature.
|
||||
* Note that either aWindow or aChannel may be null when calling this function.
|
||||
*/
|
||||
static bool StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||
nsIChannel* aChannel,
|
||||
|
Loading…
Reference in New Issue
Block a user