Backed out changeset 0ed675647700 for failing tests

This commit is contained in:
Ben Turner 2010-04-07 15:01:23 -07:00
parent a9579c61a0
commit 2bae25ded8
9 changed files with 116 additions and 349 deletions

View File

@ -92,6 +92,10 @@ both:
rpc HasProperty(PPluginIdentifier aId)
returns (bool aHasProperty);
rpc GetProperty(PPluginIdentifier aId)
returns (Variant aResult,
bool aSuccess);
rpc SetProperty(PPluginIdentifier aId,
Variant aValue)
returns (bool aSuccess);
@ -116,24 +120,6 @@ both:
// temporarily protects the protocol object again for the duration of the call.
async Protect();
async Unprotect();
/**
* GetProperty is slightly wonky due to the way we support NPObjects that have
* methods and properties with the same name. When child calls parent we
* simply return a property. When parent calls child, however, we need to do
* several checks at once and return all the results simultaneously.
*/
parent:
rpc GetParentProperty(PPluginIdentifier aId)
returns (Variant aResult,
bool aSuccess);
child:
rpc GetChildProperty(PPluginIdentifier aId)
returns (bool aHasProperty,
bool aHasMethod,
Variant aResult,
bool aSuccess);
};
} // namespace plugins

View File

@ -257,8 +257,8 @@ PluginScriptableObjectChild::ScriptableGetProperty(NPObject* aObject,
Variant result;
bool success;
actor->CallGetParentProperty(static_cast<PPluginIdentifierChild*>(aName),
&result, &success);
actor->CallGetProperty(static_cast<PPluginIdentifierChild*>(aName), &result,
&success);
if (!success) {
return false;
@ -831,49 +831,45 @@ PluginScriptableObjectChild::AnswerHasProperty(PPluginIdentifierChild* aId,
}
bool
PluginScriptableObjectChild::AnswerGetChildProperty(PPluginIdentifierChild* aId,
bool* aHasProperty,
bool* aHasMethod,
Variant* aResult,
bool* aSuccess)
PluginScriptableObjectChild::AnswerGetProperty(PPluginIdentifierChild* aId,
Variant* aResult,
bool* aSuccess)
{
AssertPluginThread();
*aHasProperty = *aHasMethod = *aSuccess = false;
*aResult = void_t();
if (mInvalidated) {
NS_WARNING("Calling AnswerGetProperty with an invalidated object!");
*aResult = void_t();
*aSuccess = false;
return true;
}
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
if (!(mObject->_class && mObject->_class->hasProperty &&
mObject->_class->hasMethod && mObject->_class->getProperty)) {
if (!(mObject->_class && mObject->_class->getProperty)) {
*aResult = void_t();
*aSuccess = false;
return true;
}
NPIdentifier id = static_cast<PluginIdentifierChild*>(aId)->ToNPIdentifier();
NPVariant result;
VOID_TO_NPVARIANT(result);
PluginIdentifierChild* id = static_cast<PluginIdentifierChild*>(aId);
if (!mObject->_class->getProperty(mObject, id->ToNPIdentifier(), &result)) {
*aResult = void_t();
*aSuccess = false;
return true;
}
*aHasProperty = mObject->_class->hasProperty(mObject, id);
*aHasMethod = mObject->_class->hasMethod(mObject, id);
if (*aHasProperty) {
NPVariant result;
VOID_TO_NPVARIANT(result);
if (!mObject->_class->getProperty(mObject, id, &result)) {
return true;
}
Variant converted;
if ((*aSuccess = ConvertToRemoteVariant(result, converted, GetInstance(),
false))) {
DeferNPVariantLastRelease(&PluginModuleChild::sBrowserFuncs, &result);
*aResult = converted;
}
Variant converted;
if ((*aSuccess = ConvertToRemoteVariant(result, converted, GetInstance(),
false))) {
DeferNPVariantLastRelease(&PluginModuleChild::sBrowserFuncs, &result);
*aResult = converted;
}
else {
*aResult = void_t();
}
return true;
@ -895,15 +891,7 @@ PluginScriptableObjectChild::AnswerSetProperty(PPluginIdentifierChild* aId,
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
if (!(mObject->_class && mObject->_class->hasProperty &&
mObject->_class->setProperty)) {
*aSuccess = false;
return true;
}
NPIdentifier id = static_cast<PluginIdentifierChild*>(aId)->ToNPIdentifier();
if (!mObject->_class->hasProperty(mObject, id)) {
if (!(mObject->_class && mObject->_class->setProperty)) {
*aSuccess = false;
return true;
}
@ -911,7 +899,9 @@ PluginScriptableObjectChild::AnswerSetProperty(PPluginIdentifierChild* aId,
NPVariant converted;
ConvertToVariant(aValue, converted);
if ((*aSuccess = mObject->_class->setProperty(mObject, id, &converted))) {
PluginIdentifierChild* id = static_cast<PluginIdentifierChild*>(aId);
if ((*aSuccess = mObject->_class->setProperty(mObject, id->ToNPIdentifier(),
&converted))) {
PluginModuleChild::sBrowserFuncs.releasevariantvalue(&converted);
}
return true;
@ -932,17 +922,13 @@ PluginScriptableObjectChild::AnswerRemoveProperty(PPluginIdentifierChild* aId,
NS_ASSERTION(mObject->_class != GetClass(), "Bad object type!");
NS_ASSERTION(mType == LocalObject, "Bad type!");
if (!(mObject->_class && mObject->_class->hasProperty &&
mObject->_class->removeProperty)) {
if (!(mObject->_class && mObject->_class->removeProperty)) {
*aSuccess = false;
return true;
}
NPIdentifier id = static_cast<PluginIdentifierChild*>(aId)->ToNPIdentifier();
*aSuccess = mObject->_class->hasProperty(mObject, id) ?
mObject->_class->removeProperty(mObject, id) :
true;
PluginIdentifierChild* id = static_cast<PluginIdentifierChild*>(aId);
*aSuccess = mObject->_class->removeProperty(mObject, id->ToNPIdentifier());
return true;
}

View File

@ -107,11 +107,9 @@ public:
bool* aHasProperty);
virtual bool
AnswerGetChildProperty(PPluginIdentifierChild* aId,
bool* aHasProperty,
bool* aHasMethod,
Variant* aResult,
bool* aSuccess);
AnswerGetProperty(PPluginIdentifierChild* aId,
Variant* aResult,
bool* aSuccess);
virtual bool
AnswerSetProperty(PPluginIdentifierChild* aId,

View File

@ -321,9 +321,46 @@ PluginScriptableObjectParent::ScriptableGetProperty(NPObject* aObject,
NPIdentifier aName,
NPVariant* aResult)
{
// See GetPropertyHelper below.
NS_NOTREACHED("Shouldn't ever call this directly!");
return false;
if (aObject->_class != GetClass()) {
NS_ERROR("Don't know what kind of object this is!");
return false;
}
ParentNPObject* object = reinterpret_cast<ParentNPObject*>(aObject);
if (object->invalidated) {
NS_WARNING("Calling method on an invalidated object!");
return false;
}
PPluginIdentifierParent* identifier = GetIdentifier(aObject, aName);
if (!identifier) {
return false;
}
ProtectedActor<PluginScriptableObjectParent> actor(object->parent);
if (!actor) {
return false;
}
NS_ASSERTION(actor->Type() == Proxy, "Bad type!");
Variant result;
bool success;
if (!actor->CallGetProperty(identifier, &result, &success)) {
NS_WARNING("Failed to send message!");
return false;
}
if (!success) {
return false;
}
if (!ConvertToVariant(result, *aResult, actor->GetInstance())) {
NS_WARNING("Failed to convert result!");
return false;
}
return true;
}
// static
@ -927,10 +964,9 @@ PluginScriptableObjectParent::AnswerHasProperty(PPluginIdentifierParent* aId,
}
bool
PluginScriptableObjectParent::AnswerGetParentProperty(
PPluginIdentifierParent* aId,
Variant* aResult,
bool* aSuccess)
PluginScriptableObjectParent::AnswerGetProperty(PPluginIdentifierParent* aId,
Variant* aResult,
bool* aSuccess)
{
if (!mObject) {
NS_WARNING("Calling AnswerGetProperty with an invalidated object!");
@ -1251,43 +1287,3 @@ PluginScriptableObjectParent::AnswerNPN_Evaluate(const nsCString& aScript,
*aResult = convertedResult;
return true;
}
JSBool
PluginScriptableObjectParent::GetPropertyHelper(NPIdentifier aName,
PRBool* aHasProperty,
PRBool* aHasMethod,
NPVariant* aResult)
{
NS_ASSERTION(Type() == Proxy, "Bad type!");
ParentNPObject* object = static_cast<ParentNPObject*>(mObject);
if (object->invalidated) {
NS_WARNING("Calling method on an invalidated object!");
return JS_FALSE;
}
PPluginIdentifierParent* identifier = GetIdentifier(GetInstance(), aName);
if (!identifier) {
return JS_FALSE;
}
bool hasProperty, hasMethod, success;
Variant result;
if (!CallGetChildProperty(identifier, &hasProperty, &hasMethod, &result,
&success)) {
return JS_FALSE;
}
if (!success) {
return JS_FALSE;
}
if (!ConvertToVariant(result, *aResult, GetInstance())) {
NS_WARNING("Failed to convert result!");
return JS_FALSE;
}
*aHasProperty = hasProperty;
*aHasMethod = hasMethod;
return JS_TRUE;
}

View File

@ -41,7 +41,6 @@
#include "mozilla/plugins/PPluginScriptableObjectParent.h"
#include "jsapi.h"
#include "npfunctions.h"
#include "npruntime.h"
@ -97,9 +96,9 @@ public:
bool* aHasProperty);
virtual bool
AnswerGetParentProperty(PPluginIdentifierParent* aId,
Variant* aResult,
bool* aSuccess);
AnswerGetProperty(PPluginIdentifierParent* aId,
Variant* aResult,
bool* aSuccess);
virtual bool
AnswerSetProperty(PPluginIdentifierParent* aId,
@ -169,11 +168,6 @@ public:
return mType;
}
JSBool GetPropertyHelper(NPIdentifier aName,
PRBool* aHasProperty,
PRBool* aHasMethod,
NPVariant* aResult);
private:
static NPObject*
ScriptableAllocate(NPP aInstance,

View File

@ -36,10 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_IPC
#include "base/basictypes.h"
#endif
// FIXME(bug 332648): Give me a real API please!
#include "jscntxt.h"
@ -59,12 +55,6 @@
using namespace mozilla::plugins::parent;
#ifdef MOZ_IPC
#include "mozilla/plugins/PluginScriptableObjectParent.h"
using mozilla::plugins::PluginScriptableObjectParent;
using mozilla::plugins::ParentNPObject;
#endif
// Hash of JSObject wrappers that wraps JSObjects as NPObjects. There
// will be one wrapper per JSObject per plugin instance, i.e. if two
// plugins access the JSObject x, two wrappers for x will be
@ -92,20 +82,6 @@ static nsIJSContextStack *sContextStack;
static nsTArray<NPObject*>* sDelayedReleases;
namespace {
inline bool
NPObjectIsOutOfProcessProxy(NPObject *obj)
{
#ifdef MOZ_IPC
return obj->_class == PluginScriptableObjectParent::GetClass();
#else
return false;
#endif
}
} // anonymous namespace
// Helper class that reports any JS exceptions that were thrown while
// the plugin executed JS.
@ -179,8 +155,8 @@ NPObjWrapper_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
static JSBool
CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject *npobj,
jsval id, NPVariant* getPropertyResult, jsval *vp);
CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj,
NPObject *npobj, jsval id, jsval *vp);
static JSClass sNPObjectJSWrapperClass =
{
@ -1206,10 +1182,6 @@ NPObjWrapper_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return JS_FALSE;
}
if (NPObjectIsOutOfProcessProxy(npobj)) {
return JS_TRUE;
}
PluginDestructionGuard pdg(LookupNPP(npobj));
JSBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
@ -1248,14 +1220,12 @@ NPObjWrapper_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PluginDestructionGuard pdg(LookupNPP(npobj));
if (!NPObjectIsOutOfProcessProxy(npobj)) {
JSBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
JSBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
if (!hasProperty)
return JS_TRUE;
}
if (!hasProperty)
return JS_TRUE;
if (!npobj->_class->removeProperty(npobj, (NPIdentifier)id))
*vp = JSVAL_FALSE;
@ -1287,16 +1257,14 @@ NPObjWrapper_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PluginDestructionGuard pdg(npp);
if (!NPObjectIsOutOfProcessProxy(npobj)) {
JSBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
JSBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
if (!hasProperty) {
ThrowJSException(cx, "Trying to set unsupported property on NPObject!");
if (!hasProperty) {
ThrowJSException(cx, "Trying to set unsupported property on NPObject!");
return JS_FALSE;
}
return JS_FALSE;
}
NPVariant npv;
@ -1343,53 +1311,22 @@ NPObjWrapper_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PluginDestructionGuard pdg(npp);
PRBool hasProperty, hasMethod;
NPVariant npv;
VOID_TO_NPVARIANT(npv);
#ifdef MOZ_IPC
if (NPObjectIsOutOfProcessProxy(npobj)) {
PluginScriptableObjectParent* actor =
static_cast<ParentNPObject*>(npobj)->parent;
JSBool success = actor->GetPropertyHelper((NPIdentifier)id, &hasProperty,
&hasMethod, &npv);
if (!ReportExceptionIfPending(cx)) {
if (success)
_releasevariantvalue(&npv);
return JS_FALSE;
}
if (success) {
// We return NPObject Member class here to support ambiguous members.
if (hasProperty && hasMethod)
return CreateNPObjectMember(npp, cx, obj, npobj, id, &npv, vp);
if (hasProperty) {
*vp = NPVariantToJSVal(npp, cx, &npv);
_releasevariantvalue(&npv);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
}
}
return JS_TRUE;
}
#endif
hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
PRBool hasProperty = npobj->_class->hasProperty(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
hasMethod = npobj->_class->hasMethod(npobj, (NPIdentifier)id);
PRBool hasMethod = npobj->_class->hasMethod(npobj, (NPIdentifier)id);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
// We return NPObject Member class here to support ambiguous members.
if (hasProperty && hasMethod)
return CreateNPObjectMember(npp, cx, obj, npobj, id, nsnull, vp);
return CreateNPObjectMember(npp, cx, obj, npobj, id, vp);
if (hasProperty) {
NPVariant npv;
VOID_TO_NPVARIANT(npv);
if (npobj->_class->getProperty(npobj, (NPIdentifier)id, &npv))
*vp = NPVariantToJSVal(npp, cx, &npv);
@ -2111,8 +2048,8 @@ LookupNPP(NPObject *npobj)
}
JSBool
CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
jsval id, NPVariant* getPropertyResult, jsval *vp)
CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj,
NPObject* npobj, jsval id, jsval *vp)
{
NS_ENSURE_TRUE(vp, JS_FALSE);
@ -2145,27 +2082,18 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
jsval fieldValue;
NPVariant npv;
NPBool hasProperty;
VOID_TO_NPVARIANT(npv);
if (getPropertyResult) {
// Plugin has already handed us the value we want here.
npv = *getPropertyResult;
hasProperty = true;
NPBool hasProperty = npobj->_class->getProperty(npobj, (NPIdentifier)id,
&npv);
if (ReportExceptionIfPending(cx)) {
::JS_RemoveRoot(cx, vp);
return JS_FALSE;
}
else {
VOID_TO_NPVARIANT(npv);
NPBool hasProperty = npobj->_class->getProperty(npobj, (NPIdentifier)id,
&npv);
if (ReportExceptionIfPending(cx)) {
::JS_RemoveRoot(cx, vp);
return JS_FALSE;
}
if (!hasProperty) {
::JS_RemoveRoot(cx, vp);
return JS_FALSE;
}
if (!hasProperty) {
::JS_RemoveRoot(cx, vp);
return JS_FALSE;
}
fieldValue = NPVariantToJSVal(npp, cx, &npv);

View File

@ -85,7 +85,6 @@ _MOCHITEST_FILES = \
test_hanging.html \
crashing_subpage.html \
test_GCrace.html \
test_propertyAndMethod.html \
$(NULL)
# test_npruntime_npnsetexception.html \ Disabled for e10s

View File

@ -1,48 +0,0 @@
<head>
<title>NPObject with property and method with the same name</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="run()">
<embed id="plugin" type="application/x-test" wmode="window"></embed>
<script class="testbody" type="application/javascript">
if (typeof Object.getPrototypeOf !== "function") {
if (typeof "test".__proto__ === "object") {
Object.getPrototypeOf = function(object) {
return object.__proto__;
};
} else {
Object.getPrototypeOf = function(object) {
// May break if the constructor has been tampered with
return object.constructor.prototype;
};
}
}
SimpleTest.waitForExplicitFinish();
function run() {
var plugin = document.getElementById("plugin");
var pluginProto = Object.getPrototypeOf(plugin);
delete pluginProto.propertyAndMethod;
ok(isNaN(plugin.propertyAndMethod + 0), "Shouldn't be set yet!");
plugin.propertyAndMethod = 5;
is(plugin.propertyAndMethod, 5, "Should be set to 5!");
delete pluginProto.propertyAndMethod;
ok(isNaN(plugin.propertyAndMethod + 0), "Shouldn't be set any more!");
var res = plugin.propertyAndMethod();
is(res, 5, "Method invocation should return 5!");
SimpleTest.finish();
}
</script>
</body>

View File

@ -157,7 +157,6 @@ static bool hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount
static bool getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool reinitWidget(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool propertyAndMethod(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static const NPUTF8* sPluginMethodIdentifierNames[] = {
"npnEvaluateTest",
@ -200,7 +199,6 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
"getClipboardText",
"callOnDestroy",
"reinitWidget",
"propertyAndMethod"
};
static NPIdentifier sPluginMethodIdentifiers[ARRAY_LENGTH(sPluginMethodIdentifierNames)];
static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMethodIdentifierNames)] = {
@ -244,13 +242,7 @@ static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMetho
getClipboardText,
callOnDestroy,
reinitWidget,
propertyAndMethod
};
static const NPUTF8* sPluginPropertyIdentifierNames[] = {
"propertyAndMethod"
};
static NPIdentifier sPluginPropertyIdentifiers[ARRAY_LENGTH(sPluginPropertyIdentifierNames)];
static NPVariant sPluginPropertyValues[ARRAY_LENGTH(sPluginPropertyIdentifierNames)];
struct URLNotifyData
{
@ -315,9 +307,6 @@ static void initializeIdentifiers()
if (!sIdentifiersInitialized) {
NPN_GetStringIdentifiers(sPluginMethodIdentifierNames,
ARRAY_LENGTH(sPluginMethodIdentifierNames), sPluginMethodIdentifiers);
NPN_GetStringIdentifiers(sPluginPropertyIdentifierNames,
ARRAY_LENGTH(sPluginPropertyIdentifierNames), sPluginPropertyIdentifiers);
sIdentifiersInitialized = true;
// Check whether NULL is handled in NPN_GetStringIdentifiers
@ -331,9 +320,6 @@ static void clearIdentifiers()
{
memset(sPluginMethodIdentifiers, 0,
ARRAY_LENGTH(sPluginMethodIdentifiers) * sizeof(NPIdentifier));
memset(sPluginPropertyIdentifiers, 0,
ARRAY_LENGTH(sPluginPropertyIdentifiers) * sizeof(NPIdentifier));
sIdentifiersInitialized = false;
}
@ -460,25 +446,6 @@ getFuncFromString(const char* funcname)
return FUNCTION_NONE;
}
static void
DuplicateNPVariant(NPVariant& aDest, const NPVariant& aSrc)
{
if (NPVARIANT_IS_STRING(aSrc)) {
NPString src = NPVARIANT_TO_STRING(aSrc);
char* buf = new char[src.UTF8Length];
strncpy(buf, src.UTF8Characters, src.UTF8Length);
STRINGN_TO_NPVARIANT(buf, src.UTF8Length, aDest);
}
else if (NPVARIANT_IS_OBJECT(aSrc)) {
NPObject* obj =
NPN_RetainObject(NPVARIANT_TO_OBJECT(aSrc));
OBJECT_TO_NPVARIANT(obj, aDest);
}
else {
aDest = aSrc;
}
}
//
// function signatures
//
@ -566,10 +533,6 @@ NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
initializeIdentifiers();
for (int i = 0; i < ARRAY_LENGTH(sPluginPropertyValues); i++) {
VOID_TO_NPVARIANT(sPluginPropertyValues[i]);
}
memset(&sNPClass, 0, sizeof(NPClass));
sNPClass.structVersion = NP_CLASS_STRUCT_VERSION;
sNPClass.allocate = (NPAllocateFunctionPtr)scriptableAllocate;
@ -612,10 +575,6 @@ NPError OSCALL NP_Shutdown()
{
clearIdentifiers();
for (int i = 0; i < ARRAY_LENGTH(sPluginPropertyValues); i++) {
NPN_ReleaseVariantValue(&sPluginPropertyValues[i]);
}
return NPERR_NO_ERROR;
}
@ -1585,47 +1544,24 @@ scriptableInvokeDefault(NPObject* npobj, const NPVariant* args, uint32_t argCoun
bool
scriptableHasProperty(NPObject* npobj, NPIdentifier name)
{
for (int i = 0; i < int(ARRAY_LENGTH(sPluginPropertyIdentifiers)); i++) {
if (name == sPluginPropertyIdentifiers[i])
return true;
}
return false;
}
bool
scriptableGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result)
{
for (int i = 0; i < int(ARRAY_LENGTH(sPluginPropertyIdentifiers)); i++) {
if (name == sPluginPropertyIdentifiers[i]) {
DuplicateNPVariant(*result, sPluginPropertyValues[i]);
return true;
}
}
return false;
}
bool
scriptableSetProperty(NPObject* npobj, NPIdentifier name, const NPVariant* value)
{
for (int i = 0; i < int(ARRAY_LENGTH(sPluginPropertyIdentifiers)); i++) {
if (name == sPluginPropertyIdentifiers[i]) {
NPN_ReleaseVariantValue(&sPluginPropertyValues[i]);
DuplicateNPVariant(sPluginPropertyValues[i], *value);
return true;
}
}
return false;
}
bool
scriptableRemoveProperty(NPObject* npobj, NPIdentifier name)
{
for (int i = 0; i < int(ARRAY_LENGTH(sPluginPropertyIdentifiers)); i++) {
if (name == sPluginPropertyIdentifiers[i]) {
NPN_ReleaseVariantValue(&sPluginPropertyValues[i]);
return true;
}
}
return false;
}
@ -2751,11 +2687,3 @@ reinitWidget(NPObject* npobj, const NPVariant* args, uint32_t argCount,
pluginWidgetInit(id, id->window.window);
return true;
}
bool
propertyAndMethod(NPObject* npobj, const NPVariant* args, uint32_t argCount,
NPVariant* result)
{
INT32_TO_NPVARIANT(5, *result);
return true;
}