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

View File

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

View File

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

View File

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

View File

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

View File

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