forked from mirrors/gecko-dev
Backed out 3 changesets (bug 1647759) for GTest perma failures. CLOSED TREE
Backed out changeset 94c175860a86 (bug1647759) Backed out changeset e7d8a7d2bdf1 (bug1647759) Backed out changeset 2972984413b8 (bug1647759)
This commit is contained in:
parent
6774848e15
commit
ab9f3eb05b
6 changed files with 33 additions and 71 deletions
|
|
@ -223,7 +223,6 @@ static const char* gCallbackPrefsForSocketProcess[] = {
|
|||
"network.trr.",
|
||||
"network.dns.disableIPv6",
|
||||
"network.dns.skipTRR-when-parental-control-enabled",
|
||||
"network.offline-mirrors-connectivity",
|
||||
nullptr,
|
||||
};
|
||||
|
||||
|
|
@ -1370,9 +1369,6 @@ nsresult nsIOService::SetConnectivityInternal(bool aConnectivity) {
|
|||
observerService->NotifyObservers(nullptr,
|
||||
NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC,
|
||||
aConnectivity ? u"true" : u"false");
|
||||
if (SocketProcessReady()) {
|
||||
Unused << mSocketProcess->GetActor()->SendSetConnectivity(aConnectivity);
|
||||
}
|
||||
}
|
||||
|
||||
if (mOffline) {
|
||||
|
|
|
|||
|
|
@ -198,10 +198,10 @@ class nsIOService final : public nsIIOService,
|
|||
void DestroySocketProcess();
|
||||
|
||||
private:
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOffline;
|
||||
bool mOffline;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOfflineForProfileChange;
|
||||
bool mManageLinkStatus;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mConnectivity;
|
||||
bool mConnectivity;
|
||||
|
||||
// Used to handle SetOffline() reentrancy. See the comment in
|
||||
// SetOffline() for more details.
|
||||
|
|
|
|||
|
|
@ -69,12 +69,6 @@ struct SocketDataArgs
|
|||
SocketInfo[] info;
|
||||
};
|
||||
|
||||
struct SocketPorcessInitAttributes {
|
||||
bool mOffline;
|
||||
bool mConnectivity;
|
||||
FileDescriptor? mSandboxBroker;
|
||||
};
|
||||
|
||||
sync protocol PSocketProcess
|
||||
{
|
||||
manages PDNSRequest;
|
||||
|
|
@ -131,14 +125,12 @@ parent:
|
|||
returns (bool aAccepted);
|
||||
|
||||
child:
|
||||
async Init(SocketPorcessInitAttributes aAttributes);
|
||||
async PreferenceUpdate(Pref pref);
|
||||
async RequestMemoryReport(uint32_t generation,
|
||||
bool anonymize,
|
||||
bool minimizeMemoryUsage,
|
||||
FileDescriptor? DMDFile);
|
||||
async SetOffline(bool offline);
|
||||
async SetConnectivity(bool connectivity);
|
||||
async InitLinuxSandbox(FileDescriptor? sandboxBroker);
|
||||
async InitSocketProcessBridgeParent(ProcessId processId, Endpoint<PSocketProcessBridgeParent> endpoint);
|
||||
async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
|
||||
|
|
|
|||
|
|
@ -187,14 +187,6 @@ void SocketProcessChild::CleanUp() {
|
|||
NS_ShutdownXPCOM(nullptr);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessChild::RecvInit(
|
||||
const SocketPorcessInitAttributes& aAttributes) {
|
||||
Unused << RecvSetOffline(aAttributes.mOffline());
|
||||
Unused << RecvSetConnectivity(aAttributes.mConnectivity());
|
||||
Unused << RecvInitLinuxSandbox(aAttributes.mSandboxBroker());
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
IPCResult SocketProcessChild::RecvPreferenceUpdate(const Pref& aPref) {
|
||||
Preferences::SetPreference(aPref);
|
||||
return IPC_OK();
|
||||
|
|
@ -229,17 +221,6 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvSetOffline(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessChild::RecvSetConnectivity(
|
||||
const bool& aConnectivity) {
|
||||
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
||||
nsCOMPtr<nsIIOServiceInternal> ioInternal(do_QueryInterface(io));
|
||||
NS_ASSERTION(ioInternal, "IO Service can not be null");
|
||||
|
||||
ioInternal->SetConnectivity(aConnectivity);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessChild::RecvInitLinuxSandbox(
|
||||
const Maybe<ipc::FileDescriptor>& aBrokerFd) {
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
|
|
|
|||
|
|
@ -38,15 +38,12 @@ class SocketProcessChild final
|
|||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvInit(
|
||||
const SocketPorcessInitAttributes& aAttributes);
|
||||
mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& aPref);
|
||||
mozilla::ipc::IPCResult RecvRequestMemoryReport(
|
||||
const uint32_t& generation, const bool& anonymize,
|
||||
const bool& minimizeMemoryUsage,
|
||||
const Maybe<mozilla::ipc::FileDescriptor>& DMDFile);
|
||||
mozilla::ipc::IPCResult RecvSetOffline(const bool& aOffline);
|
||||
mozilla::ipc::IPCResult RecvSetConnectivity(const bool& aConnectivity);
|
||||
mozilla::ipc::IPCResult RecvInitLinuxSandbox(
|
||||
const Maybe<ipc::FileDescriptor>& aBrokerFd);
|
||||
mozilla::ipc::IPCResult RecvInitSocketProcessBridgeParent(
|
||||
|
|
|
|||
|
|
@ -134,52 +134,48 @@ void SocketProcessHost::InitAfterConnect(bool aSucceeded) {
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mLaunchPhase = LaunchPhase::Complete;
|
||||
if (!aSucceeded) {
|
||||
if (mListener) {
|
||||
mListener->OnProcessLaunchComplete(this, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mSocketProcessParent = MakeUnique<SocketProcessParent>(this);
|
||||
DebugOnly<bool> rv = mSocketProcessParent->Open(
|
||||
TakeChannel(), base::GetProcId(GetChildProcessHandle()));
|
||||
MOZ_ASSERT(rv);
|
||||
if (aSucceeded) {
|
||||
mSocketProcessParent = MakeUnique<SocketProcessParent>(this);
|
||||
DebugOnly<bool> rv = mSocketProcessParent->Open(
|
||||
TakeChannel(), base::GetProcId(GetChildProcessHandle()));
|
||||
MOZ_ASSERT(rv);
|
||||
|
||||
SocketPorcessInitAttributes attributes;
|
||||
nsCOMPtr<nsIIOService> ioService(do_GetIOService());
|
||||
MOZ_ASSERT(ioService, "No IO service?");
|
||||
DebugOnly<nsresult> result = ioService->GetOffline(&attributes.mOffline());
|
||||
MOZ_ASSERT(NS_SUCCEEDED(result), "Failed getting offline?");
|
||||
result = ioService->GetConnectivity(&attributes.mConnectivity());
|
||||
MOZ_ASSERT(NS_SUCCEEDED(result), "Failed getting connectivity?");
|
||||
nsCOMPtr<nsIIOService> ioService(do_GetIOService());
|
||||
MOZ_ASSERT(ioService, "No IO service?");
|
||||
bool offline = false;
|
||||
DebugOnly<nsresult> result = ioService->GetOffline(&offline);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(result), "Failed getting offline?");
|
||||
|
||||
Maybe<FileDescriptor> brokerFd;
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
if (GetEffectiveSocketProcessSandboxLevel() > 0) {
|
||||
auto policy = SandboxBrokerPolicyFactory::GetSocketProcessPolicy(
|
||||
GetActor()->OtherPid());
|
||||
if (policy != nullptr) {
|
||||
attributes.mSandboxBroker() = Some(FileDescriptor());
|
||||
mSandboxBroker =
|
||||
SandboxBroker::Create(std::move(policy), GetActor()->OtherPid(),
|
||||
attributes.mSandboxBroker().ref());
|
||||
// This is unlikely to fail and probably indicates OS resource
|
||||
// exhaustion.
|
||||
Unused << NS_WARN_IF(mSandboxBroker == nullptr);
|
||||
MOZ_ASSERT(attributes.mSandboxBroker().ref().IsValid());
|
||||
if (GetEffectiveSocketProcessSandboxLevel() > 0) {
|
||||
auto policy = SandboxBrokerPolicyFactory::GetSocketProcessPolicy(
|
||||
GetActor()->OtherPid());
|
||||
if (policy != nullptr) {
|
||||
brokerFd = Some(FileDescriptor());
|
||||
mSandboxBroker = SandboxBroker::Create(
|
||||
std::move(policy), GetActor()->OtherPid(), brokerFd.ref());
|
||||
// This is unlikely to fail and probably indicates OS resource
|
||||
// exhaustion.
|
||||
Unused << NS_WARN_IF(mSandboxBroker == nullptr);
|
||||
MOZ_ASSERT(brokerFd.ref().IsValid());
|
||||
}
|
||||
Unused << GetActor()->SendInitLinuxSandbox(brokerFd);
|
||||
}
|
||||
}
|
||||
#endif // XP_LINUX && MOZ_SANDBOX
|
||||
|
||||
Unused << GetActor()->SendInit(attributes);
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
Unused << GetActor()->SendInitProfiler(
|
||||
ProfilerParent::CreateForProcess(GetActor()->OtherPid()));
|
||||
Unused << GetActor()->SendInitProfiler(
|
||||
ProfilerParent::CreateForProcess(GetActor()->OtherPid()));
|
||||
#endif
|
||||
|
||||
Unused << GetActor()->SendSetOffline(offline);
|
||||
}
|
||||
|
||||
if (mListener) {
|
||||
mListener->OnProcessLaunchComplete(this, true);
|
||||
mListener->OnProcessLaunchComplete(this, aSucceeded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue