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)
This commit is contained in:
Wes Kocher 2015-01-22 21:04:33 -08:00
parent 1856893b09
commit d19e92ad17
37 changed files with 123 additions and 241 deletions

View File

@ -403,6 +403,7 @@ LOCAL_INCLUDES += [
'/dom/xslt/xpath',
'/dom/xul',
'/image/src',
'/js/ipc',
'/js/xpconnect/src',
'/js/xpconnect/wrappers',
'/layout/base',

View File

@ -80,7 +80,6 @@
#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"
@ -89,6 +88,7 @@
#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"

View File

@ -37,8 +37,9 @@
#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>

View File

@ -9,6 +9,8 @@
#include <algorithm>
#include <stdarg.h>
#include "JavaScriptParent.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Assertions.h"
@ -41,7 +43,6 @@
#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"

View File

@ -58,6 +58,7 @@ LOCAL_INCLUDES += [
'/dom/xslt/base',
'/dom/xslt/xpath',
'/dom/xul',
'/js/ipc',
'/js/xpconnect/src',
'/js/xpconnect/wrappers',
'/layout/style',

View File

@ -10,14 +10,14 @@
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 */

View File

@ -10,8 +10,8 @@
#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;
@ -100,13 +100,14 @@ ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
// 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 *

View File

@ -36,7 +36,7 @@ public:
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,

View File

@ -6,7 +6,7 @@
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "JavaScriptParent.h"
#include "nsXULAppAPI.h"
using namespace base;
@ -154,13 +154,14 @@ ContentBridgeParent::DeallocPBrowserParent(PBrowserParent* 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

View File

@ -41,7 +41,7 @@ public:
const bool& aIsForApp,
const bool& aIsForBrowser) MOZ_OVERRIDE;
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
virtual ContentParentId ChildID() MOZ_OVERRIDE
{

View File

@ -41,7 +41,6 @@
#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"
@ -164,6 +163,7 @@
#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"
@ -1403,13 +1403,14 @@ ContentChild::DeallocPTestShellChild(PTestShellChild* 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
@ -1910,7 +1911,7 @@ ContentChild::RecvAsyncMessage(const nsString& aMsg,
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);
}

View File

@ -209,7 +209,7 @@ public:
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,

View File

@ -67,7 +67,6 @@
#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"
@ -179,6 +178,8 @@ using namespace mozilla::system;
#include "BluetoothService.h"
#endif
#include "JavaScriptParent.h"
#include "mozilla/RemoteSpellCheckEngineParent.h"
#ifdef MOZ_B2G_FM
@ -1995,11 +1996,11 @@ ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
}
}
jsipc::CPOWManager*
jsipc::JavaScriptShared*
ContentParent::GetCPOWManager()
{
if (ManagedPJavaScriptParent().Length()) {
return CPOWManagerFor(ManagedPJavaScriptParent()[0]);
return static_cast<JavaScriptParent*>(ManagedPJavaScriptParent()[0]);
}
return nullptr;
}

View File

@ -189,7 +189,7 @@ public:
TestShellParent* CreateTestShell();
bool DestroyTestShell(TestShellParent* aTestShell);
TestShellParent* GetTestShellSingleton();
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
static TabId
AllocateTabId(const TabId& aOpenerTabId,

View File

@ -132,7 +132,7 @@ parent:
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)

View File

@ -75,6 +75,7 @@
#include "PuppetWidget.h"
#include "StructuredCloneUtils.h"
#include "nsViewportInfo.h"
#include "JavaScriptChild.h"
#include "nsILoadContext.h"
#include "ipc/nsGUIEventIPC.h"
#include "mozilla/gfx/Matrix.h"
@ -1519,7 +1520,6 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
nsString name(aName);
nsAutoCString features(aFeatures);
nsTArray<FrameScriptInfo> frameScripts;
nsCString urlToLoad;
if (aIframeMoz) {
newChild->SendBrowserFrameOpenWindow(this, url, name,
@ -1559,8 +1559,7 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
name, NS_ConvertUTF8toUTF16(features),
NS_ConvertUTF8toUTF16(baseURIString),
aWindowIsNew,
&frameScripts,
&urlToLoad)) {
&frameScripts)) {
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1593,10 +1592,6 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
}
}
if (!urlToLoad.IsEmpty()) {
newChild->RecvLoadURL(urlToLoad);
}
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(newChild->WebNavigation());
win.forget(aReturn);
return NS_OK;
@ -3008,7 +3003,7 @@ TabChild::RecvAsyncMessage(const nsString& aMessage,
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);
}

