|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|