+2004-08-15 Richard Williamson <rjw@apple.com>
+
+ More updates to np headers. Implemented new NPN functions.
+
+ Reviewed by Darin.
+
+ * bindings/NP_jsobject.cpp:
+ (NPN_HasProperty):
+ (NPN_HasMethod):
+ * bindings/npapi.h:
+ * bindings/npruntime.h:
+
2004-08-13 Darin Adler <darin@apple.com>
- fix build so we can compile again
return false;
}
+bool NPN_HasProperty(NPP npp, NPObject *o, NPIdentifier propertyName)
+{
+ if (o->_class == NPScriptObjectClass) {
+ JavaScriptObject *obj = (JavaScriptObject *)o;
+ ExecState *exec = obj->root->interpreter()->globalExec();
+
+ PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
+ // String identifier?
+ if (i->isString) {
+ ExecState *exec = obj->root->interpreter()->globalExec();
+ Interpreter::lock();
+ bool result = obj->imp->hasProperty (exec, identiferFromNPIdentifier(i->value.string));
+ Interpreter::unlock();
+ return result;
+ }
+
+ // Numeric identifer
+ Interpreter::lock();
+ bool result = obj->imp->hasProperty (exec, i->value.number);
+ Interpreter::unlock();
+ return result;
+ }
+ else if (o->_class->hasProperty) {
+ return o->_class->hasProperty (o->_class, propertyName);
+ }
+
+ return false;
+}
+
+bool NPN_HasMethod(NPP npp, NPObject *o, NPIdentifier methodName)
+{
+ if (o->_class == NPScriptObjectClass) {
+ JavaScriptObject *obj = (JavaScriptObject *)o;
+
+ PrivateIdentifier *i = (PrivateIdentifier *)methodName;
+ if (!i->isString)
+ return false;
+
+ // Lookup the function object.
+ ExecState *exec = obj->root->interpreter()->globalExec();
+ Interpreter::lock();
+ Value func = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
+ Interpreter::unlock();
+
+ if (func.isNull() || func.type() == UndefinedType) {
+ return false;
+ }
+
+ return true;
+ }
+
+ else if (o->_class->hasMethod) {
+ return o->_class->hasMethod (o->_class, methodName);
+ }
+
+ return false;
+}
-/* -*- Mode: C; tab-width: 4; -*- */
-/*
- * npapi.h $Revision$
- * Netscape client plug-in API spec
- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+ /*
+ * Netscape client plug-in API spec
+ */
+
#ifndef _NPAPI_H_
#define _NPAPI_H_
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
-#define NP_VERSION_MINOR 12
+#define NP_VERSION_MINOR 14
#define NULL (0L)
#endif
-//#ifndef _NP_RUNTIME_H_
-// Ack! Temporary hack to get build working.
-typedef unsigned char NPBool;
-//#endif
+typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef char* NPMIMEType;
NPPVpluginNeedsXEmbed = 14, /* Not implemented in WebKit */
/* Get the NPObject for scripting the plugin. */
- NPPVpluginScriptableNPObject
+ NPPVpluginScriptableNPObject = 15
} NPPVariable;
/*
NPNVSupportsXEmbedBool = 14, /* Not implemented in WebKit */
/* Get the NPObject wrapper for the browser window. */
- NPNVWindowNPObject,
+ NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject /* Not implemented in WebKit */
header.
To the extent possible the assumptions about the scripting
- language used by the scripting environment have been minimized.*/
+ language used by the scripting environment have been minimized.
+*/
/*
+2004-08-15 Richard Williamson <rjw@apple.com>
+
+ More changes to np headers.
+
+ Reviewed by Darin.
+
+ * Plugins.subproj/WebNetscapePluginPackage.m:
+ (-[WebNetscapePluginPackage load]):
+ * Plugins.subproj/npapi.h:
+ * Plugins.subproj/npfunctions.h:
+ * Plugins.subproj/npruntime.h:
+
2004-08-13 Darin Adler <darin@apple.com>
Reviewed by Chris.
browserFuncs.retainobject = (NPN_RetainObjectProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_RetainObject);
browserFuncs.releaseobject = (NPN_ReleaseObjectProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_ReleaseObject);
browserFuncs.call = (NPN_CallProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_Call);
- browserFuncs.evalute = (NPN_EvaluateProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_Evaluate);
+ browserFuncs.evaluate = (NPN_EvaluateProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_Evaluate);
browserFuncs.getproperty = (NPN_GetPropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetProperty);
browserFuncs.setproperty = (NPN_SetPropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_SetProperty);
browserFuncs.removeproperty = (NPN_RemovePropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_RemoveProperty);
browserFuncs.retainobject = NPN_RetainObject;
browserFuncs.releaseobject = NPN_ReleaseObject;
browserFuncs.call = NPN_Call;
- browserFuncs.evalute = NPN_Evaluate;
+ browserFuncs.evaluate = NPN_Evaluate;
browserFuncs.getproperty = NPN_GetProperty;
browserFuncs.setproperty = NPN_SetProperty;
browserFuncs.removeproperty = NPN_RemoveProperty;
-/* -*- Mode: C; tab-width: 4; -*- */
-/*
- * npapi.h $Revision$
- * Netscape client plug-in API spec
- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+ /*
+ * Netscape client plug-in API spec
+ */
+
#ifndef _NPAPI_H_
#define _NPAPI_H_
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
-#define NP_VERSION_MINOR 12
+#define NP_VERSION_MINOR 14
#define NULL (0L)
#endif
-//#ifndef _NP_RUNTIME_H_
-// Ack! Temporary hack to get build working.
-typedef unsigned char NPBool;
-//#endif
+typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef char* NPMIMEType;
NPPVpluginNeedsXEmbed = 14, /* Not implemented in WebKit */
/* Get the NPObject for scripting the plugin. */
- NPPVpluginScriptableNPObject
+ NPPVpluginScriptableNPObject = 15
} NPPVariable;
/*
NPNVSupportsXEmbedBool = 14, /* Not implemented in WebKit */
/* Get the NPObject wrapper for the browser window. */
- NPNVWindowNPObject,
+ NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject /* Not implemented in WebKit */
typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr) (const NPUTF8 *name);
typedef void (*NPN_GetStringIdentifiersProcPtr) (const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers);
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr) (int32_t intid);
+typedef NPIdentifier (*NPN_IntFromIdentifierProcPtr) (NPIdentifier identifier);
typedef bool (*NPN_IdentifierIsStringProcPtr) (NPIdentifier identifier);
typedef NPUTF8 *(*NPN_UTF8FromIdentifierProcPtr) (NPIdentifier identifier);
typedef bool (*NPN_EvaluateProcPtr) (NPP npp, NPObject *obj, NPString *script, NPVariant *result);
typedef bool (*NPN_GetPropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
typedef bool (*NPN_SetPropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
+typedef bool (*NPN_HasPropertyProcPtr) (NPP, NPObject *npobj, NPIdentifier propertyName);
+typedef bool (*NPN_HasMethodProcPtr) (NPP npp, NPObject *npobj, NPIdentifier methodName);
typedef bool (*NPN_RemovePropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef void (*NPN_SetExceptionProcPtr) (NPObject *obj, NPString *message);
NPN_InvalidateRegionProcPtr invalidateregion;
NPN_ForceRedrawProcPtr forceredraw;
- NPN_ReleaseVariantValueProcPtr releasevariantvalue;
NPN_GetStringIdentifierProcPtr getstringidentifier;
NPN_GetStringIdentifiersProcPtr getstringidentifiers;
NPN_GetIntIdentifierProcPtr getintidentifier;
NPN_IdentifierIsStringProcPtr identifierisstring;
NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
+ NPN_IntFromIdentifierProcPtr intfromidentifier;
NPN_CreateObjectProcPtr createobject;
NPN_RetainObjectProcPtr retainobject;
NPN_ReleaseObjectProcPtr releaseobject;
NPN_CallProcPtr call;
- NPN_EvaluateProcPtr evalute;
+ NPN_EvaluateProcPtr evaluate;
NPN_GetPropertyProcPtr getproperty;
NPN_SetPropertyProcPtr setproperty;
NPN_RemovePropertyProcPtr removeproperty;
+ NPN_HasPropertyProcPtr hasproperty;
+ NPN_HasMethodProcPtr hasmethod;
+ NPN_ReleaseVariantValueProcPtr releasevariantvalue;
NPN_SetExceptionProcPtr setexception;
} NPNetscapeFuncs;
header.
To the extent possible the assumptions about the scripting
- language used by the scripting environment have been minimized.*/
+ language used by the scripting environment have been minimized.
+*/
/*