View File

@ -18,7 +18,6 @@
#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"
@ -66,6 +65,7 @@
#include "PermissionMessageUtils.h"
#include "StructuredCloneUtils.h"
#include "ColorPickerParent.h"
#include "JavaScriptParent.h"
#include "FilePickerParent.h"
#include "TabChild.h"
#include "LoadContext.h"
@ -273,7 +273,7 @@ TabParent::TabParent(nsIContentParent* aManager,
, mChromeFlags(aChromeFlags)
, mInitedByParent(false)
, mTabId(aTabId)
, mCreatingWindow(false)
, mSkipLoad(false)
{
MOZ_ASSERT(aManager);
}
@ -454,21 +454,17 @@ TabParent::RecvEvent(const RemoteDOMEvent& aEvent)
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);
@ -480,7 +476,6 @@ public:
private:
TabParent* mNewTab;
bool* mWindowIsNew;
nsCString* mURLToLoad;
};
bool
@ -494,8 +489,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
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;
@ -536,7 +530,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
params->SetReferrer(aBaseURI);
params->SetIsPrivate(isPrivate);
AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
AutoUseNewTab aunt(newTab, aWindowIsNew);
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
mBrowserDOMWindow->OpenURIInFrame(nullptr, params,
@ -570,7 +564,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
nsCOMPtr<nsIDOMWindow> window;
AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
AutoUseNewTab aunt(newTab, aWindowIsNew);
rv = pwwatch->OpenWindow2(parent, finalURIString.get(),
NS_ConvertUTF16toUTF8(aName).get(),
@ -607,7 +601,7 @@ bool
TabParent::SendLoadRemoteScript(const nsString& aURL,
const bool& aRunInGlobalScope)
{
if (mCreatingWindow) {
if (mSkipLoad) {
mDelayedFrameScripts.AppendElement(FrameScriptInfo(aURL, aRunInGlobalScope));
return true;
}
@ -621,6 +615,11 @@ 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;
}
@ -628,13 +627,6 @@ TabParent::LoadURL(nsIURI* aURI)
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",
@ -1348,7 +1340,7 @@ TabParent::RecvSyncMessage(const nsString& aMessage,
}
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
CrossProcessCpowHolder cpows(Manager(), aCpows);
CpowIdHolder cpows(Manager(), aCpows);
return ReceiveMessage(aMessage, true, &cloneData, &cpows, aPrincipal, aJSONRetVal);
}
@ -1370,7 +1362,7 @@ TabParent::RecvRpcMessage(const nsString& aMessage,
}
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
CrossProcessCpowHolder cpows(Manager(), aCpows);
CpowIdHolder cpows(Manager(), aCpows);
return ReceiveMessage(aMessage, true, &cloneData, &cpows, aPrincipal, aJSONRetVal);
}
@ -1391,7 +1383,7 @@ TabParent::RecvAsyncMessage(const nsString& aMessage,
}
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
CrossProcessCpowHolder cpows(Manager(), aCpows);
CpowIdHolder cpows(Manager(), aCpows);
return ReceiveMessage(aMessage, false, &cloneData, &cpows, aPrincipal, nullptr);
}

View File

@ -144,8 +144,7 @@ public:
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,
@ -490,23 +489,14 @@ private:
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

View File

