|
|
|
@ -1530,6 +1530,9 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
if (NS_WARN_IF(!cpm)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
cpm->RegisterRemoteFrame(browserParent);
|
|
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrincipal> initialPrincipal =
|
|
|
|
@ -2090,7 +2093,9 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
|
|
|
|
|
mSubprocess = nullptr;
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
cpm->RemoveContentProcess(this->ChildID());
|
|
|
|
|
if (cpm) {
|
|
|
|
|
cpm->RemoveContentProcess(this->ChildID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mDriverCrashGuard) {
|
|
|
|
|
mDriverCrashGuard->NotifyCrashed();
|
|
|
|
@ -2481,6 +2486,8 @@ 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");
|
|
|
|
@ -2613,7 +2620,13 @@ bool ContentParent::LaunchSubprocessResolve(bool aIsSync,
|
|
|
|
|
base::GetProcId(mSubprocess->GetChildProcessHandle());
|
|
|
|
|
Open(mSubprocess->TakeInitialPort(), procId);
|
|
|
|
|
|
|
|
|
|
ContentProcessManager::GetSingleton()->AddContentProcess(this);
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
if (!cpm) {
|
|
|
|
|
NS_WARNING("immediately shutting-down caused by our shutdown");
|
|
|
|
|
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
cpm->AddContentProcess(this);
|
|
|
|
|
|
|
|
|
|
#ifdef MOZ_CODE_COVERAGE
|
|
|
|
|
Unused << SendShareCodeCoverageMutex(
|
|
|
|
@ -4026,7 +4039,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->RegisterRemoteFrame(parent)) {
|
|
|
|
|
if (!cpm || !cpm->RegisterRemoteFrame(parent)) {
|
|
|
|
|
return IPC_FAIL(this, "RegisterRemoteFrame Failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -5156,9 +5169,12 @@ 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();
|
|
|
|
|
RefPtr<BrowserParent> tp =
|
|
|
|
|
cpm->GetTopLevelBrowserParentByProcessAndTabId(this->ChildID(), aTabId);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
tp =
|
|
|
|
|
cpm->GetTopLevelBrowserParentByProcessAndTabId(this->ChildID(), aTabId);
|
|
|
|
|
}
|
|
|
|
|
if (!tp) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
@ -6812,9 +6828,11 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
|
|
|
|
|
// browsing contexts of bc.
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowClose(context, aTrustedCaller);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowClose(context, aTrustedCaller);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -6831,9 +6849,11 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowFocus(context, aCallerType, aActionId);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowFocus(context, aCallerType, aActionId);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -6848,9 +6868,11 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowBlur(context, aCallerType);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendWindowBlur(context, aCallerType);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -6868,9 +6890,11 @@ mozilla::ipc::IPCResult ContentParent::RecvRaiseWindow(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendRaiseWindow(context, aCallerType, aActionId);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendRaiseWindow(context, aCallerType, aActionId);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -6891,21 +6915,23 @@ mozilla::ipc::IPCResult ContentParent::RecvAdjustWindowFocus(
|
|
|
|
|
processes.InsertOrUpdate(this, true);
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
while (context) {
|
|
|
|
|
BrowsingContext* parent = context->GetParent();
|
|
|
|
|
if (!parent) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
context = canonicalParent;
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
@ -6921,9 +6947,11 @@ mozilla::ipc::IPCResult ContentParent::RecvClearFocus(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendClearFocus(context);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendClearFocus(context);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -7046,11 +7074,11 @@ mozilla::ipc::IPCResult ContentParent::RecvSetFocusedElement(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendSetFocusedElement(context, aNeedsFocus);
|
|
|
|
|
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendSetFocusedElement(context, aNeedsFocus);
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -7066,11 +7094,12 @@ mozilla::ipc::IPCResult ContentParent::RecvFinalizeFocusOuter(
|
|
|
|
|
LOGFOCUS(("ContentParent::RecvFinalizeFocusOuter"));
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->EmbedderProcessId()));
|
|
|
|
|
if (cp) {
|
|
|
|
|
Unused << cp->SendFinalizeFocusOuter(context, aCanFocus, aCallerType);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp = cpm->GetContentProcessById(
|
|
|
|
|
ContentParentId(context->EmbedderProcessId()));
|
|
|
|
|
if (cp) {
|
|
|
|
|
Unused << cp->SendFinalizeFocusOuter(context, aCanFocus, aCallerType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
@ -7111,6 +7140,9 @@ 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
|
|
|
|
@ -7158,10 +7190,11 @@ mozilla::ipc::IPCResult ContentParent::RecvMaybeExitFullscreen(
|
|
|
|
|
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
|
|
|
|
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
|
|
|
|
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendMaybeExitFullscreen(context);
|
|
|
|
|
if (cpm) {
|
|
|
|
|
ContentParent* cp =
|
|
|
|
|
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
|
|
|
|
Unused << cp->SendMaybeExitFullscreen(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
|
}
|
|
|
|
|