Bug 1326245: Tell the child processes when we're in safe mode. r?smaug
MozReview-Commit-ID: 5CAHZRRhYEv
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -2307,24 +2307,26 @@ ContentChild::RecvCycleCollect()
}
nsJSContext::CycleCollectNow();
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
const nsCString& name, const nsCString& UAName,
- const nsCString& ID, const nsCString& vendor)
+ const nsCString& ID, const nsCString& vendor,
+ const bool& safeMode)
{
mAppInfo.version.Assign(version);
mAppInfo.buildID.Assign(buildID);
mAppInfo.name.Assign(name);
mAppInfo.UAName.Assign(UAName);
mAppInfo.ID.Assign(ID);
mAppInfo.vendor.Assign(vendor);
+ mAppInfo.safeMode = safeMode;
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentChild::RecvRemoteType(const nsString& aRemoteType)
{
MOZ_ASSERT(DOMStringIsNull(mRemoteType));
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -72,16 +72,17 @@ public:
struct AppInfo
{
nsCString version;
nsCString buildID;
nsCString name;
nsCString UAName;
nsCString ID;
nsCString vendor;
+ bool safeMode;
};
nsresult
ProvideWindowCommon(TabChild* aTabOpener,
mozIDOMWindowProxy* aOpener,
bool aIframeMoz,
uint32_t aChromeFlags,
bool aCalledFromJS,
@@ -377,17 +378,18 @@ public:
virtual mozilla::ipc::IPCResult RecvActivateA11y(const uint32_t& aMsaaID) override;
virtual mozilla::ipc::IPCResult RecvShutdownA11y() override;
virtual mozilla::ipc::IPCResult RecvGarbageCollect() override;
virtual mozilla::ipc::IPCResult RecvCycleCollect() override;
virtual mozilla::ipc::IPCResult RecvAppInfo(const nsCString& version, const nsCString& buildID,
const nsCString& name, const nsCString& UAName,
- const nsCString& ID, const nsCString& vendor) override;
+ const nsCString& ID, const nsCString& vendor,
+ const bool& safeMode) override;
virtual mozilla::ipc::IPCResult RecvRemoteType(const nsString& aRemoteType) override;
const nsAString& GetRemoteType() const;
virtual mozilla::ipc::IPCResult
RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1911,17 +1911,17 @@ ContentParent::InitInternal(ProcessPrior
nsCString version(gAppData->version);
nsCString buildID(gAppData->buildID);
nsCString name(gAppData->name);
nsCString UAName(gAppData->UAName);
nsCString ID(gAppData->ID);
nsCString vendor(gAppData->vendor);
// Sending all information to content process.
- Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
+ Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor, gSafeMode);
}
// Initialize the message manager (and load delayed scripts) now that we
// have established communications with the child.
mMessageManager->InitWithCallback(this);
// Send the child its remote type. On Mac, this needs to be sent prior
// to the message we send to enable the Sandbox (SendStartProcessSandbox)
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -505,17 +505,17 @@ child:
async ActivateA11y(uint32_t aMsaaID);
/**
* Shutdown accessibility engine in content process (if not in use).
*/
async ShutdownA11y();
async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
- nsCString ID, nsCString vendor);
+ nsCString ID, nsCString vendor, bool safeMode);
/**
* Send the remote type associated with the content process.
*/
async RemoteType(nsString aRemoteType);
/**
* Send ServiceWorkerRegistrationData to child process.
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -804,16 +804,21 @@ nsXULAppInfo::SetLogConsoleErrors(bool a
{
gLogConsoleErrors = aValue;
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetInSafeMode(bool *aResult)
{
+ if (XRE_IsContentProcess()) {
+ ContentChild* cc = ContentChild::GetSingleton();
+ *aResult = cc->GetAppInfo().safeMode;
+ return NS_OK;
+ }
*aResult = gSafeMode;
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetOS(nsACString& aResult)
{
aResult.AssignLiteral(OS_TARGET);