try: -b do -p linux,linux64,win32,win64 -u mochitest-2 -t none
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Thu, 26 Jan 2017 15:17:26 +0100
changeset 944880 b6f8f65a4c6dad8e4010365b71080d69cd599804
parent 944823 0b9791069566017bdb4382eec876c13e5233c986
child 1028749 03afdc90873251b98fd3d3e8a09a2d2264a8c3a5
push id166355
push usergkrizsanits@mozilla.com
push dateThu, 26 Jan 2017 14:18:15 +0000
treeherdertry@b6f8f65a4c6d [default view] [failures only]
milestone54.0a1
try: -b do -p linux,linux64,win32,win64 -u mochitest-2 -t none
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/ContentProcess.cpp
dom/ipc/PContent.ipdl
dom/ipc/tests/test_Preallocated.html
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2671,23 +2671,28 @@ ContentParent::RecvGetXPCOMProcessAttrib
   // send the file URL instead.
   StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
   if (ucs) {
     SerializeURI(ucs->GetSheetURI(), *aUserContentCSSURL);
   } else {
     SerializeURI(nullptr, *aUserContentCSSURL);
   }
 
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+ContentParent::RecvIntitializationFinished()
+{
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
     nsAutoString cpId;
     cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
-    obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-initializing", cpId.get());
-  }
-
+    obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-initialized", cpId.get());
+  }
   return IPC_OK();
 }
 
 mozilla::jsipc::PJavaScriptParent *
 ContentParent::AllocPJavaScriptParent()
 {
   MOZ_ASSERT(ManagedPJavaScriptParent().IsEmpty());
   return nsIContentParent::AllocPJavaScriptParent();
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -748,16 +748,19 @@ private:
                                 InfallibleTArray<nsString>* dictionaries,
                                 ClipboardCapabilities* clipboardCaps,
                                 DomainPolicyClone* domainPolicy,
                                 StructuredCloneData* initialData,
                                 InfallibleTArray<FontFamilyListEntry>* fontFamilies,
                                 OptionalURIParams* aUserContentSheetURL,
                                 nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;
 
+  virtual mozilla::ipc::IPCResult
+  RecvIntitializationFinished() override;
+
   virtual bool
   DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) override;
 
   virtual bool
   DeallocPRemoteSpellcheckEngineParent(PRemoteSpellcheckEngineParent*) override;
 
   virtual PBrowserParent* AllocPBrowserParent(const TabId& aTabId,
                                               const IPCTabContext& aContext,
--- a/dom/ipc/ContentProcess.cpp
+++ b/dom/ipc/ContentProcess.cpp
@@ -142,16 +142,18 @@ ContentProcess::Init()
 #if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
     mContent.SetProfileDir(mProfileDir);
 #endif
 
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
     SetUpSandboxEnvironment();
 #endif
 
+    mContent.SendIntitializationFinished();
+
     return true;
 }
 
 // Note: CleanUp() never gets called in non-debug builds because we exit early
 // in ContentChild::ActorDestroy().
 void
 ContentProcess::CleanUp()
 {
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -675,16 +675,18 @@ parent:
                  bool haveBidiKeyboards, nsString[] dictionaries,
                  ClipboardCapabilities clipboardCaps,
                  DomainPolicyClone domainPolicy,
                  StructuredCloneData initialData,
                  FontFamilyListEntry[] fontFamilies /* used on MacOSX only */,
                  OptionalURIParams userContentSheetURL,
                  LookAndFeelInt[] lookAndFeelIntCache);
 
+    async IntitializationFinished();
+
     sync CreateChildProcess(IPCTabContext context,
                             ProcessPriority priority,
                             TabId openerTabId)
         returns (ContentParentId cpId, bool isForBrowser, TabId tabId);
     sync BridgeToChildProcess(ContentParentId cpId);
 
     async CreateGMPService();
 
--- a/dom/ipc/tests/test_Preallocated.html
+++ b/dom/ipc/tests/test_Preallocated.html
@@ -14,17 +14,17 @@ Test that the preallocated process start
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 function expectProcessCreated() {
   return new Promise(resolve => {
     function parentExpectProcessCreated() {
       Components.utils.import('resource://gre/modules/Services.jsm');
-      let topic = "ipc:content-initializing";
+      let topic = "ipc:content-initialized";
       let obs = { observe: function() {
         Services.obs.removeObserver(obs, topic);
         sendAsyncMessage('process-created');
       }}
       Services.obs.addObserver(obs, topic, /* weak = */ false);
     }
 
     let helper = SpecialPowers.loadChromeScript(parentExpectProcessCreated);