Bug 1174857 - Propagate safemode to the child process. r=billm

This commit is contained in:
Benoit Girard 2015-06-16 17:16:51 -04:00
parent 7c76048c28
commit 5027a39f1e
6 changed files with 25 additions and 4 deletions

View File

@ -68,6 +68,7 @@
#include "mozilla/unused.h"
#include "mozInlineSpellChecker.h"
#include "nsAppRunner.h"
#include "nsIConsoleListener.h"
#include "nsICycleCollectorListener.h"
#include "nsIDragService.h"
@ -800,17 +801,23 @@ ContentChild::InitXPCOM()
bool isOffline, isLangRTL;
bool isConnected;
bool isSafeMode;
ClipboardCapabilities clipboardCaps;
DomainPolicyClone domainPolicy;
OwningSerializedStructuredCloneBuffer initialData;
SendGetXPCOMProcessAttributes(&isOffline, &isConnected,
&isLangRTL, &mAvailableDictionaries,
&clipboardCaps, &domainPolicy, &initialData);
&clipboardCaps, &domainPolicy, &initialData,
&isSafeMode);
RecvSetOffline(isOffline);
RecvSetConnectivity(isConnected);
RecvBidiKeyboardNotify(isLangRTL);
if (isSafeMode) {
mozilla::startup::SetSafeMode();
}
// Create the CPOW manager as soon as possible.
SendPJavaScriptConstructor();

View File

@ -3218,7 +3218,8 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
OwningSerializedStructuredCloneBuffer* initialData)
OwningSerializedStructuredCloneBuffer* initialData,
bool* aIsSafeMode)
{
nsCOMPtr<nsIIOService> io(do_GetIOService());
MOZ_ASSERT(io, "No IO service?");
@ -3273,6 +3274,8 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
buffer.steal(&initialData->data, &initialData->dataLength);
}
*aIsSafeMode = mozilla::startup::IsSafeMode();
return true;
}

View File

@ -554,7 +554,8 @@ private:
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
OwningSerializedStructuredCloneBuffer* initialData) override;
OwningSerializedStructuredCloneBuffer* initialData,
bool* aIsSafeMode) override;
virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) override;

View File

@ -671,7 +671,8 @@ parent:
returns (bool isOffline, bool isConnected, bool isLangRTL, nsString[] dictionaries,
ClipboardCapabilities clipboardCaps,
DomainPolicyClone domainPolicy,
OwningSerializedStructuredCloneBuffer initialData);
OwningSerializedStructuredCloneBuffer initialData,
bool isSafeMode);
sync CreateChildProcess(IPCTabContext context,
ProcessPriority priority,

View File

@ -4535,6 +4535,12 @@ XRE_IsParentProcess()
return XRE_GetProcessType() == GeckoProcessType_Default;
}
void
mozilla::startup::SetSafeMode()
{
gSafeMode = true;
}
#ifdef E10S_TESTING_ONLY
static void
LogE10sBlockedReason(const char *reason) {

View File

@ -112,6 +112,9 @@ WriteStatusApplied(LPCWSTR updateDirPath);
namespace mozilla {
namespace startup {
extern GeckoProcessType sChildProcessType;
void SetSafeMode();
bool IsSafeMode() { return gSafeMode; }
}
}