diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 6322a7342d7e..404a8d703d86 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -281,6 +281,15 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent) { MOZ_ASSERT(NS_IsMainThread()); + if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) { + AutoJSContext cx; + nsCOMPtr ppmm = + do_GetService("@mozilla.org/parentprocessmessagemanager;1"); + nsresult rv = ppmm->BroadcastAsyncMessage( + NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"), + JSVAL_NULL, JSVAL_NULL, cx, 1); + } + if (!mNuwaForkWaitTasks.IsEmpty()) { mNuwaForkWaitTasks.ElementAt(0)->Cancel(); mNuwaForkWaitTasks.RemoveElementAt(0); @@ -312,6 +321,14 @@ PreallocatedProcessManagerImpl::OnNuwaReady() ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess, hal::PROCESS_PRIORITY_FOREGROUND); mIsNuwaReady = true; + if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) { + AutoJSContext cx; + nsCOMPtr ppmm = + do_GetService("@mozilla.org/parentprocessmessagemanager;1"); + nsresult rv = ppmm->BroadcastAsyncMessage( + NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"), + JSVAL_NULL, JSVAL_NULL, cx, 1); + } NuwaFork(); } diff --git a/dom/ipc/tests/mochitest.ini b/dom/ipc/tests/mochitest.ini new file mode 100644 index 000000000000..2f594dd8c012 --- /dev/null +++ b/dom/ipc/tests/mochitest.ini @@ -0,0 +1,2 @@ +[test_NuwaProcessCreation.html] +run-if = toolkit == 'gonk' diff --git a/dom/ipc/tests/moz.build b/dom/ipc/tests/moz.build index 87c88dfddbc5..5244ac16b12d 100644 --- a/dom/ipc/tests/moz.build +++ b/dom/ipc/tests/moz.build @@ -5,4 +5,5 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] +MOCHITEST_MANIFESTS += ['mochitest.ini'] diff --git a/dom/ipc/tests/test_NuwaProcessCreation.html b/dom/ipc/tests/test_NuwaProcessCreation.html new file mode 100644 index 000000000000..55c7e1636a05 --- /dev/null +++ b/dom/ipc/tests/test_NuwaProcessCreation.html @@ -0,0 +1,99 @@ + + + + + + + + + + + +