Files
palemoon27/dom/plugins/ipc/PluginScriptableObjectParent.h
T
roytam1 3dafb8d491 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1162293 - Part 1: Remove instances of #ifdef PR_LOGGING. r=froydnj (20456f454)
- Bug 1162293 - Part 2: Fix string leak in logging code. r=froydnj (2b7552940)
- Bug 1162748 - Remove instances of #ifdef PR_LOGGING in graphics. r=froydnj (1ec0e8140)
- Bug 1156632 - Remove unused forward class declarations - patch 1 - dom/base, r=ehsan (eba98c427)
- Bug 1149420 - Make the IndexedDB permissions prompt work in e10s. r=bent/mfinkle (fc977c048)
- Bug 1156632 - Remove unused forward class declarations - patch 2 - dom/media, dom/indexedDB, dom/svg, r=ehsan (011caf393)
- Bug 1156632 - Remove unused forward class declarations - patch 3 - dom/{events,xbl,xslt,xul} and others, r=ehsan (72051c70b)
- Bug 1148005; Update WebVR APIs based on latest spec changes; r=baku (15b0a712f)
- Bug 1156632 - Remove unused forward class declarations - patch 4 - netwerk image and dom, r=ehsan (5ee4f1679)
- Bug 1139972 - IPC Proxy for charAt, r=tbsaunde (95d3626ec)
- Bug 1139887 - IPC Proxy for caretOffset, r=tbsaunde (c44893cd5)
- Bug 1141228 - include GfxMessageUtils.h in PDocAccessible.ipdl, r=tbsaunde (773e741f9)
- goannaCoordType -> geckoCoordType (b6ede7903)
- Bug 1145292 - IPC Proxy for ImageAccessible, r=tbsaunde (ca37ce753)
- bug 1128751 - handle unbinding and rebinding of documents in content processes r=davidb (0ad3331ab)
- Bug 1145366 - IPC Proxy for HyperLink, r=tbsaunde (87bc696f5)
- Bug 1146615 - IPC Proxy for HyperText, r=tbsaunde (de5322207)
- Bug 1146665 - IPC Proxy for TableCell, r=tbsaunde (895e24eee)
- Bug 1147079 - IPC Proxy for Table, r=tbsaunde (6e54178fe)
- Bug 1147168 - IPC Proxy for Selection, r=tbsaunde (40b8fa16e)
- Bug 1147518 - IPC Proxy for Action, r=davidb (12d5a235f)
- Bug 1147551 - IPC Proxy for min/cur/max values, r=davidb (3728abc54)
- Bug 1148025 - IPC Proxy for 'Component', r=tbsaunde (38bea1f4a)
- Bug 1148083 - IPC Proxy for Document, r=davidb (a7d53936d)
- Bug 1132854 - Make nsIntSize a typedef of gfx::IntSize. r=Bas, roc (09d0ae0d9)
- goannaRole -> geckoRole (421bdcd36)
- bug 1138436 - start on proxying IAccessible2 r=surkov, r=davidb (b2be8ba44)
- bug 1151402 - proxy most of IAccessibleText and IAccessibleEditableText r=davidb (dff7da028)
- Bug 1162740 - Part 1: Remove instances of #ifdef PR_LOGGING in rdf. r=froydnj (e398edb14)
- Bug 1162740 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj (d873be4f4)
- Bug 1067054 - Remove generic SQLITE_ERROR warning & suppress warning if transaction exists. r=mak (cdc03b034)
- Bug 1137287 - Part 1: Shift some code from InterceptedChannelContent to HttpChannelChild. r=mayhemer (6141690a1)
- Bug 1136969 - Add a check that OnStartRequest is called just once during the lifetime of a channel. r=mcmanus (3b6aa0560)
- Bug 1053650 - Part 1: Add attribute 'networkInterfaceId' to XMLHttpRequest. r=bz Bug 1053650 - Part 2: Populate networkInterfaceId to SocketTransport r=mcmanus Bug 1053650 - Part 3: Make use of gonk-specific per-interface DNS lookup. r=mcmanus Bug 1053650 follow-up: Mark GetNetworkInterfaceId/SetNetworkInterfaceId as override (e308fc405)
2020-05-30 12:49:04 +08:00

