mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1123461 - Make a real interface for js/ipc (r=dvander)
This commit is contained in:
parent
875f8b67f0
commit
411974faf9
@ -403,7 +403,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/xslt/xpath',
|
||||
'/dom/xul',
|
||||
'/image/src',
|
||||
'/js/ipc',
|
||||
'/js/xpconnect/src',
|
||||
'/js/xpconnect/wrappers',
|
||||
'/layout/base',
|
||||
|
@ -80,6 +80,7 @@
|
||||
#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"
|
||||
@ -88,7 +89,6 @@
|
||||
#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"
|
||||
|
@ -37,9 +37,8 @@
|
||||
#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>
|
||||
@ -927,7 +926,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
const nsAString& aMessage,
|
||||
bool aIsSync,
|
||||
const StructuredCloneData* aCloneData,
|
||||
CpowHolder* aCpows,
|
||||
mozilla::jsipc::CpowHolder* aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
InfallibleTArray<nsString>* aJSONRetVal)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "js/RootingAPI.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
#include "mozilla/jsipc/CpowHolder.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -134,13 +135,8 @@ struct nsMessageListenerInfo
|
||||
nsWeakPtr mWeakListener;
|
||||
};
|
||||
|
||||
class CpowHolder
|
||||
{
|
||||
public:
|
||||
virtual bool ToObject(JSContext* cx, JS::MutableHandle<JSObject*> objp) = 0;
|
||||
};
|
||||
|
||||
class MOZ_STACK_CLASS SameProcessCpowHolder : public CpowHolder
|
||||
class MOZ_STACK_CLASS SameProcessCpowHolder : public mozilla::jsipc::CpowHolder
|
||||
{
|
||||
public:
|
||||
SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle<JSObject*> aObj)
|
||||
@ -230,7 +226,7 @@ public:
|
||||
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, const nsAString& aMessage,
|
||||
bool aIsSync, const StructuredCloneData* aCloneData,
|
||||
CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
InfallibleTArray<nsString>* aJSONRetVal);
|
||||
|
||||
void AddChildManager(nsFrameMessageManager* aManager);
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <algorithm>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "JavaScriptParent.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
@ -44,6 +42,7 @@
|
||||
#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"
|
||||
|
||||
|
@ -58,7 +58,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/xslt/base',
|
||||
'/dom/xslt/xpath',
|
||||
'/dom/xul',
|
||||
'/js/ipc',
|
||||
'/js/xpconnect/src',
|
||||
'/js/xpconnect/wrappers',
|
||||
'/layout/style',
|
||||
|
@ -10,14 +10,14 @@
|
||||
namespace mozilla {
|
||||
|
||||
namespace jsipc {
|
||||
class JavaScriptShared;
|
||||
class CPOWManager;
|
||||
} /* namespace jsipc */
|
||||
|
||||
namespace dom {
|
||||
class CPOWManagerGetter
|
||||
{
|
||||
public:
|
||||
virtual mozilla::jsipc::JavaScriptShared* GetCPOWManager() = 0;
|
||||
virtual mozilla::jsipc::CPOWManager* GetCPOWManager() = 0;
|
||||
};
|
||||
} /* namespace dom */
|
||||
|
||||
|
@ -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,14 +100,13 @@ 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::JavaScriptShared*
|
||||
jsipc::CPOWManager*
|
||||
ContentBridgeChild::GetCPOWManager()
|
||||
{
|
||||
if (ManagedPJavaScriptChild().Length()) {
|
||||
return static_cast<JavaScriptChild*>(ManagedPJavaScriptChild()[0]);
|
||||
return CPOWManagerFor(ManagedPJavaScriptChild()[0]);
|
||||
}
|
||||
JavaScriptChild* actor = static_cast<JavaScriptChild*>(SendPJavaScriptConstructor());
|
||||
return actor;
|
||||
return CPOWManagerFor(SendPJavaScriptConstructor());
|
||||
}
|
||||
|
||||
mozilla::jsipc::PJavaScriptChild *
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
SendPBlobConstructor(PBlobChild* actor,
|
||||
const BlobConstructorParams& aParams) MOZ_OVERRIDE;
|
||||
|
||||
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
|
||||
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
const TabId& aTabId,
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/ContentBridgeParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "JavaScriptParent.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
using namespace base;
|
||||
@ -154,14 +154,13 @@ 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::JavaScriptShared*
|
||||
jsipc::CPOWManager*
|
||||
ContentBridgeParent::GetCPOWManager()
|
||||
{
|
||||
if (ManagedPJavaScriptParent().Length()) {
|
||||
return static_cast<JavaScriptParent*>(ManagedPJavaScriptParent()[0]);
|
||||
return CPOWManagerFor(ManagedPJavaScriptParent()[0]);
|
||||
}
|
||||
JavaScriptParent* actor = static_cast<JavaScriptParent*>(SendPJavaScriptConstructor());
|
||||
return actor;
|
||||
return CPOWManagerFor(SendPJavaScriptConstructor());
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) MOZ_OVERRIDE;
|
||||
|
||||
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
|
||||
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
|
||||
|
||||
virtual ContentParentId ChildID() MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -41,6 +41,7 @@
|
||||
#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"
|
||||
@ -163,7 +164,6 @@
|
||||
#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,14 +1403,13 @@ ContentChild::DeallocPTestShellChild(PTestShellChild* shell)
|
||||
return true;
|
||||
}
|
||||
|
||||
jsipc::JavaScriptShared*
|
||||
jsipc::CPOWManager*
|
||||
ContentChild::GetCPOWManager()
|
||||
{
|
||||
if (ManagedPJavaScriptChild().Length()) {
|
||||
return static_cast<JavaScriptChild*>(ManagedPJavaScriptChild()[0]);
|
||||
return CPOWManagerFor(ManagedPJavaScriptChild()[0]);
|
||||
}
|
||||
JavaScriptChild* actor = static_cast<JavaScriptChild*>(SendPJavaScriptConstructor());
|
||||
return actor;
|
||||
return CPOWManagerFor(SendPJavaScriptConstructor());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -209,7 +209,7 @@ public:
|
||||
virtual PTestShellChild* AllocPTestShellChild() MOZ_OVERRIDE;
|
||||
virtual bool DeallocPTestShellChild(PTestShellChild*) MOZ_OVERRIDE;
|
||||
virtual bool RecvPTestShellConstructor(PTestShellChild*) MOZ_OVERRIDE;
|
||||
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
|
||||
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
|
||||
|
||||
PMobileConnectionChild*
|
||||
SendPMobileConnectionConstructor(PMobileConnectionChild* aActor,
|
||||
|
@ -67,6 +67,7 @@
|
||||
#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"
|
||||
@ -178,8 +179,6 @@ using namespace mozilla::system;
|
||||
#include "BluetoothService.h"
|
||||
#endif
|
||||
|
||||
#include "JavaScriptParent.h"
|
||||
|
||||
#include "mozilla/RemoteSpellCheckEngineParent.h"
|
||||
|
||||
#ifdef MOZ_B2G_FM
|
||||
@ -1996,11 +1995,11 @@ ContentParent::NotifyTabDestroyed(PBrowserParent* aTab,
|
||||
}
|
||||
}
|
||||
|
||||
jsipc::JavaScriptShared*
|
||||
jsipc::CPOWManager*
|
||||
ContentParent::GetCPOWManager()
|
||||
{
|
||||
if (ManagedPJavaScriptParent().Length()) {
|
||||
return static_cast<JavaScriptParent*>(ManagedPJavaScriptParent()[0]);
|
||||
return CPOWManagerFor(ManagedPJavaScriptParent()[0]);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public:
|
||||
TestShellParent* CreateTestShell();
|
||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||
TestShellParent* GetTestShellSingleton();
|
||||
jsipc::JavaScriptShared* GetCPOWManager() MOZ_OVERRIDE;
|
||||
jsipc::CPOWManager* GetCPOWManager() MOZ_OVERRIDE;
|
||||
|
||||
static TabId
|
||||
AllocateTabId(const TabId& aOpenerTabId,
|
||||
|
@ -75,7 +75,6 @@
|
||||
#include "PuppetWidget.h"
|
||||
#include "StructuredCloneUtils.h"
|
||||
#include "nsViewportInfo.h"
|
||||
#include "JavaScriptChild.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "ipc/nsGUIEventIPC.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#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"
|
||||
@ -65,7 +66,6 @@
|
||||
#include "PermissionMessageUtils.h"
|
||||
#include "StructuredCloneUtils.h"
|
||||
#include "ColorPickerParent.h"
|
||||
#include "JavaScriptParent.h"
|
||||
#include "FilePickerParent.h"
|
||||
#include "TabChild.h"
|
||||
#include "LoadContext.h"
|
||||
|
@ -29,11 +29,14 @@ class nsIPrincipal;
|
||||
class nsIURI;
|
||||
class nsIWidget;
|
||||
class nsILoadContext;
|
||||
class CpowHolder;
|
||||
class nsIDocShell;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace jsipc {
|
||||
class CpowHolder;
|
||||
}
|
||||
|
||||
namespace layers {
|
||||
struct FrameMetrics;
|
||||
struct TextureFactoryIdentifier;
|
||||
@ -363,7 +366,7 @@ protected:
|
||||
bool ReceiveMessage(const nsString& aMessage,
|
||||
bool aSync,
|
||||
const StructuredCloneData* aCloneData,
|
||||
CpowHolder* aCpows,
|
||||
mozilla::jsipc::CpowHolder* aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
InfallibleTArray<nsString>* aJSONRetVal = nullptr);
|
||||
|
||||
|
@ -130,7 +130,6 @@ LOCAL_INCLUDES += [
|
||||
'/extensions/cookie',
|
||||
'/extensions/spellcheck/src',
|
||||
'/hal/sandbox',
|
||||
'/js/ipc',
|
||||
'/layout/base',
|
||||
'/netwerk/base',
|
||||
'/toolkit/xre',
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
|
||||
#include "JavaScriptChild.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
@ -35,17 +34,13 @@ nsIContentChild::AllocPJavaScriptChild()
|
||||
svc->GetRuntime(&rt);
|
||||
NS_ENSURE_TRUE(svc, nullptr);
|
||||
|
||||
nsAutoPtr<JavaScriptChild> child(new JavaScriptChild(rt));
|
||||
if (!child->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return child.forget();
|
||||
return NewJavaScriptChild(rt);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContentChild::DeallocPJavaScriptChild(PJavaScriptChild* aChild)
|
||||
{
|
||||
static_cast<JavaScriptChild*>(aChild)->decref();
|
||||
ReleaseJavaScriptChild(aChild);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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,17 +57,13 @@ nsIContentParent::AllocPJavaScriptParent()
|
||||
svc->GetRuntime(&rt);
|
||||
NS_ENSURE_TRUE(svc, nullptr);
|
||||
|
||||
nsAutoPtr<JavaScriptParent> parent(new JavaScriptParent(rt));
|
||||
if (!parent->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return parent.forget();
|
||||
return NewJavaScriptParent(rt);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContentParent::DeallocPJavaScriptParent(PJavaScriptParent* aParent)
|
||||
{
|
||||
static_cast<JavaScriptParent*>(aParent)->decref();
|
||||
ReleaseJavaScriptParent(aParent);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
25
js/ipc/CpowHolder.h
Normal file
25
js/ipc/CpowHolder.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* -*- 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_CpowHolder_h__
|
||||
#define mozilla_jsipc_CpowHolder_h__
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace jsipc {
|
||||
|
||||
class CpowHolder
|
||||
{
|
||||
public:
|
||||
virtual bool ToObject(JSContext* cx, JS::MutableHandle<JSObject*> objp) = 0;
|
||||
};
|
||||
|
||||
} // namespace jsipc
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_jsipc_CpowHolder_h__
|
94
js/ipc/CrossProcessObjectWrappers.h
Normal file
94
js/ipc/CrossProcessObjectWrappers.h
Normal file
@ -0,0 +1,94 @@
|
||||
/* -*- 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/CpowHolder.h"
|
||||
#include "mozilla/jsipc/JavaScriptTypes.h"
|
||||
#include "nsID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef GetClassName
|
||||
#undef GetClassInfo
|
||||
#endif
|
||||
|
||||
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 CpowIdHolder : public CpowHolder
|
||||
{
|
||||
public:
|
||||
CpowIdHolder(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__
|
@ -64,3 +64,20 @@ 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();
|
||||
}
|
||||
|
@ -76,3 +76,20 @@ 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();
|
||||
}
|
||||
|
@ -757,3 +757,15 @@ 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);
|
||||
}
|
||||
|
@ -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,18 +65,6 @@ 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.
|
||||
@ -144,7 +132,7 @@ class ObjectToIdMap
|
||||
|
||||
class Logging;
|
||||
|
||||
class JavaScriptShared
|
||||
class JavaScriptShared : public CPOWManager
|
||||
{
|
||||
public:
|
||||
explicit JavaScriptShared(JSRuntime *rt);
|
||||
|
@ -10,14 +10,10 @@
|
||||
|
||||
#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
|
||||
|
||||
namespace mozilla {
|
||||
namespace jsipc {
|
||||
|
||||
@ -149,21 +145,6 @@ 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
|
||||
|
||||
|
@ -26,6 +26,11 @@ FINAL_LIBRARY = 'xul'
|
||||
|
||||
DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX']
|
||||
|
||||
EXPORTS.mozilla.jsipc = [
|
||||
'CpowHolder.h',
|
||||
'CrossProcessObjectWrappers.h',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
'/js/ipc',
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "xpcprivate.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "JavaScriptParent.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -66,7 +66,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/html',
|
||||
'/dom/svg',
|
||||
'/dom/workers',
|
||||
'/js/ipc',
|
||||
'/layout/base',
|
||||
'/layout/style',
|
||||
'/xpcom/reflect/xptinfo',
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "JavaScriptParent.h"
|
||||
|
||||
#include "XPCWrapper.h"
|
||||
#include "XrayWrapper.h"
|
||||
@ -17,6 +16,7 @@
|
||||
#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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -39,6 +39,5 @@ FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../dom/base',
|
||||
'../src',
|
||||
'/js/ipc',
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user