@ -130,6 +130,7 @@ LOCAL_INCLUDES += [
'/extensions/cookie',
'/extensions/spellcheck/src',
'/hal/sandbox',
'/js/ipc',
'/layout/base',
'/netwerk/base',
'/toolkit/xre',

View File

@ -15,6 +15,7 @@
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "JavaScriptChild.h"
#include "nsIJSRuntimeService.h"
#include "nsPrintfCString.h"
@ -34,13 +35,17 @@ nsIContentChild::AllocPJavaScriptChild()
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;
}
@ -116,7 +121,7 @@ nsIContentChild::RecvAsyncMessage(const nsString& aMsg,
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);
}

View File

@ -15,9 +15,9 @@
#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"
@ -57,13 +57,17 @@ nsIContentParent::AllocPJavaScriptParent()
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;
}
@ -193,7 +197,7 @@ nsIContentParent::RecvSyncMessage(const nsString& aMsg,
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);
}
@ -220,7 +224,7 @@ nsIContentParent::RecvRpcMessage(const nsString& aMsg,
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);
}
@ -246,7 +250,7 @@ nsIContentParent::RecvAsyncMessage(const nsString& aMsg,
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);
}

View File

@ -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__

View File

@ -64,20 +64,3 @@ JavaScriptChild::scopeForTargetObjects()
// 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();
}

View File

@ -76,20 +76,3 @@ JavaScriptParent::CloneProtocol(Channel* aChannel, ProtocolCloneContext* aCtx)
}
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();
}

View File

@ -672,8 +672,7 @@ JavaScriptShared::fromObjectOrNullVariant(JSContext *cx, ObjectOrNullVariant obj
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)
{
@ -683,7 +682,7 @@ CrossProcessCpowHolder::CrossProcessCpowHolder(dom::CPOWManagerGetter *managerGe
}
bool
CrossProcessCpowHolder::ToObject(JSContext *cx, JS::MutableHandleObject objp)
CpowIdHolder::ToObject(JSContext *cx, JS::MutableHandleObject objp)
{
if (!cpows_.Length())
return true;
@ -758,15 +757,3 @@ JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray<CpowEn
return true;
}
CPOWManager*
mozilla::jsipc::CPOWManagerFor(PJavaScriptParent* aParent)
{
return static_cast<JavaScriptParent *>(aParent);
}
CPOWManager*
mozilla::jsipc::CPOWManagerFor(PJavaScriptChild* aChild)
{
return static_cast<JavaScriptChild *>(aChild);
}

View File

@ -9,9 +9,9 @@
#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 {
@ -65,6 +65,18 @@ class ObjectId {
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.
@ -132,7 +144,7 @@ class ObjectToIdMap
class Logging;
class JavaScriptShared : public CPOWManager
class JavaScriptShared
{
public:
explicit JavaScriptShared(JSRuntime *rt);

View File

@ -10,7 +10,6 @@
#include "JavaScriptShared.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "js/Class.h"
#include "jsproxy.h"
@ -150,6 +149,21 @@ class WrapperOwner : public virtual JavaScriptShared
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

View File

@ -26,10 +26,6 @@ FINAL_LIBRARY = 'xul'
DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX']
EXPORTS.mozilla.jsipc = [
'CrossProcessObjectWrappers.h',
]
LOCAL_INCLUDES += [
'/dom/base',
'/js/ipc',

View File

@ -13,10 +13,10 @@
#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"

View File

@ -21,11 +21,11 @@
#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;

View File

@ -9,7 +9,7 @@
#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;

View File

@ -8,10 +8,10 @@
#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;

View File

@ -13,11 +13,11 @@
#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"

View File

@ -66,6 +66,7 @@ LOCAL_INCLUDES += [
'/dom/html',
'/dom/svg',
'/dom/workers',
'/js/ipc',
'/layout/base',
'/layout/style',
'/xpcom/reflect/xptinfo',

View File

@ -8,6 +8,7 @@
#include "nsJSPrincipals.h"
#include "nsGlobalWindow.h"
#include "JavaScriptParent.h"
#include "XPCWrapper.h"
#include "XrayWrapper.h"
@ -16,7 +17,6 @@
#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"

View File

@ -16,8 +16,8 @@
#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"

View File

@ -39,5 +39,6 @@ FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../../../dom/base',
'../src',
'/js/ipc',
]