diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6926ed6a8d2e..d07c1b530ba6 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -589,6 +589,10 @@ static nsTArray* sNuwaPrefUpdates; // case between StartUp() and ShutDown() or JoinAllSubprocesses(). static bool sCanLaunchSubprocesses; +// Set to true if the DISABLE_UNSAFE_CPOW_WARNINGS environment variable is +// set. +static bool sDisableUnsafeCPOWWarnings = false; + // The first content child has ID 1, so the chrome process can have ID 0. static uint64_t gContentChildID = 1; @@ -747,6 +751,8 @@ ContentParent::StartUp() // Test the PBackground infrastructure on ENABLE_TESTS builds when a special // testing preference is set. MaybeTestPBackground(); + + sDisableUnsafeCPOWWarnings = PR_GetEnv("DISABLE_UNSAFE_CPOW_WARNINGS"); } /*static*/ void @@ -1747,16 +1753,18 @@ ContentParent::OnBeginSyncTransaction() { if (XRE_GetProcessType() == GeckoProcessType_Default) { nsCOMPtr console(do_GetService(NS_CONSOLESERVICE_CONTRACTID)); JSContext *cx = nsContentUtils::GetCurrentJSContext(); - if (console && cx) { - nsAutoString filename; - uint32_t lineno = 0; - nsJSUtils::GetCallingLocation(cx, filename, &lineno); - nsCOMPtr error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); - error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename, EmptyString(), - lineno, 0, nsIScriptError::warningFlag, "chrome javascript"); - console->LogMessage(error); - } else { - NS_WARNING("Unsafe synchronous IPC message"); + if (!sDisableUnsafeCPOWWarnings) { + if (console && cx) { + nsAutoString filename; + uint32_t lineno = 0; + nsJSUtils::GetCallingLocation(cx, filename, &lineno); + nsCOMPtr error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); + error->Init(NS_LITERAL_STRING("unsafe CPOW usage"), filename, EmptyString(), + lineno, 0, nsIScriptError::warningFlag, "chrome javascript"); + console->LogMessage(error); + } else { + NS_WARNING("Unsafe synchronous IPC message"); + } } } }