Bug 1621192 - P1: Move allowPlugins to BrowsingContext. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D66167
This commit is contained in:
Dan Glastonbury
2020-03-19 01:48:56 +00:00
parent cde8483c0b
commit f9e0dcfc5b
5 changed files with 34 additions and 22 deletions

View File

@@ -241,6 +241,9 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
context->mFields.SetWithoutSyncing<IDX_IsActive>(true);
const bool allowPlugins = inherit ? inherit->GetAllowPlugins() : true;
context->mFields.SetWithoutSyncing<IDX_AllowPlugins>(allowPlugins);
return context.forget();
}
@@ -1420,13 +1423,7 @@ void BrowsingContext::DidSet(FieldIndex<IDX_UserAgentOverride>) {
});
}
bool BrowsingContext::CanSet(FieldIndex<IDX_UserAgentOverride>,
const nsString& aUserAgent,
ContentParent* aSource) {
if (!IsTop()) {
return false;
}
bool BrowsingContext::CheckOnlyOwningProcessCanSet(ContentParent* aSource) {
if (aSource) {
MOZ_ASSERT(XRE_IsParentProcess());
@@ -1444,6 +1441,22 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_UserAgentOverride>,
return true;
}
bool BrowsingContext::CanSet(FieldIndex<IDX_AllowPlugins>,
const bool& aAllowPlugins,
ContentParent* aSource) {
return CheckOnlyOwningProcessCanSet(aSource);
}
bool BrowsingContext::CanSet(FieldIndex<IDX_UserAgentOverride>,
const nsString& aUserAgent,
ContentParent* aSource) {
if (!IsTop()) {
return false;
}
return CheckOnlyOwningProcessCanSet(aSource);
}
bool BrowsingContext::CheckOnlyEmbedderCanSet(ContentParent* aSource) {
if (aSource) {
// Set by a content process, verify that it's this BC's embedder.