зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1621192 - P2: Move allowContentRetargeting to BrowsingContext. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D66168 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2bb6d70d00
Коммит
3bbde12e78
|
@ -241,6 +241,13 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
|||
|
||||
context->mFields.SetWithoutSyncing<IDX_IsActive>(true);
|
||||
|
||||
const bool allowContentRetargeting =
|
||||
inherit ? inherit->GetAllowContentRetargetingOnChildren() : true;
|
||||
context->mFields.SetWithoutSyncing<IDX_AllowContentRetargeting>(
|
||||
allowContentRetargeting);
|
||||
context->mFields.SetWithoutSyncing<IDX_AllowContentRetargetingOnChildren>(
|
||||
allowContentRetargeting);
|
||||
|
||||
const bool allowPlugins = inherit ? inherit->GetAllowPlugins() : true;
|
||||
context->mFields.SetWithoutSyncing<IDX_AllowPlugins>(allowPlugins);
|
||||
|
||||
|
@ -1408,6 +1415,14 @@ void BrowsingContext::DidSet(FieldIndex<IDX_Muted>) {
|
|||
});
|
||||
}
|
||||
|
||||
void BrowsingContext::SetAllowContentRetargeting(
|
||||
bool aAllowContentRetargeting) {
|
||||
Transaction txn;
|
||||
txn.SetAllowContentRetargeting(aAllowContentRetargeting);
|
||||
txn.SetAllowContentRetargetingOnChildren(aAllowContentRetargeting);
|
||||
txn.Commit(this);
|
||||
}
|
||||
|
||||
void BrowsingContext::SetCustomUserAgent(const nsAString& aUserAgent) {
|
||||
Top()->SetUserAgentOverride(aUserAgent);
|
||||
}
|
||||
|
@ -1441,6 +1456,18 @@ bool BrowsingContext::CheckOnlyOwningProcessCanSet(ContentParent* aSource) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_AllowContentRetargeting>,
|
||||
const bool& aAllowContentRetargeting,
|
||||
ContentParent* aSource) {
|
||||
return CheckOnlyOwningProcessCanSet(aSource);
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_AllowContentRetargetingOnChildren>,
|
||||
const bool& aAllowContentRetargetingOnChildren,
|
||||
ContentParent* aSource) {
|
||||
return CheckOnlyOwningProcessCanSet(aSource);
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_AllowPlugins>,
|
||||
const bool& aAllowPlugins,
|
||||
ContentParent* aSource) {
|
||||
|
|
|
@ -102,6 +102,8 @@ class WindowProxyHolder;
|
|||
FIELD(Loading, bool) \
|
||||
FIELD(AncestorLoading, bool) \
|
||||
FIELD(AllowPlugins, bool) \
|
||||
FIELD(AllowContentRetargeting, bool) \
|
||||
FIELD(AllowContentRetargetingOnChildren, bool) \
|
||||
/* These field are used to store the states of autoplay media request on \
|
||||
* GeckoView only, and it would only be modified on the top level browsing \
|
||||
* context. */ \
|
||||
|
@ -356,6 +358,8 @@ class BrowsingContext : public nsISupports, public nsWrapperCache {
|
|||
}
|
||||
}
|
||||
|
||||
void SetAllowContentRetargeting(bool aAllowContentRetargeting);
|
||||
|
||||
// Using the rules for choosing a browsing context we try to find
|
||||
// the browsing context with the given name in the set of
|
||||
// transitively reachable browsing contexts. Performs access control
|
||||
|
@ -646,6 +650,11 @@ class BrowsingContext : public nsISupports, public nsWrapperCache {
|
|||
bool CanSet(FieldIndex<IDX_EmbedderElementType>,
|
||||
const Maybe<nsString>& aInitiatorType, ContentParent* aSource);
|
||||
|
||||
bool CanSet(FieldIndex<IDX_AllowContentRetargeting>,
|
||||
const bool& aAllowContentRetargeting, ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_AllowContentRetargetingOnChildren>,
|
||||
const bool& aAllowContentRetargetingOnChildren,
|
||||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_AllowPlugins>, const bool& aAllowPlugins,
|
||||
ContentParent* aSource);
|
||||
|
||||
|
|
|
@ -377,8 +377,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
|||
mAllowMedia(true),
|
||||
mAllowDNSPrefetch(true),
|
||||
mAllowWindowControl(true),
|
||||
mAllowContentRetargeting(true),
|
||||
mAllowContentRetargetingOnChildren(true),
|
||||
mUseErrorPages(false),
|
||||
mObserveErrorPages(true),
|
||||
mCSSErrorReportingEnabled(false),
|
||||
|
@ -1809,28 +1807,29 @@ nsDocShell::SetAllowWindowControl(bool aAllowWindowControl) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAllowContentRetargeting(bool* aAllowContentRetargeting) {
|
||||
*aAllowContentRetargeting = mAllowContentRetargeting;
|
||||
*aAllowContentRetargeting = mBrowsingContext->GetAllowContentRetargeting();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting) {
|
||||
mAllowContentRetargetingOnChildren = aAllowContentRetargeting;
|
||||
mAllowContentRetargeting = aAllowContentRetargeting;
|
||||
mBrowsingContext->SetAllowContentRetargeting(aAllowContentRetargeting);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAllowContentRetargetingOnChildren(
|
||||
bool* aAllowContentRetargetingOnChildren) {
|
||||
*aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren;
|
||||
*aAllowContentRetargetingOnChildren =
|
||||
mBrowsingContext->GetAllowContentRetargetingOnChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAllowContentRetargetingOnChildren(
|
||||
bool aAllowContentRetargetingOnChildren) {
|
||||
mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren;
|
||||
mBrowsingContext->SetAllowContentRetargetingOnChildren(
|
||||
aAllowContentRetargetingOnChildren);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2666,9 +2665,6 @@ nsresult nsDocShell::SetDocLoaderParent(nsDocLoader* aParent) {
|
|||
NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
|
||||
SetAllowWindowControl(value);
|
||||
}
|
||||
SetAllowContentRetargeting(
|
||||
mAllowContentRetargeting &&
|
||||
parentAsDocShell->GetAllowContentRetargetingOnChildren());
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
|
||||
SetIsActive(value);
|
||||
}
|
||||
|
@ -10174,7 +10170,7 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
|||
if (mLoadType == LOAD_LINK) {
|
||||
openFlags |= nsIURILoader::IS_CONTENT_PREFERRED;
|
||||
}
|
||||
if (!mAllowContentRetargeting) {
|
||||
if (!mBrowsingContext->GetAllowContentRetargeting()) {
|
||||
openFlags |= nsIURILoader::DONT_RETARGET;
|
||||
}
|
||||
|
||||
|
|
|
@ -1299,8 +1299,6 @@ class nsDocShell final : public nsDocLoader,
|
|||
bool mAllowMedia : 1;
|
||||
bool mAllowDNSPrefetch : 1;
|
||||
bool mAllowWindowControl : 1;
|
||||
bool mAllowContentRetargeting : 1;
|
||||
bool mAllowContentRetargetingOnChildren : 1;
|
||||
bool mUseErrorPages : 1;
|
||||
bool mObserveErrorPages : 1;
|
||||
bool mCSSErrorReportingEnabled : 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче