Backed out changeset 2531ddbeeffa (bug 1696771) for causing multiple failures CLOSED TREE

This commit is contained in:
Norisz Fay 2022-04-08 10:44:55 +03:00
Родитель 0d0ad9c7f3
Коммит c463ca58c7
7 изменённых файлов: 53 добавлений и 105 удалений

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

@ -184,9 +184,6 @@ ContentParent* CanonicalBrowsingContext::GetContentParent() const {
}
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (!cpm) {
return nullptr;
}
return cpm->GetContentProcessById(ContentParentId(mProcessId));
}

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

@ -2750,9 +2750,6 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
RefPtr<ContentParent> contentParent;
if (mChildID != 0) {
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
return false;
}
contentParent = cpm->GetContentProcessById(ContentParentId(mChildID));
}
mRemoteBrowser =

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

@ -83,9 +83,6 @@ nsresult BrowserBridgeParent::InitWithProcess(
}
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (!cpm) {
return NS_ERROR_UNEXPECTED;
}
cpm->RegisterRemoteFrame(browserParent);
RefPtr<WindowGlobalParent> windowParent =

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

@ -675,10 +675,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvEnsureLayersConnected(
void BrowserParent::ActorDestroy(ActorDestroyReason why) {
Manager()->NotifyTabDestroyed(mTabId, mMarkedDestroying);
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
cpm->UnregisterRemoteFrame(mTabId);
}
ContentProcessManager::GetSingleton()->UnregisterRemoteFrame(mTabId);
if (mRemoteLayerTreeOwner.IsInitialized()) {
auto layersId = mRemoteLayerTreeOwner.GetLayersId();

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

@ -1530,9 +1530,6 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
}
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (NS_WARN_IF(!cpm)) {
return nullptr;
}
cpm->RegisterRemoteFrame(browserParent);
nsCOMPtr<nsIPrincipal> initialPrincipal =
@ -2093,9 +2090,7 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
mSubprocess = nullptr;
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
cpm->RemoveContentProcess(this->ChildID());
}
cpm->RemoveContentProcess(this->ChildID());
if (mDriverCrashGuard) {
mDriverCrashGuard->NotifyCrashed();
@ -2486,8 +2481,6 @@ void ContentParent::AppendSandboxParams(std::vector<std::string>& aArgs) {
bool ContentParent::BeginSubprocessLaunch(ProcessPriority aPriority) {
AUTO_PROFILER_LABEL("ContentParent::LaunchSubprocess", OTHER);
// XXX: This check works only late, as GetSingleton will return nullptr
// only after ClearOnShutdown happened. See bug 1632740.
if (!ContentProcessManager::GetSingleton()) {
NS_WARNING(
"Shutdown has begun, we shouldn't spawn any more child processes");
@ -2620,13 +2613,7 @@ bool ContentParent::LaunchSubprocessResolve(bool aIsSync,
base::GetProcId(mSubprocess->GetChildProcessHandle());
Open(mSubprocess->TakeInitialPort(), procId);
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (!cpm) {
NS_WARNING("immediately shutting-down caused by our shutdown");
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
return false;
}
cpm->AddContentProcess(this);
ContentProcessManager::GetSingleton()->AddContentProcess(this);
#ifdef MOZ_CODE_COVERAGE
Unused << SendShareCodeCoverageMutex(
@ -4039,7 +4026,7 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
// window.open().
// We need to register remote frame with the child generated tab id.
auto* cpm = ContentProcessManager::GetSingleton();
if (!cpm || !cpm->RegisterRemoteFrame(parent)) {
if (!cpm->RegisterRemoteFrame(parent)) {
return IPC_FAIL(this, "RegisterRemoteFrame Failed");
}
}
@ -5169,12 +5156,9 @@ ContentParent::AllocPContentPermissionRequestParent(
const IPC::Principal& aPrincipal, const IPC::Principal& aTopLevelPrincipal,
const bool& aIsHandlingUserInput,
const bool& aMaybeUnsafePermissionDelegate, const TabId& aTabId) {
RefPtr<BrowserParent> tp;
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
tp =
cpm->GetTopLevelBrowserParentByProcessAndTabId(this->ChildID(), aTabId);
}
RefPtr<BrowserParent> tp =
cpm->GetTopLevelBrowserParentByProcessAndTabId(this->ChildID(), aTabId);
if (!tp) {
return nullptr;
}
@ -6828,11 +6812,9 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
// browsing contexts of bc.
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowClose(context, aTrustedCaller);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowClose(context, aTrustedCaller);
return IPC_OK();
}
@ -6849,11 +6831,9 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowFocus(context, aCallerType, aActionId);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowFocus(context, aCallerType, aActionId);
return IPC_OK();
}
@ -6868,11 +6848,9 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowBlur(context, aCallerType);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendWindowBlur(context, aCallerType);
return IPC_OK();
}
@ -6890,11 +6868,9 @@ mozilla::ipc::IPCResult ContentParent::RecvRaiseWindow(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendRaiseWindow(context, aCallerType, aActionId);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendRaiseWindow(context, aCallerType, aActionId);
return IPC_OK();
}
@ -6915,23 +6891,21 @@ mozilla::ipc::IPCResult ContentParent::RecvAdjustWindowFocus(
processes.InsertOrUpdate(this, true);
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
CanonicalBrowsingContext* context = aContext.get_canonical();
while (context) {
BrowsingContext* parent = context->GetParent();
if (!parent) {
break;
}
CanonicalBrowsingContext* canonicalParent = parent->Canonical();
ContentParent* cp = cpm->GetContentProcessById(
ContentParentId(canonicalParent->OwnerProcessId()));
if (cp && !processes.Get(cp)) {
Unused << cp->SendAdjustWindowFocus(context, aIsVisible, aActionId);
processes.InsertOrUpdate(cp, true);
}
context = canonicalParent;
CanonicalBrowsingContext* context = aContext.get_canonical();
while (context) {
BrowsingContext* parent = context->GetParent();
if (!parent) {
break;
}
CanonicalBrowsingContext* canonicalParent = parent->Canonical();
ContentParent* cp = cpm->GetContentProcessById(
ContentParentId(canonicalParent->OwnerProcessId()));
if (cp && !processes.Get(cp)) {
Unused << cp->SendAdjustWindowFocus(context, aIsVisible, aActionId);
processes.InsertOrUpdate(cp, true);
}
context = canonicalParent;
}
return IPC_OK();
}
@ -6947,11 +6921,9 @@ mozilla::ipc::IPCResult ContentParent::RecvClearFocus(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendClearFocus(context);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendClearFocus(context);
return IPC_OK();
}
@ -7074,11 +7046,11 @@ mozilla::ipc::IPCResult ContentParent::RecvSetFocusedElement(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendSetFocusedElement(context, aNeedsFocus);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendSetFocusedElement(context, aNeedsFocus);
return IPC_OK();
}
@ -7094,12 +7066,11 @@ mozilla::ipc::IPCResult ContentParent::RecvFinalizeFocusOuter(
LOGFOCUS(("ContentParent::RecvFinalizeFocusOuter"));
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp = cpm->GetContentProcessById(
ContentParentId(context->EmbedderProcessId()));
if (cp) {
Unused << cp->SendFinalizeFocusOuter(context, aCanFocus, aCallerType);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->EmbedderProcessId()));
if (cp) {
Unused << cp->SendFinalizeFocusOuter(context, aCanFocus, aCallerType);
}
return IPC_OK();
}
@ -7140,9 +7111,6 @@ mozilla::ipc::IPCResult ContentParent::RecvBlurToParent(
aFocusedBrowsingContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (!cpm) {
return IPC_OK();
}
// If aBrowsingContextToClear and aAncestorBrowsingContextToFocusHandled
// didn't get handled in the process that sent this IPC message and they
@ -7190,11 +7158,10 @@ mozilla::ipc::IPCResult ContentParent::RecvMaybeExitFullscreen(
CanonicalBrowsingContext* context = aContext.get_canonical();
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (cpm) {
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendMaybeExitFullscreen(context);
}
ContentParent* cp =
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
Unused << cp->SendMaybeExitFullscreen(context);
return IPC_OK();
}

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

@ -73,10 +73,8 @@ WebrtcTCPSocket::~WebrtcTCPSocket() {
void WebrtcTCPSocket::SetTabId(dom::TabId aTabId) {
MOZ_ASSERT(NS_IsMainThread());
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
if (cpm) {
dom::ContentParentId cpId = cpm->GetTabProcessId(aTabId);
mAuthProvider = cpm->GetBrowserParentByProcessAndTabId(cpId, aTabId);
}
dom::ContentParentId cpId = cpm->GetTabProcessId(aTabId);
mAuthProvider = cpm->GetBrowserParentByProcessAndTabId(cpId, aTabId);
}
nsresult WebrtcTCPSocket::Write(nsTArray<uint8_t>&& aWriteData) {

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

@ -367,18 +367,13 @@ void CrossProcessPaint::LostFragment(dom::WindowGlobalParent* aWGP) {
void CrossProcessPaint::QueueDependencies(
const nsTHashSet<uint64_t>& aDependencies) {
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
if (!cpm) {
CPP_LOG(
"Skipping QueueDependencies with no"
" current ContentProcessManager.\n");
return;
}
for (const auto& key : aDependencies) {
auto dependency = dom::TabId(key);
// Get the current BrowserParent of the remote browser that was marked
// as a dependency
dom::ContentProcessManager* cpm =
dom::ContentProcessManager::GetSingleton();
dom::ContentParentId cpId = cpm->GetTabProcessId(dependency);
RefPtr<dom::BrowserParent> browser =
cpm->GetBrowserParentByProcessAndTabId(cpId, dependency);