From a57b24343caf35091ed316072e897aa52f4d18bd Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Thu, 8 May 2014 15:43:53 -0700 Subject: [PATCH] Bug 978892 - [e10s] Avoid racing when creating PJavaScript object (r=mrbkap) --- dom/ipc/ContentChild.cpp | 2 ++ dom/ipc/ContentParent.cpp | 4 ++-- dom/ipc/PContent.ipdl | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index fe4546a6d2d..88bb4f95bf2 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -751,6 +751,8 @@ static void FirstIdle(void) mozilla::jsipc::PJavaScriptChild * ContentChild::AllocPJavaScriptChild() { + MOZ_ASSERT(!ManagedPJavaScriptChild().Length()); + nsCOMPtr svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1"); NS_ENSURE_TRUE(svc, nullptr); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 3978fd74126..ac9124820e3 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1357,8 +1357,7 @@ ContentParent::GetCPOWManager() if (ManagedPJavaScriptParent().Length()) { return static_cast(ManagedPJavaScriptParent()[0]); } - JavaScriptParent* actor = static_cast(SendPJavaScriptConstructor()); - return actor; + return nullptr; } TestShellParent* @@ -2233,6 +2232,7 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline) mozilla::jsipc::PJavaScriptParent * ContentParent::AllocPJavaScriptParent() { + MOZ_ASSERT(!ManagedPJavaScriptParent().Length()); mozilla::jsipc::JavaScriptParent *parent = new mozilla::jsipc::JavaScriptParent(); if (!parent->init()) { delete parent; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 2306ccb7295..f6dc678ecff 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -317,8 +317,6 @@ both: async PBlob(BlobConstructorParams params); - async PJavaScript(); - PFileDescriptorSet(FileDescriptor fd); child: @@ -425,6 +423,8 @@ parent: sync GetXPCOMProcessAttributes() returns (bool isOffline); + async PJavaScript(); + PDeviceStorageRequest(DeviceStorageParams params); PFileSystemRequest(FileSystemParams params);