Bug 1619602 - Part 2: Don't overwrite the existing ContentBlockingAllowListPrincipal when doing a recomputation in the Document. r=dimi,Ehsan

It is incorrect to overwrite the existing
ContentBlockingAllowListPrincipal when doing a recomputaion in the
Document. The ContentBlockingAllowListPrincipal in the document should
be updated in Document::SetPrincipals().

Differential Revision: https://phabricator.services.mozilla.com/D65406

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Huang 2020-03-05 19:04:31 +00:00
Родитель 93e600f428
Коммит 1e0e0346b8
3 изменённых файлов: 2 добавлений и 16 удалений

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

@ -16177,16 +16177,5 @@ bool Document::HasRecentlyStartedForegroundLoads() {
return false; return false;
} }
already_AddRefed<nsIPrincipal>
Document::RecomputeContentBlockingAllowListPrincipal(
nsIURI* aURIBeingLoaded, const OriginAttributes& aAttrs) {
AntiTrackingCommon::RecomputeContentBlockingAllowListPrincipal(
aURIBeingLoaded, aAttrs,
getter_AddRefs(mContentBlockingAllowListPrincipal));
nsCOMPtr<nsIPrincipal> copy = mContentBlockingAllowListPrincipal;
return copy.forget();
}
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

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

@ -585,9 +585,6 @@ class Document : public nsINode,
return mContentBlockingAllowListPrincipal; return mContentBlockingAllowListPrincipal;
} }
already_AddRefed<nsIPrincipal> RecomputeContentBlockingAllowListPrincipal(
nsIURI* aURIBeingLoaded, const OriginAttributes& aAttrs);
// EventTarget // EventTarget
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override; void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
EventListenerManager* GetOrCreateListenerManager() override; EventListenerManager* GetOrCreateListenerManager() override;

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

@ -162,8 +162,8 @@ ThirdPartyUtil::GetContentBlockingAllowListPrincipalFromWindow(
OriginAttributes attrs = OriginAttributes attrs =
docShell ? nsDocShell::Cast(docShell)->GetOriginAttributes() docShell ? nsDocShell::Cast(docShell)->GetOriginAttributes()
: OriginAttributes(); : OriginAttributes();
principal = AntiTrackingCommon::RecomputeContentBlockingAllowListPrincipal(
doc->RecomputeContentBlockingAllowListPrincipal(aURIBeingLoaded, attrs); aURIBeingLoaded, attrs, getter_AddRefs(principal));
} }
if (!principal || !principal->GetIsContentPrincipal()) { if (!principal || !principal->GetIsContentPrincipal()) {