Backed out 3 changesets (bug 1123461, bug 1123090) for windows build bustage
authorWes Kocher <wkocher@mozilla.com>
Thu, 22 Jan 2015 21:04:33 -0800
changeset 225338 1e53e8c79d9f999410fc82ef5ec1488bd225d14a
parent 225337 7315bdbef259908fc3464f4916a88ede312ffa98
child 225339 a0171e579f201d21643ca0a907b6b76edb15f69a
push id28159
push userryanvm@gmail.com
push dateFri, 23 Jan 2015 17:30:19 +0000
treeherdermozilla-central@a6bbabebed2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1123461, 1123090
milestone38.0a1
backs out2c442905d0af37cb88e48aa5b05bc48d3a4aaef5
d7aa4c72ebaba57bb6a8f1c718bd63fb9e9feec1
8bb689ec80860ae61f03645e3c315c444cd72150
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 3 changesets (bug 1123461, bug 1123090) for windows build bustage Backed out changeset 2c442905d0af (bug 1123461) Backed out changeset d7aa4c72ebab (bug 1123461) Backed out changeset 8bb689ec8086 (bug 1123090)
dom/base/moz.build
dom/base/nsFrameLoader.cpp
dom/base/nsFrameMessageManager.cpp
dom/bindings/BindingUtils.cpp
dom/bindings/moz.build
dom/ipc/CPOWManagerGetter.h
dom/ipc/ContentBridgeChild.cpp
dom/ipc/ContentBridgeChild.h
dom/ipc/ContentBridgeParent.cpp
dom/ipc/ContentBridgeParent.h
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/ipc/moz.build
dom/ipc/nsIContentChild.cpp
dom/ipc/nsIContentParent.cpp
js/ipc/CrossProcessObjectWrappers.h
js/ipc/JavaScriptChild.cpp
js/ipc/JavaScriptParent.cpp
js/ipc/JavaScriptShared.cpp
js/ipc/JavaScriptShared.h
js/ipc/WrapperOwner.h
js/ipc/moz.build
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCWrappedJS.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/moz.build
js/xpconnect/wrappers/AccessCheck.cpp
js/xpconnect/wrappers/WrapperFactory.cpp
js/xpconnect/wrappers/moz.build
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -398,16 +398,17 @@ LOCAL_INCLUDES += [
     '/dom/storage',
     '/dom/svg',
     '/dom/workers',
     '/dom/xbl',
     '/dom/xml',
     '/dom/xslt/xpath',
     '/dom/xul',
     '/image/src',
+    '/js/ipc',
     '/js/xpconnect/src',
     '/js/xpconnect/wrappers',
     '/layout/base',
     '/layout/generic',
     '/layout/style',
     '/layout/svg',
     '/layout/xul',
     '/netwerk/base',
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -75,25 +75,25 @@
 #include "AppProcessChecker.h"
 #include "ContentParent.h"
 #include "TabParent.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/unused.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layout/RenderFrameParent.h"
 #include "nsIAppsService.h"
 #include "GeckoProfiler.h"
 
 #include "jsapi.h"
 #include "mozilla/dom/HTMLIFrameElement.h"
 #include "mozilla/dom/SVGIFrameElement.h"
 #include "nsSandboxFlags.h"
+#include "JavaScriptParent.h"
 #include "mozilla/layers/CompositorChild.h"
 
 #include "mozilla/dom/StructuredCloneUtils.h"
 
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -32,18 +32,19 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/nsIContentParent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/dom/ipc/BlobChild.h"
 #include "mozilla/dom/ipc/BlobParent.h"
+#include "JavaScriptChild.h"
+#include "JavaScriptParent.h"
 #include "mozilla/dom/DOMStringList.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "nsPrintfCString.h"
 #include "nsXULAppAPI.h"
 #include <algorithm>
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 #ifdef XP_WIN
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BindingUtils.h"
 
 #include <algorithm>
 #include <stdarg.h>
 
+#include "JavaScriptParent.h"
+
 #include "mozilla/DebugOnly.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Preferences.h"
 
 #include "AccessCheck.h"
 #include "jsfriendapi.h"
 #include "nsContentUtils.h"
@@ -36,17 +38,16 @@
 #include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/ElementBinding.h"
 #include "mozilla/dom/HTMLObjectElement.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
 #include "mozilla/dom/HTMLSharedObjectElement.h"
 #include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/HTMLAppletElementBinding.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "WorkerPrivate.h"
 #include "nsDOMClassInfo.h"
 
 namespace mozilla {
 namespace dom {
 
 JSErrorFormatString ErrorFormatString[] = {
 #define MSG_DEF(_name, _argc, _str) \
--- a/dom/bindings/moz.build
+++ b/dom/bindings/moz.build
@@ -53,16 +53,17 @@ LOCAL_INCLUDES += [
     '/dom/media/webspeech/recognition',
     '/dom/svg',
     '/dom/workers',
     '/dom/xbl',
     '/dom/xml',
     '/dom/xslt/base',
     '/dom/xslt/xpath',
     '/dom/xul',
+    '/js/ipc',
     '/js/xpconnect/src',
     '/js/xpconnect/wrappers',
     '/layout/style',
     '/layout/xul/tree',
     '/media/mtransport',
     '/media/webrtc/',
     '/media/webrtc/signaling/src/common/time_profiling',
     '/media/webrtc/signaling/src/peerconnection',
--- a/dom/ipc/CPOWManagerGetter.h
+++ b/dom/ipc/CPOWManagerGetter.h
@@ -5,22 +5,22 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_CPOWManagerGetter_h
 #define mozilla_dom_CPOWManagerGetter_h
 
 namespace mozilla {
 
 namespace jsipc {
-class CPOWManager;
+class JavaScriptShared;
 } /* namespace jsipc */
 
 namespace dom {
 class CPOWManagerGetter
 {
 public:
-  virtual mozilla::jsipc::CPOWManager* GetCPOWManager() = 0;
+  virtual mozilla::jsipc::JavaScriptShared* GetCPOWManager() = 0;
 };
 } /* namespace dom */
 
 } /* namespace mozilla */
 
 #endif /* mozilla_dom_CPOWManagerGetter_h */
--- a/dom/ipc/ContentBridgeChild.cpp
+++ b/dom/ipc/ContentBridgeChild.cpp
@@ -5,18 +5,18 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/ContentBridgeChild.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/ipc/BlobChild.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/ipc/InputStreamUtils.h"
+#include "JavaScriptChild.h"
 
 using namespace base;
 using namespace mozilla::ipc;
 using namespace mozilla::jsipc;
 
 namespace mozilla {
 namespace dom {
 
@@ -95,23 +95,24 @@ ContentBridgeChild::SendPBrowserConstruc
                                                       aCpID,
                                                       aIsForApp,
                                                       aIsForBrowser);
 }
 
 // This implementation is identical to ContentChild::GetCPOWManager but we can't
 // move it to nsIContentChild because it calls ManagedPJavaScriptChild() which
 // only exists in PContentChild and PContentBridgeChild.
-jsipc::CPOWManager*
+jsipc::JavaScriptShared*
 ContentBridgeChild::GetCPOWManager()
 {
   if (ManagedPJavaScriptChild().Length()) {
-    return CPOWManagerFor(ManagedPJavaScriptChild()[0]);
+    return static_cast<JavaScriptChild*>(ManagedPJavaScriptChild()[0]);
   }
-  return CPOWManagerFor(SendPJavaScriptConstructor());
+  JavaScriptChild* actor = static_cast<JavaScriptChild*>(SendPJavaScriptConstructor());
+  return actor;
 }
 
 mozilla::jsipc::PJavaScriptChild *
 ContentBridgeChild::AllocPJavaScriptChild()
 {
   return nsIContentChild::AllocPJavaScriptChild();
 }
 
--- a/dom/ipc/ContentBridgeChild.h
+++ b/dom/ipc/ContentBridgeChild.h
@@ -31,17 +31,17 @@ public:
                                 const ClonedMessageData& aData,
                                 InfallibleTArray<jsipc::CpowEntry>&& aCpows,
                                 const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
 
   virtual PBlobChild*
   SendPBlobConstructor(PBlobChild* actor,
                        const BlobConstructorParams& aParams) MOZ_OVERRIDE;
 
-  jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
+  jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
 
   virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
                                        const TabId& aTabId,
                                        const IPCTabContext& aContext,
                                        const uint32_t& aChromeFlags,
                                        const ContentParentId& aCpID,
                                        const bool& aIsForApp,
                                        const bool& aIsForBrowser) MOZ_OVERRIDE;
--- a/dom/ipc/ContentBridgeParent.cpp
+++ b/dom/ipc/ContentBridgeParent.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/ContentBridgeParent.h"
 #include "mozilla/dom/TabParent.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
+#include "JavaScriptParent.h"
 #include "nsXULAppAPI.h"
 
 using namespace base;
 using namespace mozilla::ipc;
 using namespace mozilla::jsipc;
 
 namespace mozilla {
 namespace dom {
@@ -149,19 +149,20 @@ bool
 ContentBridgeParent::DeallocPBrowserParent(PBrowserParent* aParent)
 {
   return nsIContentParent::DeallocPBrowserParent(aParent);
 }
 
 // This implementation is identical to ContentParent::GetCPOWManager but we can't
 // move it to nsIContentParent because it calls ManagedPJavaScriptParent() which
 // only exists in PContentParent and PContentBridgeParent.
-jsipc::CPOWManager*
+jsipc::JavaScriptShared*
 ContentBridgeParent::GetCPOWManager()
 {
   if (ManagedPJavaScriptParent().Length()) {
-    return CPOWManagerFor(ManagedPJavaScriptParent()[0]);
+    return static_cast<JavaScriptParent*>(ManagedPJavaScriptParent()[0]);
   }
-  return CPOWManagerFor(SendPJavaScriptConstructor());
+  JavaScriptParent* actor = static_cast<JavaScriptParent*>(SendPJavaScriptConstructor());
+  return actor;
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/ipc/ContentBridgeParent.h
+++ b/dom/ipc/ContentBridgeParent.h
@@ -36,17 +36,17 @@ public:
   SendPBrowserConstructor(PBrowserParent* aActor,
                           const TabId& aTabId,
                           const IPCTabContext& aContext,
                           const uint32_t& aChromeFlags,
                           const ContentParentId& aCpID,
                           const bool& aIsForApp,
                           const bool& aIsForBrowser) MOZ_OVERRIDE;
 
-  jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
+  jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
 
   virtual ContentParentId ChildID() MOZ_OVERRIDE
   {
     return mChildID;
   }
   virtual bool IsForApp() MOZ_OVERRIDE
   {
     return mIsForApp;
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -36,17 +36,16 @@
 #include "mozilla/dom/asmjscache/PAsmJSCacheEntryChild.h"
 #include "mozilla/dom/nsIContentChild.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/FileDescriptorSetChild.h"
 #include "mozilla/ipc/FileDescriptorUtils.h"
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 #include "mozilla/ipc/TestShellChild.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/PCompositorChild.h"
 #include "mozilla/layers/SharedBufferManagerChild.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/plugins/PluginModuleParent.h"
 
 #if defined(MOZ_CONTENT_SANDBOX)
@@ -159,16 +158,17 @@
 
 #include "ProcessUtils.h"
 #include "StructuredCloneUtils.h"
 #include "URIUtils.h"
 #include "nsContentUtils.h"
 #include "nsIPrincipal.h"
 #include "nsDeviceStorage.h"
 #include "AudioChannelService.h"
+#include "JavaScriptChild.h"
 #include "mozilla/dom/DataStoreService.h"
 #include "mozilla/dom/telephony/PTelephonyChild.h"
 #include "mozilla/dom/time/DateCacheCleaner.h"
 #include "mozilla/dom/voicemail/VoicemailIPCService.h"
 #include "mozilla/net/NeckoMessageUtils.h"
 #include "mozilla/RemoteSpellCheckEngineChild.h"
 
 using namespace base;
@@ -1398,23 +1398,24 @@ ContentChild::AllocPTestShellChild()
 
 bool
 ContentChild::DeallocPTestShellChild(PTestShellChild* shell)
 {
     delete shell;
     return true;
 }
 
-jsipc::CPOWManager*
+jsipc::JavaScriptShared*
 ContentChild::GetCPOWManager()
 {
     if (ManagedPJavaScriptChild().Length()) {
-        return CPOWManagerFor(ManagedPJavaScriptChild()[0]);
+        return static_cast<JavaScriptChild*>(ManagedPJavaScriptChild()[0]);
     }
-    return CPOWManagerFor(SendPJavaScriptConstructor());
+    JavaScriptChild* actor = static_cast<JavaScriptChild*>(SendPJavaScriptConstructor());
+    return actor;
 }
 
 bool
 ContentChild::RecvPTestShellConstructor(PTestShellChild* actor)
 {
     return true;
 }
 
@@ -1905,17 +1906,17 @@ bool
 ContentChild::RecvAsyncMessage(const nsString& aMsg,
                                const ClonedMessageData& aData,
                                InfallibleTArray<CpowEntry>&& aCpows,
                                const IPC::Principal& aPrincipal)
 {
     nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::sChildProcessManager;
     if (cpm) {
         StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
-        CrossProcessCpowHolder cpows(this, aCpows);
+        CpowIdHolder cpows(this, aCpows);
         cpm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(cpm.get()),
                             aMsg, false, &cloneData, &cpows, aPrincipal, nullptr);
     }
     return true;
 }
 
 bool
 ContentChild::RecvGeolocationUpdate(const GeoPosition& somewhere)
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -204,17 +204,17 @@ public:
 
     virtual bool
     RecvDataStoreNotify(const uint32_t& aAppId, const nsString& aName,
                         const nsString& aManifestURL) MOZ_OVERRIDE;
 
     virtual PTestShellChild* AllocPTestShellChild() MOZ_OVERRIDE;
     virtual bool DeallocPTestShellChild(PTestShellChild*) MOZ_OVERRIDE;
     virtual bool RecvPTestShellConstructor(PTestShellChild*) MOZ_OVERRIDE;
-    jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
+    jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
 
     PMobileConnectionChild*
     SendPMobileConnectionConstructor(PMobileConnectionChild* aActor,
                                      const uint32_t& aClientId);
     virtual PMobileConnectionChild*
     AllocPMobileConnectionChild(const uint32_t& aClientId) MOZ_OVERRIDE;
     virtual bool
     DeallocPMobileConnectionChild(PMobileConnectionChild* aActor) MOZ_OVERRIDE;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -62,17 +62,16 @@
 #include "mozilla/hal_sandbox/PHalParent.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/FileDescriptorSetParent.h"
 #include "mozilla/ipc/FileDescriptorUtils.h"
 #include "mozilla/ipc/PFileDescriptorSetParent.h"
 #include "mozilla/ipc/TestShellParent.h"
 #include "mozilla/ipc/InputStreamUtils.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/ImageBridgeParent.h"
 #include "mozilla/layers/SharedBufferManagerParent.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/plugins/PluginBridge.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/ProcessHangMonitorIPC.h"
@@ -174,16 +173,18 @@
 using namespace mozilla::system;
 #endif
 
 #ifdef MOZ_B2G_BT
 #include "BluetoothParent.h"
 #include "BluetoothService.h"
 #endif
 
+#include "JavaScriptParent.h"
+
 #include "mozilla/RemoteSpellCheckEngineParent.h"
 
 #ifdef MOZ_B2G_FM
 #include "mozilla/dom/FMRadioParent.h"
 #endif
 
 #include "Crypto.h"
 
@@ -1990,21 +1991,21 @@ ContentParent::NotifyTabDestroyed(PBrows
         // allow it to perform shutdown tasks.
         MessageLoop::current()->PostTask(
             FROM_HERE,
             NewRunnableMethod(this, &ContentParent::ShutDownProcess,
                               SEND_SHUTDOWN_MESSAGE));
     }
 }
 
-jsipc::CPOWManager*
+jsipc::JavaScriptShared*
 ContentParent::GetCPOWManager()
 {
     if (ManagedPJavaScriptParent().Length()) {
-        return CPOWManagerFor(ManagedPJavaScriptParent()[0]);
+        return static_cast<JavaScriptParent*>(ManagedPJavaScriptParent()[0]);
     }
     return nullptr;
 }
 
 TestShellParent*
 ContentParent::CreateTestShell()
 {
   return static_cast<TestShellParent*>(SendPTestShellConstructor());
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -184,17 +184,17 @@ public:
     void NotifyTabDestroying(PBrowserParent* aTab);
     /** Notify that a tab was destroyed during normal operation. */
     void NotifyTabDestroyed(PBrowserParent* aTab,
                             bool aNotifiedDestroying);
 
     TestShellParent* CreateTestShell();
     bool DestroyTestShell(TestShellParent* aTestShell);
     TestShellParent* GetTestShellSingleton();
-    jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
+    jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
 
     static TabId
     AllocateTabId(const TabId& aOpenerTabId,
                   const IPCTabContext& aContext,
                   const ContentParentId& aCpId);
     static void
     DeallocateTabId(const TabId& aTabId, const ContentParentId& aCpId);
 
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -127,17 +127,17 @@ parent:
                       uint32_t aChromeFlags,
                       bool aCalledFromJS,
                       bool aPositionSpecified,
                       bool aSizeSpecified,
                       nsString aURI,
                       nsString aName,
                       nsString aFeatures,
                       nsString aBaseURI)
-      returns (bool windowOpened, FrameScriptInfo[] frameScripts, nsCString urlToLoad);
+      returns (bool windowOpened, FrameScriptInfo[] frameScripts);
 
     sync SyncMessage(nsString aMessage, ClonedMessageData aData,
                      CpowEntry[] aCpows, Principal aPrincipal)
       returns (nsString[] retval);
 
     prio(high) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
                                CpowEntry[] aCpows, Principal aPrincipal)
       returns (nsString[] retval);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -70,16 +70,17 @@
 #include "nsThreadUtils.h"
 #include "nsWeakReference.h"
 #include "nsWindowWatcher.h"
 #include "PermissionMessageUtils.h"
 #include "nsContentPermissionHelper.h"
 #include "PuppetWidget.h"
 #include "StructuredCloneUtils.h"
 #include "nsViewportInfo.h"
+#include "JavaScriptChild.h"
 #include "nsILoadContext.h"
 #include "ipc/nsGUIEventIPC.h"
 #include "mozilla/gfx/Matrix.h"
 #include "UnitTransforms.h"
 #include "ClientLayerManager.h"
 #include "LayersLogging.h"
 #include "nsIOService.h"
 #include "nsDOMClassInfoID.h"
@@ -1514,17 +1515,16 @@ TabChild::ProvideWindowCommon(nsIDOMWind
   if (aURI) {
     aURI->GetSpec(spec);
   }
 
   NS_ConvertUTF8toUTF16 url(spec);
   nsString name(aName);
   nsAutoCString features(aFeatures);
   nsTArray<FrameScriptInfo> frameScripts;
-  nsCString urlToLoad;
 
   if (aIframeMoz) {
     newChild->SendBrowserFrameOpenWindow(this, url, name,
                                          NS_ConvertUTF8toUTF16(features),
                                          aWindowIsNew);
   } else {
     nsCOMPtr<nsIDOMDocument> domDoc;
     aOpener->GetDocument(getter_AddRefs(domDoc));
@@ -1554,18 +1554,17 @@ TabChild::ProvideWindowCommon(nsIDOMWind
     features.AppendLiteral(",remote");
 
     if (!SendCreateWindow(newChild,
                           aChromeFlags, aCalledFromJS, aPositionSpecified,
                           aSizeSpecified, url,
                           name, NS_ConvertUTF8toUTF16(features),
                           NS_ConvertUTF8toUTF16(baseURIString),
                           aWindowIsNew,
-                          &frameScripts,
-                          &urlToLoad)) {
+                          &frameScripts)) {
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
   if (!*aWindowIsNew) {
     PBrowserChild::Send__delete__(newChild);
     return NS_ERROR_ABORT;
   }
 
@@ -1588,20 +1587,16 @@ TabChild::ProvideWindowCommon(nsIDOMWind
 
   for (size_t i = 0; i < frameScripts.Length(); i++) {
     FrameScriptInfo& info = frameScripts[i];
     if (!newChild->RecvLoadRemoteScript(info.url(), info.runInGlobalScope())) {
       MOZ_CRASH();
     }
   }
 
-  if (!urlToLoad.IsEmpty()) {
-    newChild->RecvLoadURL(urlToLoad);
-  }
-
   nsCOMPtr<nsIDOMWindow> win = do_GetInterface(newChild->WebNavigation());
   win.forget(aReturn);
   return NS_OK;
 }
 
 bool
 TabChild::HasValidInnerSize()
 {
@@ -3003,17 +2998,17 @@ TabChild::RecvAsyncMessage(const nsStrin
                            InfallibleTArray<CpowEntry>&& aCpows,
                            const IPC::Principal& aPrincipal)
 {
   if (mTabChildGlobal) {
     nsCOMPtr<nsIXPConnectJSObjectHolder> kungFuDeathGrip(GetGlobal());
     StructuredCloneData cloneData = UnpackClonedMessageDataForChild(aData);
     nsRefPtr<nsFrameMessageManager> mm =
       static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
-    CrossProcessCpowHolder cpows(Manager(), aCpows);
+    CpowIdHolder cpows(Manager(), aCpows);
     mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal),
                        aMessage, false, &cloneData, &cpows, aPrincipal, nullptr);
   }
   return true;
 }
 
 bool
 TabChild::RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline)
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/BrowserElementParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/PContentPermissionRequestParent.h"
 #include "mozilla/dom/indexedDB/ActorsParent.h"
 #include "mozilla/plugins/PluginWidgetParent.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/Hal.h"
 #include "mozilla/ipc/DocumentRendererParent.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layout/RenderFrameParent.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TouchEvents.h"
@@ -61,16 +60,17 @@
 #include "nsPrintfCString.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsWindowWatcher.h"
 #include "private/pprio.h"
 #include "PermissionMessageUtils.h"
 #include "StructuredCloneUtils.h"
 #include "ColorPickerParent.h"
+#include "JavaScriptParent.h"
 #include "FilePickerParent.h"
 #include "TabChild.h"
 #include "LoadContext.h"
 #include "nsNetCID.h"
 #include "nsIAuthInformation.h"
 #include "nsIAuthPromptCallback.h"
 #include "nsAuthInformationHolder.h"
 #include "nsICancelable.h"
@@ -268,17 +268,17 @@ TabParent::TabParent(nsIContentParent* a
   , mManager(aManager)
   , mMarkedDestroying(false)
   , mIsDestroyed(false)
   , mAppPackageFileDescriptorSent(false)
   , mSendOfflineStatus(true)
   , mChromeFlags(aChromeFlags)
   , mInitedByParent(false)
   , mTabId(aTabId)
-  , mCreatingWindow(false)
+  , mSkipLoad(false)
 {
   MOZ_ASSERT(aManager);
 }
 
 TabParent::~TabParent()
 {
 }
 
@@ -449,58 +449,52 @@ TabParent::RecvEvent(const RemoteDOMEven
   bool dummy;
   target->DispatchEvent(event, &dummy);
   return true;
 }
 
 struct MOZ_STACK_CLASS TabParent::AutoUseNewTab MOZ_FINAL
 {
 public:
-  AutoUseNewTab(TabParent* aNewTab, bool* aWindowIsNew, nsCString* aURLToLoad)
-   : mNewTab(aNewTab), mWindowIsNew(aWindowIsNew), mURLToLoad(aURLToLoad)
+  AutoUseNewTab(TabParent* aNewTab, bool* aWindowIsNew)
+   : mNewTab(aNewTab), mWindowIsNew(aWindowIsNew)
   {
     MOZ_ASSERT(!TabParent::sNextTabParent);
-    MOZ_ASSERT(!aNewTab->mCreatingWindow);
-
     TabParent::sNextTabParent = aNewTab;
-    aNewTab->mCreatingWindow = true;
-    aNewTab->mDelayedURL.Truncate();
+    aNewTab->mSkipLoad = true;
   }
 
   ~AutoUseNewTab()
   {
-    mNewTab->mCreatingWindow = false;
-    *mURLToLoad = mNewTab->mDelayedURL;
+    mNewTab->mSkipLoad = false;
 
     if (TabParent::sNextTabParent) {
       MOZ_ASSERT(TabParent::sNextTabParent == mNewTab);
       TabParent::sNextTabParent = nullptr;
       *mWindowIsNew = false;
     }
   }
 
 private:
   TabParent* mNewTab;
   bool* mWindowIsNew;
-  nsCString* mURLToLoad;
 };
 
 bool
 TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
                             const uint32_t& aChromeFlags,
                             const bool& aCalledFromJS,
                             const bool& aPositionSpecified,
                             const bool& aSizeSpecified,
                             const nsString& aURI,
                             const nsString& aName,
                             const nsString& aFeatures,
                             const nsString& aBaseURI,
                             bool* aWindowIsNew,
-                            InfallibleTArray<FrameScriptInfo>* aFrameScripts,
-                            nsCString* aURLToLoad)
+                            InfallibleTArray<FrameScriptInfo>* aFrameScripts)
 {
   // We always expect to open a new window here. If we don't, it's an error.
   *aWindowIsNew = true;
 
   if (IsBrowserOrApp()) {
     return false;
   }
 
@@ -531,17 +525,17 @@ TabParent::RecvCreateWindow(PBrowserPare
     bool isPrivate;
     nsCOMPtr<nsILoadContext> loadContext = GetLoadContext();
     loadContext->GetUsePrivateBrowsing(&isPrivate);
 
     nsCOMPtr<nsIOpenURIInFrameParams> params = new nsOpenURIInFrameParams();
     params->SetReferrer(aBaseURI);
     params->SetIsPrivate(isPrivate);
 
-    AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
+    AutoUseNewTab aunt(newTab, aWindowIsNew);
 
     nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
     mBrowserDOMWindow->OpenURIInFrame(nullptr, params,
                                       openLocation,
                                       nsIBrowserDOMWindow::OPEN_NEW,
                                       getter_AddRefs(frameLoaderOwner));
     if (!frameLoaderOwner) {
       *aWindowIsNew = false;
@@ -565,17 +559,17 @@ TabParent::RecvCreateWindow(PBrowserPare
   rv = NS_NewURI(getter_AddRefs(finalURI), NS_ConvertUTF16toUTF8(aURI).get(), baseURI);
   NS_ENSURE_SUCCESS(rv, false);
 
   nsAutoCString finalURIString;
   finalURI->GetSpec(finalURIString);
 
   nsCOMPtr<nsIDOMWindow> window;
 
-  AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
+  AutoUseNewTab aunt(newTab, aWindowIsNew);
 
   rv = pwwatch->OpenWindow2(parent, finalURIString.get(),
                             NS_ConvertUTF16toUTF8(aName).get(),
                             NS_ConvertUTF16toUTF8(aFeatures).get(), aCalledFromJS,
                             false, false, this, nullptr, getter_AddRefs(window));
   NS_ENSURE_SUCCESS(rv, false);
 
   nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
@@ -602,44 +596,42 @@ TabParent::GetNextTabParent()
   sNextTabParent = nullptr;
   return result;
 }
 
 bool
 TabParent::SendLoadRemoteScript(const nsString& aURL,
                                 const bool& aRunInGlobalScope)
 {
-  if (mCreatingWindow) {
+  if (mSkipLoad) {
     mDelayedFrameScripts.AppendElement(FrameScriptInfo(aURL, aRunInGlobalScope));
     return true;
   }
 
   MOZ_ASSERT(mDelayedFrameScripts.IsEmpty());
   return PBrowserParent::SendLoadRemoteScript(aURL, aRunInGlobalScope);
 }
 
 void
 TabParent::LoadURL(nsIURI* aURI)
 {
     MOZ_ASSERT(aURI);
 
+    if (mSkipLoad) {
+        // Don't send the message if the child wants to load its own URL.
+        return;
+    }
+
     if (mIsDestroyed) {
         return;
     }
 
     nsCString spec;
     aURI->GetSpec(spec);
 
-    if (mCreatingWindow) {
-        // Don't send the message if the child wants to load its own URL.
-        MOZ_ASSERT(mDelayedURL.IsEmpty());
-        mDelayedURL = spec;
-        return;
-    }
-
     if (!mShown) {
         NS_WARNING(nsPrintfCString("TabParent::LoadURL(%s) called before "
                                    "Show(). Ignoring LoadURL.\n",
                                    spec.get()).get());
         return;
     }
 
     uint32_t appId = OwnOrContainingAppId();
@@ -1343,17 +1335,17 @@ TabParent::RecvSyncMessage(const nsStrin
     ContentParent* parent = Manager()->AsContentParent();
     if (!ContentParent::IgnoreIPCPrincipal() &&
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-  CrossProcessCpowHolder cpows(Manager(), aCpows);
+  CpowIdHolder cpows(Manager(), aCpows);
   return ReceiveMessage(aMessage, true, &cloneData, &cpows, aPrincipal, aJSONRetVal);
 }
 
 bool
 TabParent::RecvRpcMessage(const nsString& aMessage,
                           const ClonedMessageData& aData,
                           InfallibleTArray<CpowEntry>&& aCpows,
                           const IPC::Principal& aPrincipal,
@@ -1365,17 +1357,17 @@ TabParent::RecvRpcMessage(const nsString
     ContentParent* parent = Manager()->AsContentParent();
     if (!ContentParent::IgnoreIPCPrincipal() &&
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-  CrossProcessCpowHolder cpows(Manager(), aCpows);
+  CpowIdHolder cpows(Manager(), aCpows);
   return ReceiveMessage(aMessage, true, &cloneData, &cpows, aPrincipal, aJSONRetVal);
 }
 
 bool
 TabParent::RecvAsyncMessage(const nsString& aMessage,
                             const ClonedMessageData& aData,
                             InfallibleTArray<CpowEntry>&& aCpows,
                             const IPC::Principal& aPrincipal)
@@ -1386,17 +1378,17 @@ TabParent::RecvAsyncMessage(const nsStri
     ContentParent* parent = Manager()->AsContentParent();
     if (!ContentParent::IgnoreIPCPrincipal() &&
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-  CrossProcessCpowHolder cpows(Manager(), aCpows);
+  CpowIdHolder cpows(Manager(), aCpows);
   return ReceiveMessage(aMessage, false, &cloneData, &cpows, aPrincipal, nullptr);
 }
 
 bool
 TabParent::RecvSetCursor(const uint32_t& aCursor, const bool& aForce)
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (widget) {
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -139,18 +139,17 @@ public:
                                   const bool& aCalledFromJS,
                                   const bool& aPositionSpecified,
                                   const bool& aSizeSpecified,
                                   const nsString& aURI,
                                   const nsString& aName,
                                   const nsString& aFeatures,
                                   const nsString& aBaseURI,
                                   bool* aWindowIsNew,
-                                  InfallibleTArray<FrameScriptInfo>* aFrameScripts,
-                                  nsCString* aURLToLoad) MOZ_OVERRIDE;
+                                  InfallibleTArray<FrameScriptInfo>* aFrameScripts) MOZ_OVERRIDE;
     virtual bool RecvSyncMessage(const nsString& aMessage,
                                  const ClonedMessageData& aData,
                                  InfallibleTArray<CpowEntry>&& aCpows,
                                  const IPC::Principal& aPrincipal,
                                  InfallibleTArray<nsString>* aJSONRetVal) MOZ_OVERRIDE;
     virtual bool RecvRpcMessage(const nsString& aMessage,
                                 const ClonedMessageData& aData,
                                 InfallibleTArray<CpowEntry>&& aCpows,
@@ -485,33 +484,24 @@ private:
     // When loading a new tab or window via window.open, the child process sends
     // a new PBrowser to use. We store that tab in sNextTabParent and then
     // proceed through the browser's normal paths to create a new
     // window/tab. When it comes time to create a new TabParent, we instead use
     // sNextTabParent.
     static TabParent* sNextTabParent;
 
     // When loading a new tab or window via window.open, the child is
-    // responsible for loading the URL it wants into the new TabChild. When the
-    // parent receives the CreateWindow message, though, it sends a LoadURL
-    // message, usually for about:blank. It's important for the about:blank load
-    // to get processed because the Firefox frontend expects every new window to
-    // immediately start loading something (see bug 1123090). However, we want
-    // the child to process the LoadURL message before it returns from
-    // ProvideWindow so that the URL sent from the parent doesn't override the
-    // child's URL. This is not possible using our IPC mechanisms. To solve the
-    // problem, we skip sending the LoadURL message in the parent and instead
-    // return the URL as a result from CreateWindow. The child simulates
-    // receiving a LoadURL message before returning from ProvideWindow.
-    //
-    // The mCreatingWindow flag is set while dispatching CreateWindow. During
-    // that time, any LoadURL calls are skipped and the URL is stored in
-    // mSkippedURL.
-    bool mCreatingWindow;
-    nsCString mDelayedURL;
+    // responsible for loading the URL it wants into the new
+    // TabChild. Simultaneously, though, the parent sends a LoadURL message to
+    // every new PBrowser (usually for about:blank). This message usually
+    // arrives after the child has started to load the URL it wants, and
+    // overrides it. To prevent this, we set mSkipLoad to true when creating the
+    // new tab. This flag prevents the unwanted LoadURL message from being sent
+    // by the parent.
+    bool mSkipLoad;
 
     // When loading a new tab or window via window.open, we want to ensure that
     // frame scripts for that tab are loaded before any scripts start to run in
     // the window. We can't load the frame scripts the normal way, using
     // separate IPC messages, since they won't be processed by the child until
     // returning to the event loop, which is too late. Instead, we queue up
     // frame scripts that we intend to load and send them as part of the
     // CreateWindow response. Then TabChild loads them immediately.
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -125,16 +125,17 @@ LOCAL_INCLUDES += [
     '/dom/mobilemessage/ipc',
     '/dom/storage',
     '/dom/workers',
     '/editor/libeditor',
     '/embedding/components/printingui/ipc',
     '/extensions/cookie',
     '/extensions/spellcheck/src',
     '/hal/sandbox',
+    '/js/ipc',
     '/layout/base',
     '/netwerk/base',
     '/toolkit/xre',
     '/uriloader/exthandler',
     '/widget',
     '/xpcom/base',
     '/xpcom/threads',
 ]
--- a/dom/ipc/nsIContentChild.cpp
+++ b/dom/ipc/nsIContentChild.cpp
@@ -10,16 +10,17 @@
 #include "mozilla/dom/DOMTypes.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/ipc/BlobChild.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 
+#include "JavaScriptChild.h"
 #include "nsIJSRuntimeService.h"
 #include "nsPrintfCString.h"
 
 using namespace mozilla::ipc;
 using namespace mozilla::jsipc;
 
 namespace mozilla {
 namespace dom {
@@ -29,23 +30,27 @@ nsIContentChild::AllocPJavaScriptChild()
 {
   nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
   NS_ENSURE_TRUE(svc, nullptr);
 
   JSRuntime *rt;
   svc->GetRuntime(&rt);
   NS_ENSURE_TRUE(svc, nullptr);
 
-  return NewJavaScriptChild(rt);
+  nsAutoPtr<JavaScriptChild> child(new JavaScriptChild(rt));
+  if (!child->init()) {
+    return nullptr;
+  }
+  return child.forget();
 }
 
 bool
 nsIContentChild::DeallocPJavaScriptChild(PJavaScriptChild* aChild)
 {
-  ReleaseJavaScriptChild(aChild);
+  static_cast<JavaScriptChild*>(aChild)->decref();
   return true;
 }
 
 PBrowserChild*
 nsIContentChild::AllocPBrowserChild(const TabId& aTabId,
                                     const IPCTabContext& aContext,
                                     const uint32_t& aChromeFlags,
                                     const ContentParentId& aCpID,
@@ -111,17 +116,17 @@ bool
 nsIContentChild::RecvAsyncMessage(const nsString& aMsg,
                                   const ClonedMessageData& aData,
                                   InfallibleTArray<CpowEntry>&& aCpows,
                                   const IPC::Principal& aPrincipal)
 {
   nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::sChildProcessManager;
   if (cpm) {
     StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
-    CrossProcessCpowHolder cpows(this, aCpows);
+    CpowIdHolder cpows(this, aCpows);
     cpm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(cpm.get()),
                         aMsg, false, &cloneData, &cpows, aPrincipal, nullptr);
   }
   return true;
 }
 
 } // dom
 } // mozilla
--- a/dom/ipc/nsIContentParent.cpp
+++ b/dom/ipc/nsIContentParent.cpp
@@ -10,19 +10,19 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/PTabContext.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/ipc/BlobParent.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/unused.h"
 
+#include "JavaScriptParent.h"
 #include "nsFrameMessageManager.h"
 #include "nsIJSRuntimeService.h"
 #include "nsPrintfCString.h"
 
 using namespace mozilla::jsipc;
 
 // XXX need another bug to move this to a common header.
 #ifdef DISABLE_ASSERTS_FOR_FUZZING
@@ -52,23 +52,27 @@ nsIContentParent::AllocPJavaScriptParent
   nsCOMPtr<nsIJSRuntimeService> svc =
     do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
   NS_ENSURE_TRUE(svc, nullptr);
 
   JSRuntime *rt;
   svc->GetRuntime(&rt);
   NS_ENSURE_TRUE(svc, nullptr);
 
-  return NewJavaScriptParent(rt);
+  nsAutoPtr<JavaScriptParent> parent(new JavaScriptParent(rt));
+  if (!parent->init()) {
+    return nullptr;
+  }
+  return parent.forget();
 }
 
 bool
 nsIContentParent::DeallocPJavaScriptParent(PJavaScriptParent* aParent)
 {
-  ReleaseJavaScriptParent(aParent);
+  static_cast<JavaScriptParent*>(aParent)->decref();
   return true;
 }
 
 bool
 nsIContentParent::CanOpenBrowser(const IPCTabContext& aContext)
 {
   const IPCTabAppBrowserContext& appBrowser = aContext.appBrowserContext();
 
@@ -188,17 +192,17 @@ nsIContentParent::RecvSyncMessage(const 
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
   if (ppm) {
     StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-    CrossProcessCpowHolder cpows(this, aCpows);
+    CpowIdHolder cpows(this, aCpows);
     ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
                         aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals);
   }
   return true;
 }
 
 bool
 nsIContentParent::RecvRpcMessage(const nsString& aMsg,
@@ -215,17 +219,17 @@ nsIContentParent::RecvRpcMessage(const n
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
   if (ppm) {
     StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-    CrossProcessCpowHolder cpows(this, aCpows);
+    CpowIdHolder cpows(this, aCpows);
     ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
                         aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals);
   }
   return true;
 }
 
 bool
 nsIContentParent::RecvAsyncMessage(const nsString& aMsg,
@@ -241,17 +245,17 @@ nsIContentParent::RecvAsyncMessage(const
         parent && principal && !AssertAppPrincipal(parent, principal)) {
       return false;
     }
   }
 
   nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
   if (ppm) {
     StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
-    CrossProcessCpowHolder cpows(this, aCpows);
+    CpowIdHolder cpows(this, aCpows);
     ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
                         aMsg, false, &cloneData, &cpows, aPrincipal, nullptr);
   }
   return true;
 }
 
 } // namespace dom
 } // namespace mozilla
deleted file mode 100644
--- a/js/ipc/CrossProcessObjectWrappers.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: set ts=8 sw=4 et tw=80:
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_jsipc_CrossProcessObjectWrappers_h__
-#define mozilla_jsipc_CrossProcessObjectWrappers_h__
-
-#include "js/TypeDecls.h"
-#include "mozilla/jsipc/JavaScriptTypes.h"
-#include "nsID.h"
-#include "nsFrameMessageManager.h"
-#include "nsString.h"
-#include "nsTArray.h"
-
-namespace mozilla {
-
-namespace dom {
-class CPOWManagerGetter;
-}
-
-namespace jsipc {
-
-class PJavaScriptParent;
-class PJavaScriptChild;
-
-class CPOWManager
-{
-  public:
-    virtual bool Unwrap(JSContext *cx,
-                        const InfallibleTArray<CpowEntry> &aCpows,
-                        JS::MutableHandleObject objp) = 0;
-
-    virtual bool Wrap(JSContext *cx,
-                      JS::HandleObject aObj,
-                      InfallibleTArray<CpowEntry> *outCpows) = 0;
-};
-
-class CrossProcessCpowHolder : public CpowHolder
-{
-  public:
-    CrossProcessCpowHolder(dom::CPOWManagerGetter *managerGetter,
-                           const InfallibleTArray<CpowEntry> &cpows);
-
-    bool ToObject(JSContext *cx, JS::MutableHandleObject objp);
-
-  private:
-    CPOWManager *js_;
-    const InfallibleTArray<CpowEntry> &cpows_;
-};
-
-CPOWManager*
-CPOWManagerFor(PJavaScriptParent* aParent);
-
-CPOWManager*
-CPOWManagerFor(PJavaScriptChild* aChild);
-
-bool
-IsCPOW(JSObject *obj);
-
-bool
-IsWrappedCPOW(JSObject *obj);
-
-nsresult
-InstanceOf(JSObject *obj, const nsID *id, bool *bp);
-
-bool
-DOMInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp);
-
-void
-GetWrappedCPOWTag(JSObject *obj, nsACString &out);
-
-PJavaScriptParent *
-NewJavaScriptParent(JSRuntime *rt);
-
-void
-ReleaseJavaScriptParent(PJavaScriptParent *parent);
-
-PJavaScriptChild *
-NewJavaScriptChild(JSRuntime *rt);
-
-void
-ReleaseJavaScriptChild(PJavaScriptChild *child);
-
-} // namespace jsipc
-} // namespace mozilla
-
-#endif // mozilla_jsipc_CrossProcessObjectWrappers_h__
--- a/js/ipc/JavaScriptChild.cpp
+++ b/js/ipc/JavaScriptChild.cpp
@@ -59,25 +59,8 @@ JavaScriptChild::updateWeakPointers()
 
 JSObject *
 JavaScriptChild::scopeForTargetObjects()
 {
     // CPOWs from the parent need to point into the child's privileged junk
     // scope so that they can benefit from XrayWrappers in the child.
     return xpc::PrivilegedJunkScope();
 }
-
-PJavaScriptChild *
-mozilla::jsipc::NewJavaScriptChild(JSRuntime *rt)
-{
-    JavaScriptChild *child = new JavaScriptChild(rt);
-    if (!child->init()) {
-        delete child;
-        return nullptr;
-    }
-    return child;
-}
-
-void
-mozilla::jsipc::ReleaseJavaScriptChild(PJavaScriptChild *child)
-{
-    static_cast<JavaScriptChild *>(child)->decref();
-}
--- a/js/ipc/JavaScriptParent.cpp
+++ b/js/ipc/JavaScriptParent.cpp
@@ -71,25 +71,8 @@ JavaScriptParent::CloneProtocol(Channel*
 {
     ContentParent *contentParent = aCtx->GetContentParent();
     nsAutoPtr<PJavaScriptParent> actor(contentParent->AllocPJavaScriptParent());
     if (!actor || !contentParent->RecvPJavaScriptConstructor(actor)) {
         return nullptr;
     }
     return actor.forget();
 }
-
-PJavaScriptParent *
-mozilla::jsipc::NewJavaScriptParent(JSRuntime *rt)
-{
-    JavaScriptParent *parent = new JavaScriptParent(rt);
-    if (!parent->init()) {
-        delete parent;
-        return nullptr;
-    }
-    return parent;
-}
-
-void
-mozilla::jsipc::ReleaseJavaScriptParent(PJavaScriptParent *parent)
-{
-    static_cast<JavaScriptParent *>(parent)->decref();
-}
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -667,28 +667,27 @@ JSObject *
 JavaScriptShared::fromObjectOrNullVariant(JSContext *cx, ObjectOrNullVariant objVar)
 {
     if (objVar.type() == ObjectOrNullVariant::TNullVariant)
         return nullptr;
 
     return fromObjectVariant(cx, objVar.get_ObjectVariant());
 }
 
-CrossProcessCpowHolder::CrossProcessCpowHolder(dom::CPOWManagerGetter *managerGetter,
-                                               const InfallibleTArray<CpowEntry> &cpows)
+CpowIdHolder::CpowIdHolder(dom::CPOWManagerGetter *managerGetter, const InfallibleTArray<CpowEntry> &cpows)
   : js_(nullptr),
     cpows_(cpows)
 {
     // Only instantiate the CPOW manager if we might need it later.
     if (cpows.Length())
         js_ = managerGetter->GetCPOWManager();
 }
 
 bool
-CrossProcessCpowHolder::ToObject(JSContext *cx, JS::MutableHandleObject objp)
+CpowIdHolder::ToObject(JSContext *cx, JS::MutableHandleObject objp)
 {
     if (!cpows_.Length())
         return true;
 
     return js_->Unwrap(cx, cpows_, objp);
 }
 
 bool
@@ -753,20 +752,8 @@ JavaScriptShared::Wrap(JSContext *cx, Ha
         if (!toVariant(cx, v, &var))
             return false;
 
         outCpows->AppendElement(CpowEntry(str, var));
     }
 
     return true;
 }
-
-CPOWManager*
-mozilla::jsipc::CPOWManagerFor(PJavaScriptParent* aParent)
-{
-    return static_cast<JavaScriptParent *>(aParent);
-}
-
-CPOWManager*
-mozilla::jsipc::CPOWManagerFor(PJavaScriptChild* aChild)
-{
-    return static_cast<JavaScriptChild *>(aChild);
-}
--- a/js/ipc/JavaScriptShared.h
+++ b/js/ipc/JavaScriptShared.h
@@ -4,19 +4,19 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_jsipc_JavaScriptShared_h__
 #define mozilla_jsipc_JavaScriptShared_h__
 
 #include "mozilla/dom/DOMTypes.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/jsipc/PJavaScript.h"
 #include "nsJSUtils.h"
+#include "nsFrameMessageManager.h"
 
 namespace mozilla {
 
 namespace dom {
 class CPOWManagerGetter;
 }
 
 namespace jsipc {
@@ -60,16 +60,28 @@ class ObjectId {
     ObjectId() : serialNumber_(0), hasXrayWaiver_(false) {}
 
     uint64_t serialNumber_ : SERIAL_NUMBER_BITS;
     bool hasXrayWaiver_ : 1;
 };
 
 class JavaScriptShared;
 
+class CpowIdHolder : public CpowHolder
+{
+  public:
+    CpowIdHolder(dom::CPOWManagerGetter *managerGetter, const InfallibleTArray<CpowEntry> &cpows);
+
+    bool ToObject(JSContext *cx, JS::MutableHandleObject objp);
+
+  private:
+    JavaScriptShared *js_;
+    const InfallibleTArray<CpowEntry> &cpows_;
+};
+
 // DefaultHasher<T> requires that T coerce to an integral type. We could make
 // ObjectId do that, but doing so would weaken our type invariants, so we just
 // reimplement it manually.
 struct ObjectIdHasher
 {
     typedef ObjectId Lookup;
     static js::HashNumber hash(const Lookup &l) {
         return l.serialize();
@@ -127,17 +139,17 @@ class ObjectToIdMap
   private:
     static void keyMarkCallback(JSTracer *trc, JSObject *key, void *data);
 
     Table *table_;
 };
 
 class Logging;
 
-class JavaScriptShared : public CPOWManager
+class JavaScriptShared
 {
   public:
     explicit JavaScriptShared(JSRuntime *rt);
     virtual ~JavaScriptShared();
 
     bool init();
 
     void decref();
--- a/js/ipc/WrapperOwner.h
+++ b/js/ipc/WrapperOwner.h
@@ -5,17 +5,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_jsipc_WrapperOwner_h__
 #define mozilla_jsipc_WrapperOwner_h__
 
 #include "JavaScriptShared.h"
 #include "mozilla/ipc/ProtocolUtils.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "js/Class.h"
 #include "jsproxy.h"
 
 #ifdef XP_WIN
 #undef GetClassName
 #undef GetClassInfo
 #endif
 
@@ -145,12 +144,27 @@ class WrapperOwner : public virtual Java
     virtual bool SendGetPropertyKeys(const ObjectId &objId, const uint32_t &flags,
                                      ReturnStatus *rs, nsTArray<JSIDVariant> *ids) = 0;
     virtual bool SendInstanceOf(const ObjectId &objId, const JSIID &iid,
                                 ReturnStatus *rs, bool *instanceof) = 0;
     virtual bool SendDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth,
                                    ReturnStatus *rs, bool *instanceof) = 0;
 };
 
+bool
+IsCPOW(JSObject *obj);
+
+bool
+IsWrappedCPOW(JSObject *obj);
+
+nsresult
+InstanceOf(JSObject *obj, const nsID *id, bool *bp);
+
+bool
+DOMInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp);
+
+void
+GetWrappedCPOWTag(JSObject *obj, nsACString &out);
+
 } // jsipc
 } // mozilla
 
 #endif // mozilla_jsipc_WrapperOwner_h__
--- a/js/ipc/moz.build
+++ b/js/ipc/moz.build
@@ -21,20 +21,16 @@ IPDL_SOURCES += [
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX']
 
-EXPORTS.mozilla.jsipc = [
-    'CrossProcessObjectWrappers.h',
-]
-
 LOCAL_INCLUDES += [
     '/dom/base',
     '/js/ipc',
     '/js/public',
     '/js/xpconnect/src',
     '/js/xpconnect/wrappers',
 ]
 
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -8,20 +8,20 @@
 
 #include "xpcprivate.h"
 #include "xpcIJSModuleLoader.h"
 #include "XPCJSWeakReference.h"
 #include "WrapperFactory.h"
 #include "nsJSUtils.h"
 #include "mozJSComponentLoader.h"
 #include "nsContentUtils.h"
+#include "JavaScriptParent.h"
 #include "jsfriendapi.h"
 #include "js/StructuredClone.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/Preferences.h"
 #include "nsJSEnvironment.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/XPTInterfaceInfoManager.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/StructuredCloneTags.h"
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -16,21 +16,21 @@
 #include "WrapperFactory.h"
 
 #include "nsWrapperCacheInlines.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/CharacterEncoding.h"
 #include "jsprf.h"
+#include "JavaScriptParent.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/PrimitiveConversions.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 
 using namespace xpc;
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace JS;
 
 //#define STRICT_CHECK_OF_UNICODE
 #ifdef STRICT_CHECK_OF_UNICODE
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* An xpcom implementation of the JavaScript nsIID and nsCID objects. */
 
 #include "xpcprivate.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
+#include "JavaScriptParent.h"
 #include "mozilla/StaticPtr.h"
 
 using namespace mozilla::dom;
 using namespace JS;
 
 /***************************************************************************/
 // nsJSID
 
--- a/js/xpconnect/src/XPCWrappedJS.cpp
+++ b/js/xpconnect/src/XPCWrappedJS.cpp
@@ -3,20 +3,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Class that wraps JS objects to appear as XPCOM objects. */
 
 #include "xpcprivate.h"
 #include "jsprf.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsContentUtils.h"
 #include "nsThreadUtils.h"
+#include "JavaScriptParent.h"
 
 using namespace mozilla;
 
 // NOTE: much of the fancy footwork is done in xpcstubs.cpp
 
 
 // nsXPCWrappedJS lifetime.
 //
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -8,21 +8,21 @@
 
 #include "xpcprivate.h"
 #include "jsprf.h"
 #include "nsArrayEnumerator.h"
 #include "nsContentUtils.h"
 #include "nsWrapperCache.h"
 #include "AccessCheck.h"
 #include "nsJSUtils.h"
+#include "JavaScriptParent.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 using namespace xpc;
 using namespace JS;
 using namespace mozilla;
 using namespace mozilla::dom;
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -61,16 +61,17 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../loader',
     '../wrappers',
     '/caps',
     '/dom/base',
     '/dom/html',
     '/dom/svg',
     '/dom/workers',
+    '/js/ipc',
     '/layout/base',
     '/layout/style',
     '/xpcom/reflect/xptinfo',
 ]
 
 if CONFIG['MOZ_B2G_BT']:
     LOCAL_INCLUDES += [
         '/dom/bluetooth',
--- a/js/xpconnect/wrappers/AccessCheck.cpp
+++ b/js/xpconnect/wrappers/AccessCheck.cpp
@@ -3,25 +3,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AccessCheck.h"
 
 #include "nsJSPrincipals.h"
 #include "nsGlobalWindow.h"
+#include "JavaScriptParent.h"
 
 #include "XPCWrapper.h"
 #include "XrayWrapper.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/LocationBinding.h"
 #include "mozilla/dom/WindowBinding.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "nsIDOMWindowCollection.h"
 #include "nsJSUtils.h"
 
 using namespace mozilla;
 using namespace JS;
 using namespace js;
 
 namespace xpc {
--- a/js/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/xpconnect/wrappers/WrapperFactory.cpp
@@ -11,18 +11,18 @@
 #include "AccessCheck.h"
 #include "XPCWrapper.h"
 #include "ChromeObjectWrapper.h"
 #include "WrapperFactory.h"
 
 #include "xpcprivate.h"
 #include "XPCMaps.h"
 #include "mozilla/dom/BindingUtils.h"
+#include "JavaScriptParent.h"
 #include "jsfriendapi.h"
-#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/Likely.h"
 #include "nsContentUtils.h"
 #include "nsXULAppAPI.h"
 
 using namespace JS;
 using namespace js;
 using namespace mozilla;
 
--- a/js/xpconnect/wrappers/moz.build
+++ b/js/xpconnect/wrappers/moz.build
@@ -34,10 +34,11 @@ MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../../../dom/base',
     '../src',
+    '/js/ipc',
 ]