229 lines
6.3 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 et :
* 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 dom_plugins_PluginScriptableObjectParent_h
#define dom_plugins_PluginScriptableObjectParent_h 1
#include "mozilla/plugins/PPluginScriptableObjectParent.h"
#include "mozilla/plugins/PluginMessageUtils.h"
#include "npfunctions.h"
#include "npruntime.h"
namespace mozilla {
namespace plugins {
class PluginInstanceParent;
class PluginScriptableObjectParent;
struct ParentNPObject : NPObject
{
ParentNPObject()
: NPObject(), parent(nullptr), invalidated(false) { }
// |parent| is always valid as long as the actor is alive. Once the actor is
// destroyed this will be set to null.
PluginScriptableObjectParent* parent;
bool invalidated;
};
class PluginScriptableObjectParent : public PPluginScriptableObjectParent
{
friend class PluginInstanceParent;
public:
explicit PluginScriptableObjectParent(ScriptableObjectType aType);
virtual ~PluginScriptableObjectParent();
void
InitializeProxy();
void
InitializeLocal(NPObject* aObject);
virtual void
ActorDestroy(ActorDestroyReason aWhy) override;
virtual bool
AnswerHasMethod(const PluginIdentifier& aId,
bool* aHasMethod) override;
virtual bool
AnswerInvoke(const PluginIdentifier& aId,
InfallibleTArray<Variant>&& aArgs,
Variant* aResult,
bool* aSuccess) override;
virtual bool
AnswerInvokeDefault(InfallibleTArray<Variant>&& aArgs,
Variant* aResult,
bool* aSuccess) override;
virtual bool
AnswerHasProperty(const PluginIdentifier& aId,
bool* aHasProperty) override;
virtual bool
AnswerGetParentProperty(const PluginIdentifier& aId,
Variant* aResult,
bool* aSuccess) override;
virtual bool
AnswerSetProperty(const PluginIdentifier& aId,
const Variant& aValue,
bool* aSuccess) override;
virtual bool
AnswerRemoveProperty(const PluginIdentifier& aId,
bool* aSuccess) override;
virtual bool
AnswerEnumerate(InfallibleTArray<PluginIdentifier>* aProperties,
bool* aSuccess) override;
virtual bool
AnswerConstruct(InfallibleTArray<Variant>&& aArgs,
Variant* aResult,
bool* aSuccess) override;
virtual bool
AnswerNPN_Evaluate(const nsCString& aScript,
Variant* aResult,
bool* aSuccess) override;
virtual bool
RecvProtect() override;
virtual bool
RecvUnprotect() override;
static const NPClass*
GetClass()
{
return &sNPClass;
}
PluginInstanceParent*
GetInstance() const
{
return mInstance;
}
NPObject*
GetObject(bool aCanResurrect);
// Protect only affects LocalObject actors. It is called by the
// ProtectedVariant/Actor helper classes before the actor is used as an
// argument to an IPC call and when the child process resurrects a
// proxy object to the NPObject associated with this actor.
void Protect();
// Unprotect only affects LocalObject actors. It is called by the
// ProtectedVariant/Actor helper classes after the actor is used as an
// argument to an IPC call and when the child process is no longer using this
// actor.
void Unprotect();
// DropNPObject is only used for Proxy actors and is called when the parent
// process is no longer using the NPObject associated with this actor. The
// child process may subsequently use this actor again in which case a new
// NPObject will be created and associated with this actor (see
// ResurrectProxyObject).
void DropNPObject();
ScriptableObjectType
Type() const {
return mType;
}
bool GetPropertyHelper(NPIdentifier aName,
bool* aHasProperty,
bool* aHasMethod,
NPVariant* aResult);
private:
static NPObject*
ScriptableAllocate(NPP aInstance,
NPClass* aClass);
static void
ScriptableInvalidate(NPObject* aObject);
static void
ScriptableDeallocate(NPObject* aObject);
static bool
ScriptableHasMethod(NPObject* aObject,
NPIdentifier aName);
static bool
ScriptableInvoke(NPObject* aObject,
NPIdentifier aName,
const NPVariant* aArgs,
uint32_t aArgCount,
NPVariant* aResult);
static bool
ScriptableInvokeDefault(NPObject* aObject,
const NPVariant* aArgs,
uint32_t aArgCount,
NPVariant* aResult);
static bool
ScriptableHasProperty(NPObject* aObject,
NPIdentifier aName);
static bool
ScriptableGetProperty(NPObject* aObject,
NPIdentifier aName,
NPVariant* aResult);
static bool
ScriptableSetProperty(NPObject* aObject,
NPIdentifier aName,
const NPVariant* aValue);
static bool
ScriptableRemoveProperty(NPObject* aObject,
NPIdentifier aName);
static bool
ScriptableEnumerate(NPObject* aObject,
NPIdentifier** aIdentifiers,
uint32_t* aCount);
static bool
ScriptableConstruct(NPObject* aObject,
const NPVariant* aArgs,
uint32_t aArgCount,
NPVariant* aResult);
NPObject*
CreateProxyObject();
// ResurrectProxyObject is only used with Proxy actors. It is called when the
// child process uses an actor whose NPObject was deleted by the parent
// process.
bool ResurrectProxyObject();
private:
PluginInstanceParent* mInstance;
// This may be a ParentNPObject or some other kind depending on who created
// it. Have to check its class to find out.
NPObject* mObject;
int mProtectCount;
ScriptableObjectType mType;
static const NPClass sNPClass;
};
} /* namespace plugins */
} /* namespace mozilla */
#endif /* dom_plugins_PluginScriptableObjectParent_h */