Bug 1699721 - Part 1: Fully remove LegacyCheckOnlyOwningProcess, r=kmag

This is necessary as in part 2 the InFlightProcessId value will no longer be
tracked, so any remaining code which depends on it needs to be removed.

Differential Revision: https://phabricator.services.mozilla.com/D110001
This commit is contained in:
Nika Layzell 2021-03-31 15:37:48 +00:00
Родитель d1a3d50480
Коммит dc0e1921c5
2 изменённых файлов: 16 добавлений и 33 удалений

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

@ -2555,9 +2555,13 @@ void BrowsingContext::DidSet(FieldIndex<IDX_ExplicitActive>,
});
}
bool BrowsingContext::CanSet(FieldIndex<IDX_HasMainMediaController>,
bool aNewValue, ContentParent* aSource) {
return IsTop() && LegacyCheckOnlyOwningProcessCanSet(aSource);
auto BrowsingContext::CanSet(FieldIndex<IDX_HasMainMediaController>,
bool aNewValue, ContentParent* aSource)
-> CanSetResult {
if (!IsTop()) {
return CanSetResult::Deny;
}
return LegacyRevertIfNotOwningOrParentProcess(aSource);
}
void BrowsingContext::DidSet(FieldIndex<IDX_HasMainMediaController>,
@ -2741,25 +2745,6 @@ void BrowsingContext::DidSet(FieldIndex<IDX_PlatformOverride>) {
});
}
bool BrowsingContext::LegacyCheckOnlyOwningProcessCanSet(
ContentParent* aSource) {
if (aSource) {
MOZ_ASSERT(XRE_IsParentProcess());
// Double-check ownership if we aren't the setter.
if (!Canonical()->IsOwnedByProcess(aSource->ChildID()) &&
aSource->ChildID() != Canonical()->GetInFlightProcessId()) {
return false;
}
} else if (!IsInProcess() && !XRE_IsParentProcess()) {
// Don't allow this to be set from content processes that
// don't own the BrowsingContext.
return false;
}
return true;
}
auto BrowsingContext::LegacyRevertIfNotOwningOrParentProcess(
ContentParent* aSource) -> CanSetResult {
if (aSource) {
@ -2819,10 +2804,10 @@ auto BrowsingContext::CanSet(FieldIndex<IDX_AllowContentRetargetingOnChildren>,
return LegacyRevertIfNotOwningOrParentProcess(aSource);
}
bool BrowsingContext::CanSet(FieldIndex<IDX_AllowPlugins>,
const bool& aAllowPlugins,
ContentParent* aSource) {
return LegacyCheckOnlyOwningProcessCanSet(aSource);
auto BrowsingContext::CanSet(FieldIndex<IDX_AllowPlugins>,
const bool& aAllowPlugins, ContentParent* aSource)
-> CanSetResult {
return LegacyRevertIfNotOwningOrParentProcess(aSource);
}
bool BrowsingContext::CanSet(FieldIndex<IDX_FullscreenAllowedByOwner>,

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

@ -1037,8 +1037,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
CanSetResult CanSet(FieldIndex<IDX_AllowContentRetargetingOnChildren>,
const bool& aAllowContentRetargetingOnChildren,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_AllowPlugins>, const bool& aAllowPlugins,
ContentParent* aSource);
CanSetResult CanSet(FieldIndex<IDX_AllowPlugins>, const bool& aAllowPlugins,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_FullscreenAllowedByOwner>, const bool&,
ContentParent*);
bool CanSet(FieldIndex<IDX_WatchedByDevToolsInternal>,
@ -1063,8 +1063,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
bool CanSet(FieldIndex<IDX_PendingInitialization>, bool aNewValue,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_HasMainMediaController>, bool aNewValue,
ContentParent* aSource);
CanSetResult CanSet(FieldIndex<IDX_HasMainMediaController>, bool aNewValue,
ContentParent* aSource);
void DidSet(FieldIndex<IDX_HasMainMediaController>, bool aOldValue);
bool CanSet(FieldIndex<IDX_HasRestoreData>, bool aNewValue,
@ -1090,11 +1090,9 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
bool CanSet(FieldIndex<IDX_IsInBFCache>, bool, ContentParent* aSource);
void DidSet(FieldIndex<IDX_IsInBFCache>);
// True if the process attemping to set field is the same as the owning
// Allow if the process attemping to set field is the same as the owning
// process. Deprecated. New code that might use this should generally be moved
// to WindowContext or be settable only by the parent process.
bool LegacyCheckOnlyOwningProcessCanSet(ContentParent* aSource);
CanSetResult LegacyRevertIfNotOwningOrParentProcess(ContentParent* aSource);
// True if the process attempting to set field is the same as the embedder's