[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:48:14 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 30e11e482a878626c012abdd477d40b77cd0ca85
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 24 00:36:33 2004 +0000

    WebKit:
    		Implemented changes for latest npruntime.h.
    		Made npruntime.h public.
    
            Reviewed by Chris.
    
            * Plugins.subproj/WebBaseNetscapePluginView.h:
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (-[WebBaseNetscapePluginView pluginScriptableObject]):
            (-[WebBaseNetscapePluginView forceRedraw]):
            (-[WebBaseNetscapePluginView getVariable:value:]):
            * Plugins.subproj/WebBaseNetscapePluginViewPrivate.h:
            * Plugins.subproj/WebNetscapePluginPackage.m:
            (-[WebNetscapePluginPackage load]):
            * Plugins.subproj/npapi.h:
            * Plugins.subproj/npapi.m:
            (NPN_GetValue):
            * Plugins.subproj/npfunctions.h:
            * Plugins.subproj/npruntime.h:
            * WebKit.pbproj/project.pbxproj:
    
    WebCore:
    	Implemented changes for latest npruntime.h.
    
            Reviewed by Chris.
    
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::KWQKHTMLPart):
            (KWQKHTMLPart::windowScriptNPObject):
            (KWQKHTMLPart::getEmbedInstanceForView):
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge windowScriptObject]):
            (-[WebCoreBridge windowScriptNPObject]):
    
    JavaScriptCore:
    	Implemented changes for latest npruntime.h.
    
            Reviewed by Chris.
    
            * JavaScriptCore.pbproj/project.pbxproj:
            * bindings/NP_jsobject.cpp:
            (listFromVariantArgs):
            (identiferFromNPIdentifier):
            (_NPN_CreateScriptObject):
            (NPN_Call):
            (NPN_Evaluate):
            (NPN_GetProperty):
            (NPN_SetProperty):
            (NPN_RemoveProperty):
            * bindings/NP_jsobject.h:
            * bindings/c/c_class.cpp:
            (CClass::methodsNamed):
            (CClass::fieldNamed):
            * bindings/c/c_instance.cpp:
            (CInstance::invokeMethod):
            * bindings/c/c_utility.cpp:
            (convertNPVariantToValue):
            * bindings/c/c_utility.h:
            * bindings/npruntime.cpp:
            (stringIdentifierEqual):
            (stringIdentifierHash):
            (getStringIdentifierDictionary):
            (intIdentifierEqual):
            (intIdentifierHash):
            (getIntIdentifierDictionary):
            (NPN_GetStringIdentifier):
            (NPN_GetStringIdentifiers):
            (NPN_GetIntIdentifier):
            (NPN_IdentifierIsString):
            (NPN_UTF8FromIdentifier):
            (NPN_VariantToInt32):
            (NPN_VariantToDouble):
            (NPN_SetException):
            * bindings/npruntime.h:
            * bindings/objc/WebScriptObject.mm:
            (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
            * bindings/runtime_object.cpp:
            (RuntimeObjectImp::~RuntimeObjectImp):
            * bindings/runtime_root.cpp:
            (KJS::Bindings::rootForInterpreter):
            * bindings/testbindings.cpp:
            (initializeIdentifiers):
            (logMessage):
            (setDoubleValue):
            (setIntValue):
            (setBooleanValue):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d52beb2..ecc802a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,57 @@
+2004-06-23  Richard Williamson   <rjw at apple.com>
+
+	Implemented changes for latest npruntime.h.
+	
+        Reviewed by Chris.
+
+        * JavaScriptCore.pbproj/project.pbxproj:
+        * bindings/NP_jsobject.cpp:
+        (listFromVariantArgs):
+        (identiferFromNPIdentifier):
+        (_NPN_CreateScriptObject):
+        (NPN_Call):
+        (NPN_Evaluate):
+        (NPN_GetProperty):
+        (NPN_SetProperty):
+        (NPN_RemoveProperty):
+        * bindings/NP_jsobject.h:
+        * bindings/c/c_class.cpp:
+        (CClass::methodsNamed):
+        (CClass::fieldNamed):
+        * bindings/c/c_instance.cpp:
+        (CInstance::invokeMethod):
+        * bindings/c/c_utility.cpp:
+        (convertNPVariantToValue):
+        * bindings/c/c_utility.h:
+        * bindings/npruntime.cpp:
+        (stringIdentifierEqual):
+        (stringIdentifierHash):
+        (getStringIdentifierDictionary):
+        (intIdentifierEqual):
+        (intIdentifierHash):
+        (getIntIdentifierDictionary):
+        (NPN_GetStringIdentifier):
+        (NPN_GetStringIdentifiers):
+        (NPN_GetIntIdentifier):
+        (NPN_IdentifierIsString):
+        (NPN_UTF8FromIdentifier):
+        (NPN_VariantToInt32):
+        (NPN_VariantToDouble):
+        (NPN_SetException):
+        * bindings/npruntime.h:
+        * bindings/objc/WebScriptObject.mm:
+        (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+        * bindings/runtime_object.cpp:
+        (RuntimeObjectImp::~RuntimeObjectImp):
+        * bindings/runtime_root.cpp:
+        (KJS::Bindings::rootForInterpreter):
+        * bindings/testbindings.cpp:
+        (initializeIdentifiers):
+        (logMessage):
+        (setDoubleValue):
+        (setIntValue):
+        (setBooleanValue):
+
 === JavaScriptCore-146.1 ===
 
 2004-06-16  Richard Williamson   <rjw at apple.com>
diff --git a/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
index 65aa3e5..c377273 100644
--- a/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
@@ -587,6 +587,9 @@
 			fileRef = 517BE7F40610E39600221947;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		517D52DC056BF2F5003851BD = {
@@ -976,6 +979,9 @@
 			fileRef = 5199B1BE061B65BC0070C006;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		5199B265061BB1300070C006 = {
diff --git a/JavaScriptCore/bindings/NP_jsobject.cpp b/JavaScriptCore/bindings/NP_jsobject.cpp
index 7821a49..5c7bb5d 100644
--- a/JavaScriptCore/bindings/NP_jsobject.cpp
+++ b/JavaScriptCore/bindings/NP_jsobject.cpp
@@ -24,13 +24,25 @@
  */
 #include <NP_jsobject.h>
 
+#include <JavaScriptCore/npruntime.h>
+#include <JavaScriptCore/c_utility.h>
+
+
 using namespace KJS;
 using namespace KJS::Bindings;
 
 
-static KJS::List listFromNPArray(KJS::ExecState *exec, NPObject **args, unsigned argCount)
+static KJS::List listFromVariantArgs(KJS::ExecState *exec, const NPVariant *args, unsigned argCount)
 {
-    KJS::List aList;    
+    KJS::List aList; 
+    unsigned i;
+    const NPVariant *v = args;
+    
+    for (i = 0; i < argCount; i++) {
+        aList.append (convertNPVariantToValue (exec, v));
+        v++;
+    }
+    
     return aList;
 }
 
@@ -59,9 +71,8 @@ static NPClass _javascriptClass = {
 static NPClass *javascriptClass = &_javascriptClass;
 NPClass *NPScriptObjectClass = javascriptClass;
 
-Identifier identiferFromNPIdentifier(NPIdentifier ident)
+Identifier identiferFromNPIdentifier(const NPUTF8 *name)
 {
-    const NPUTF8 *name = NPN_UTF8FromIdentifier (ident);
     NPUTF16 *methodName;
     unsigned int UTF16Length;
     
@@ -72,144 +83,197 @@ Identifier identiferFromNPIdentifier(NPIdentifier ident)
     return identifier;
 }
 
-void NPN_Call (NPScriptObject *o, NPIdentifier ident, NPObject **args, unsigned argCount, NPScriptResultFunctionPtr resultCallback, void *resultContext)
+NPObject *_NPN_CreateScriptObject (KJS::ObjectImp *imp, KJS::Bindings::RootObject *root)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
-    NPVariant resultVariant;
-    
-    // Lookup the function object.
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    Value func = obj->imp->get (exec, identiferFromNPIdentifier(ident));
-    Interpreter::unlock();
-
-    if (func.isNull()) {
-        NPN_InitializeVariantAsNull(&resultVariant);
-    }
-    else if ( func.type() == UndefinedType) {
-        NPN_InitializeVariantAsUndefined(&resultVariant);
-    }
-    else {
-        // Call the function object.
-        ObjectImp *funcImp = static_cast<ObjectImp*>(func.imp());
-        Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
-        List argList = listFromNPArray(exec, args, argCount);
-        Interpreter::lock();
-        Value result = funcImp->call (exec, thisObj, argList);
-        Interpreter::unlock();
+    JavaScriptObject *obj = (JavaScriptObject *)NPN_CreateObject(NPScriptObjectClass);
 
-        // Convert and return the result of the function call.
-        convertValueToNPVariant(exec, result, &resultVariant);
-    }
-    
-    resultCallback (&resultVariant, resultContext);
+    obj->imp = imp;
+    obj->root = root;    
+
+    addNativeReference (root, imp);
     
-    NPN_ReleaseVariantValue (&resultVariant);
+    return (NPObject *)obj;
 }
 
-void NPN_Evaluate (NPScriptObject *o, NPString *s, NPScriptResultFunctionPtr resultCallback, void *resultContext)
+NPBool NPN_Call (NPObject *o, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPVariant *result)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
-    NPVariant resultVariant;
-
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
-    
-    Interpreter::lock();
-    NPUTF16 *scriptString;
-    unsigned int UTF16Length;
-    convertNPStringToUTF16 (s, &scriptString, &UTF16Length);    // requires free() of returned memory.
-    KJS::Value result = obj->root->interpreter()->evaluate(UString(), 0, UString((const UChar *)scriptString,UTF16Length)).value();
-    Interpreter::unlock();
-    
-    free ((void *)scriptString);
-    
-    convertValueToNPVariant(exec, result, &resultVariant);
+    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();
 
-    resultCallback (&resultVariant, resultContext);
+        if (func.isNull()) {
+            NPN_InitializeVariantAsNull(result);
+            return false;
+        }
+        else if ( func.type() == UndefinedType) {
+            NPN_InitializeVariantAsUndefined(result);
+            return false;
+        }
+        else {
+            // Call the function object.
+            ObjectImp *funcImp = static_cast<ObjectImp*>(func.imp());
+            Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
+            List argList = listFromVariantArgs(exec, args, argCount);
+            Interpreter::lock();
+            Value resultV = funcImp->call (exec, thisObj, argList);
+            Interpreter::unlock();
 
-    NPN_ReleaseVariantValue (&resultVariant);
+            // Convert and return the result of the function call.
+            convertValueToNPVariant(exec, resultV, result);
+            return true;
+        }
+    }
+    else {
+        if (o->_class->invoke) {
+            return o->_class->invoke (o, methodName, args, argCount, result);
+        }
+    }
+    
+    return true;
 }
 
-void NPN_GetProperty (NPScriptObject *o, NPIdentifier propertyName, NPScriptResultFunctionPtr resultCallback, void *resultContext)
+NPBool NPN_Evaluate (NPObject *o, NPString *s, NPVariant *variant)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
-    NPVariant resultVariant;
+    if (o->_class == NPScriptObjectClass) {
+        JavaScriptObject *obj = (JavaScriptObject *)o; 
 
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    Value result = obj->imp->get (exec, identiferFromNPIdentifier(propertyName));
-    Interpreter::unlock();
-    
-    convertValueToNPVariant(exec, result, &resultVariant);
+        ExecState *exec = obj->root->interpreter()->globalExec();
+        Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
+        
+        Interpreter::lock();
+        NPUTF16 *scriptString;
+        unsigned int UTF16Length;
+        convertNPStringToUTF16 (s, &scriptString, &UTF16Length);    // requires free() of returned memory.
+        KJS::Value result = obj->root->interpreter()->evaluate(UString(), 0, UString((const UChar *)scriptString,UTF16Length)).value();
+        Interpreter::unlock();
+        
+        free ((void *)scriptString);
+        
+        convertValueToNPVariant(exec, result, variant);
     
-    resultCallback (&resultVariant, resultContext);
-
-    NPN_ReleaseVariantValue (&resultVariant);
+        return true;
+    }
+    return false;
 }
 
-void NPN_SetProperty (NPScriptObject *o, NPIdentifier propertyName, const NPVariant *variant)
+NPBool NPN_GetProperty (NPObject *o, NPIdentifier propertyName, NPVariant *variant)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
+    if (o->_class == NPScriptObjectClass) {
+        JavaScriptObject *obj = (JavaScriptObject *)o; 
+        ExecState *exec = obj->root->interpreter()->globalExec();
 
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    obj->imp->put (exec, identiferFromNPIdentifier(propertyName), convertNPVariantToValue(exec, variant));
-    Interpreter::unlock();
-}
+        PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
+        if (i->isString) {
+            if (!obj->imp->hasProperty (exec, identiferFromNPIdentifier(i->value.string))) {
+                NPN_InitializeVariantAsNull(variant);
+                return false;
+            }
+        }
+        else {
+            if (!obj->imp->hasProperty (exec, i->value.number)) {
+                NPN_InitializeVariantAsNull(variant);
+                return false;
+            }
+        }
+        
+        Interpreter::lock();
+        Value result;
+        if (i->isString) {
+            result = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
+        }
+        else {
+            result = obj->imp->get (exec, i->value.number);
+        }
+        Interpreter::unlock();
 
-void NPN_RemoveProperty (NPScriptObject *o, NPIdentifier propertyName)
-{
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
+        if (result.isNull()) {
+            NPN_InitializeVariantAsNull(variant);
+            return false;
+        }
+        else if (result.type() == UndefinedType) {
+            NPN_InitializeVariantAsUndefined(variant);
+            return false;
+        }
+        else {
+            convertValueToNPVariant(exec, result, variant);
+        }
 
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    obj->imp->deleteProperty (exec, identiferFromNPIdentifier(propertyName));
-    Interpreter::unlock();
+        return true;
+    }
+    else if (o->_class->hasProperty && o->_class->getProperty) {
+        if (o->_class->hasProperty (o->_class, propertyName)) {
+            return o->_class->getProperty (o, propertyName, variant);
+        }
+        else {
+            return false;
+        }
+    }
+    return false;
 }
 
-void NPN_ToString (NPScriptObject *o, NPScriptResultFunctionPtr resultCallback, void *resultContext)
+NPBool NPN_SetProperty (NPObject *o, NPIdentifier propertyName, const NPVariant *variant)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
-    
-    Interpreter::lock();
-    Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    
-    NPVariant resultVariant;
-    coerceValueToNPVariantStringType(exec, thisObj, &resultVariant);
+    if (o->_class == NPScriptObjectClass) {
+        JavaScriptObject *obj = (JavaScriptObject *)o; 
 
-    Interpreter::unlock();
-    
-    resultCallback (&resultVariant, resultContext);
-    
-    NPN_ReleaseVariantValue (&resultVariant);
+        ExecState *exec = obj->root->interpreter()->globalExec();
+        Interpreter::lock();
+        Value result;
+        PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
+        if (i->isString) {
+            obj->imp->put (exec, identiferFromNPIdentifier(i->value.string), convertNPVariantToValue(exec, variant));
+        }
+        else {
+            obj->imp->put (exec, i->value.number, convertNPVariantToValue(exec, variant));
+        }
+        Interpreter::unlock();
+        
+        return true;
+    }
+    else if (o->_class->setProperty) {
+        return o->_class->setProperty (o, propertyName, variant);
+    }
+    return false;
 }
 
-void NPN_GetPropertyAtIndex (NPScriptObject *o, int32_t index, NPScriptResultFunctionPtr resultCallback, void *resultContext)
+NPBool NPN_RemoveProperty (NPObject *o, NPIdentifier propertyName)
 {
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
+    if (o->_class == NPScriptObjectClass) {
+        JavaScriptObject *obj = (JavaScriptObject *)o; 
+        ExecState *exec = obj->root->interpreter()->globalExec();
 
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    Value result = obj->imp->get (exec, (unsigned)index);
-    Interpreter::unlock();
+        PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
+        if (i->isString) {
+            if (!obj->imp->hasProperty (exec, identiferFromNPIdentifier(i->value.string))) {
+                return false;
+            }
+        }
+        else {
+            if (!obj->imp->hasProperty (exec, i->value.number)) {
+                return false;
+            }
+        }
 
-    NPVariant resultVariant;
-    convertValueToNPVariant(exec, result, &resultVariant);
-    
-    resultCallback (&resultVariant, resultContext);
-
-    NPN_ReleaseVariantValue (&resultVariant);
-}
-
-void NPN_SetPropertyAtIndex (NPScriptObject *o, unsigned index, const NPVariant *value)
-{
-    JavaScriptObject *obj = (JavaScriptObject *)o; 
-
-    ExecState *exec = obj->root->interpreter()->globalExec();
-    Interpreter::lock();
-    obj->imp->put (exec, (unsigned)index, convertNPVariantToValue(exec, value));
-    Interpreter::unlock();
+        Interpreter::lock();
+        if (i->isString) {
+            obj->imp->deleteProperty (exec, identiferFromNPIdentifier(i->value.string));
+        }
+        else {
+            obj->imp->deleteProperty (exec, i->value.number);
+        }
+        Interpreter::unlock();
+        
+        return true;
+    }
+    return false;
 }
 
diff --git a/JavaScriptCore/bindings/NP_jsobject.h b/JavaScriptCore/bindings/NP_jsobject.h
index f5662de..c8780f0 100644
--- a/JavaScriptCore/bindings/NP_jsobject.h
+++ b/JavaScriptCore/bindings/NP_jsobject.h
@@ -22,14 +22,21 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-#include <npruntime.h>
+#ifndef _NP_JSOBJECT_H
+#define _NP_JSOBJECT_H
 
-#include <c_utility.h>
+#include <JavaScriptCore/npruntime.h>
 
-#include <runtime.h>
-#include <runtime_object.h>
-#include <runtime_root.h>
+#include <JavaScriptCore/runtime.h>
+#include <JavaScriptCore/runtime_object.h>
+#include <JavaScriptCore/runtime_root.h>
  
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern NPClass *NPScriptObjectClass;
+
 typedef struct
 {
     NPObject object;
@@ -37,3 +44,10 @@ typedef struct
     KJS::Bindings::RootObject *root;
 } JavaScriptObject;
 
+NPObject *_NPN_CreateScriptObject (KJS::ObjectImp *imp, KJS::Bindings::RootObject *root);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/JavaScriptCore/bindings/c/c_class.cpp b/JavaScriptCore/bindings/c/c_class.cpp
index 3ccc17e..46edc08 100644
--- a/JavaScriptCore/bindings/c/c_class.cpp
+++ b/JavaScriptCore/bindings/c/c_class.cpp
@@ -93,13 +93,11 @@ MethodList CClass::methodsNamed(const char *_name) const
         return methodList;
     }
     
-    if (NPN_IsValidIdentifier (_name)) {
-        NPIdentifier ident = NPN_GetIdentifier (_name);
-        if (_isa->hasMethod && _isa->hasMethod (_isa, ident)){
-            Method *aMethod = new CMethod (ident);
-            CFDictionaryAddValue ((CFMutableDictionaryRef)_methods, methodName, aMethod);
-            methodList.addMethod (aMethod);
-        }
+    NPIdentifier ident = NPN_GetStringIdentifier (_name);
+    if (_isa->hasMethod && _isa->hasMethod (_isa, ident)){
+        Method *aMethod = new CMethod (ident);
+        CFDictionaryAddValue ((CFMutableDictionaryRef)_methods, methodName, aMethod);
+        methodList.addMethod (aMethod);
     }
 
     CFRelease (methodName);
@@ -117,12 +115,10 @@ Field *CClass::fieldNamed(const char *name) const
         return aField;
     }
 
-    if (NPN_IsValidIdentifier (name)) {
-        NPIdentifier ident = NPN_GetIdentifier (name);
-        if (_isa->hasProperty && _isa->hasProperty (_isa, ident)){
-            aField = new CField (ident);
-            CFDictionaryAddValue ((CFMutableDictionaryRef)_fields, fieldName, aField);
-        }
+    NPIdentifier ident = NPN_GetStringIdentifier (name);
+    if (_isa->hasProperty && _isa->hasProperty (_isa, ident)){
+        aField = new CField (ident);
+        CFDictionaryAddValue ((CFMutableDictionaryRef)_fields, fieldName, aField);
     }
     
     CFRelease (fieldName);
diff --git a/JavaScriptCore/bindings/c/c_instance.cpp b/JavaScriptCore/bindings/c/c_instance.cpp
index c7ae750..2a695a6 100644
--- a/JavaScriptCore/bindings/c/c_instance.cpp
+++ b/JavaScriptCore/bindings/c/c_instance.cpp
@@ -97,7 +97,7 @@ Value CInstance::invokeMethod (KJS::ExecState *exec, const MethodList &methodLis
     CMethod *method = 0;
     method = static_cast<CMethod*>(methodList.methodAt(0));
 
-    NPIdentifier ident = NPN_GetIdentifier (method->name());
+    NPIdentifier ident = NPN_GetStringIdentifier (method->name());
     if (!_object->_class->hasMethod (_object->_class, ident)) {
         return Undefined();
     }
diff --git a/JavaScriptCore/bindings/c/c_utility.cpp b/JavaScriptCore/bindings/c/c_utility.cpp
index 433ecb3..624e0bf 100644
--- a/JavaScriptCore/bindings/c/c_utility.cpp
+++ b/JavaScriptCore/bindings/c/c_utility.cpp
@@ -142,11 +142,7 @@ Value convertNPVariantToValue (KJS::ExecState *exec, const NPVariant *variant)
     else if (type == NPVariantObjectType) {
         NPObject *obj = variant->value.objectValue;
         
-        if (NPN_IsKindOfClass (obj, NPArrayClass)) {
-            // FIXME:  Need to implement
-        }
-     
-        else if (NPN_IsKindOfClass (obj, NPScriptObjectClass)) {
+        if (obj->_class == NPScriptObjectClass) {
             // Get ObjectImp from NP_JavaScriptObject.
             JavaScriptObject *o = (JavaScriptObject *)obj;
             return Object(const_cast<ObjectImp*>(o->imp));
diff --git a/JavaScriptCore/bindings/c/c_utility.h b/JavaScriptCore/bindings/c/c_utility.h
index a7a52d5..fb10b9c 100644
--- a/JavaScriptCore/bindings/c/c_utility.h
+++ b/JavaScriptCore/bindings/c/c_utility.h
@@ -33,7 +33,6 @@
 
 typedef uint16_t NPUTF16;
 NPUTF16 *NPN_UTF16FromString (NPString *obj);
-NPUTF16 *NPN_UTF16FromString (NPString *obj);
 
 typedef enum 
 {
@@ -53,4 +52,13 @@ extern void coerceValueToNPVariantStringType (KJS::ExecState *exec, const KJS::V
 extern void convertValueToNPVariant (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result);
 extern KJS::Value convertNPVariantToValue (KJS::ExecState *exec, const NPVariant *variant);
 
+typedef struct 
+{
+    union {
+        const NPUTF8 *string;
+        int32_t number;
+    } value;
+    bool isString;
+} PrivateIdentifier;
+
 #endif
diff --git a/JavaScriptCore/bindings/npruntime.cpp b/JavaScriptCore/bindings/npruntime.cpp
index 362c12f..0718ab2 100644
--- a/JavaScriptCore/bindings/npruntime.cpp
+++ b/JavaScriptCore/bindings/npruntime.cpp
@@ -27,12 +27,12 @@
 #include <npruntime.h>
 #include <c_utility.h>
 
-static Boolean identifierEqual(const void *value1, const void *value2)
+static Boolean stringIdentifierEqual(const void *value1, const void *value2)
 {
     return strcmp((const char *)value1, (const char *)value2) == 0;
 }
 
-static CFHashCode identifierHash (const void *value)
+static CFHashCode stringIdentifierHash (const void *value)
 {
     const char *key = (const char *)value;
     unsigned int len = strlen(key);
@@ -52,75 +52,77 @@ static CFHashCode identifierHash (const void *value)
     return result;
 }
 
-CFDictionaryKeyCallBacks identifierCallbacks = {
+CFDictionaryKeyCallBacks stringIdentifierCallbacks = {
     0,
     NULL,
     NULL,
     NULL,
-    identifierEqual,
-    identifierHash
+    stringIdentifierEqual,
+    stringIdentifierHash
 };
 
-static CFMutableDictionaryRef identifierDictionary = 0;
+static CFMutableDictionaryRef stringIdentifierDictionary = 0;
 
-static CFMutableDictionaryRef getIdentifierDictionary()
+static CFMutableDictionaryRef getStringIdentifierDictionary()
 {
-    if (!identifierDictionary)
-        identifierDictionary = CFDictionaryCreateMutable(NULL, 0, &identifierCallbacks, NULL);
-    return identifierDictionary;
+    if (!stringIdentifierDictionary)
+        stringIdentifierDictionary = CFDictionaryCreateMutable(NULL, 0, &stringIdentifierCallbacks, NULL);
+    return stringIdentifierDictionary;
 }
 
-#define INITIAL_IDENTIFIER_NAME_COUNT   128
+static Boolean intIdentifierEqual(const void *value1, const void *value2)
+{
+    return value1 == value2;
+}
+
+static CFHashCode intIdentifierHash (const void *value)
+{
+    return (CFHashCode)value;
+}
+
+CFDictionaryKeyCallBacks intIdentifierCallbacks = {
+    0,
+    NULL,
+    NULL,
+    NULL,
+    intIdentifierEqual,
+    intIdentifierHash
+};
 
-static const char **identifierNames = 0;
-static unsigned int maxIdentifierNames;
-static uint32_t identifierCount = 1;
+static CFMutableDictionaryRef intIdentifierDictionary = 0;
 
-NPIdentifier NPN_GetIdentifier (const NPUTF8 *name)
+static CFMutableDictionaryRef getIntIdentifierDictionary()
+{
+    if (!intIdentifierDictionary)
+        intIdentifierDictionary = CFDictionaryCreateMutable(NULL, 0, &intIdentifierCallbacks, NULL);
+    return intIdentifierDictionary;
+}
+
+NPIdentifier NPN_GetStringIdentifier (const NPUTF8 *name)
 {
     assert (name);
     
     if (name) {
-        NPIdentifier identifier = 0;
+        PrivateIdentifier *identifier = 0;
         
-        identifier = (NPIdentifier)CFDictionaryGetValue (getIdentifierDictionary(), (const void *)name);
+        identifier = (PrivateIdentifier *)CFDictionaryGetValue (getStringIdentifierDictionary(), (const void *)name);
         if (identifier == 0) {
-            identifier = (NPIdentifier)identifierCount++;
+            identifier = (PrivateIdentifier *)malloc (sizeof(PrivateIdentifier));
             // We never release identifier names, so this dictionary will grow, as will
             // the memory for the identifier name strings.
+            identifier->isString = true;
             const char *identifierName = strdup (name);
-            
-            if (!identifierNames) {
-                identifierNames = (const char **)malloc (sizeof(const char *)*INITIAL_IDENTIFIER_NAME_COUNT);
-                maxIdentifierNames = INITIAL_IDENTIFIER_NAME_COUNT;
-            }
-            
-            if (identifierCount >= maxIdentifierNames) {
-                maxIdentifierNames *= 2;
-                identifierNames = (const char **)realloc ((void *)identifierNames, sizeof(const char *)*maxIdentifierNames);
-            }
-            
-            identifierNames[(uint32_t)identifier] = identifierName;
+            identifier->value.string = identifierName;
 
-            CFDictionaryAddValue (getIdentifierDictionary(), identifierName, (const void *)identifier);
+            CFDictionaryAddValue (getStringIdentifierDictionary(), identifierName, (const void *)identifier);
         }
-        return identifier;
+        return (NPIdentifier)identifier;
     }
     
     return 0;
 }
 
-bool NPN_IsValidIdentifier (const NPUTF8 *name)
-{
-    assert (name);
-    
-    if (name)
-        return CFDictionaryGetValue (getIdentifierDictionary(), (const void *)name) == 0 ? false : true;
-
-    return false;
-}
-
-void NPN_GetIdentifiers (const NPUTF8 **names, int nameCount, NPIdentifier *identifiers)
+void NPN_GetStringIdentifiers (const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
 {
     assert (names);
     assert (identifiers);
@@ -129,17 +131,40 @@ void NPN_GetIdentifiers (const NPUTF8 **names, int nameCount, NPIdentifier *iden
         int i;
         
         for (i = 0; i < nameCount; i++) {
-            identifiers[i] = NPN_GetIdentifier (names[i]);
+            identifiers[i] = NPN_GetStringIdentifier (names[i]);
         }
     }
 }
 
+NPIdentifier NPN_GetIntIdentifier(int32_t intid)
+{
+    PrivateIdentifier *identifier = 0;
+    
+    identifier = (PrivateIdentifier *)CFDictionaryGetValue (getIntIdentifierDictionary(), (const void *)intid);
+    if (identifier == 0) {
+        identifier = (PrivateIdentifier *)malloc (sizeof(PrivateIdentifier));
+        // We never release identifier names, so this dictionary will grow.
+        identifier->isString = false;
+        identifier->value.number = intid;
+
+        CFDictionaryAddValue (getIntIdentifierDictionary(), (const void *)intid, (const void *)identifier);
+    }
+    return (NPIdentifier)identifier;
+}
+
+NPBool NPN_IdentifierIsString(NPIdentifier identifier)
+{
+    PrivateIdentifier *i = (PrivateIdentifier *)identifier;
+    return i->isString;
+}
+
 NPUTF8 *NPN_UTF8FromIdentifier (NPIdentifier identifier)
 {
-    if (identifier == 0 || (uint32_t)identifier >= identifierCount)
+    PrivateIdentifier *i = (PrivateIdentifier *)identifier;
+    if (!i->isString)
         return NULL;
         
-    return (NPUTF8 *)identifierNames[(uint32_t)identifier];
+    return (NPUTF8 *)i->value.string;
 }
 
 NPBool NPN_VariantIsVoid (const NPVariant *variant)
@@ -206,7 +231,7 @@ NPBool NPN_VariantToInt32 (const NPVariant *variant, int32_t *result)
 {
     if (variant->type == NPVariantInt32Type)
         *result = variant->value.intValue;
-    else if (variant->type != NPVariantDoubleType)
+    else if (variant->type == NPVariantDoubleType)
         *result = (int32_t)variant->value.doubleValue;
     else
         return false;
@@ -218,7 +243,7 @@ NPBool NPN_VariantToDouble (const NPVariant *variant, double *result)
 {
     if (variant->type == NPVariantInt32Type)
         *result = (double)variant->value.intValue;
-    else if (variant->type != NPVariantDoubleType)
+    else if (variant->type == NPVariantDoubleType)
         *result = variant->value.doubleValue;
     else
         return false;
@@ -399,20 +424,6 @@ void NPN_ReleaseObject (NPObject *obj)
     }
 }
 
-bool NPN_IsKindOfClass (const NPObject *obj, const NPClass *aClass)
-{
-    assert (obj);
-    assert (aClass);
-    
-    if (obj && aClass) {
-        if (obj->_class == aClass)
-            return true;
-    }
-    
-    return false;
-}
-
-
 void NPN_SetExceptionWithUTF8 (NPObject *obj, const NPUTF8 *message, int32_t length)
 {
     assert (obj);
@@ -431,94 +442,3 @@ void NPN_SetException (NPObject *obj, NPString *message)
 {
     // FIX ME.  Need to implement.
 }
-
-// ---------------------------------- Types ----------------------------------
-
-// ---------------------------------- NP_Array ----------------------------------
-
-typedef struct
-{
-    NPObject object;
-    NPObject **objects;
-    int32_t count;
-} ArrayObject;
-
-static NPObject *arrayAllocate()
-{
-    return (NPObject *)malloc(sizeof(ArrayObject));
-}
-
-static void arrayDeallocate (ArrayObject *array)
-{
-    int32_t i;
-    
-    for (i = 0; i < array->count; i++) {
-        NPN_ReleaseObject(array->objects[i]);
-    }
-    free (array->objects);
-    free (array);
-}
-
-
-static NPClass _arrayClass = { 
-    1,
-    arrayAllocate, 
-    (NPDeallocateFunctionPtr)arrayDeallocate, 
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-};
-
-static NPClass *arrayClass = &_arrayClass;
-NPClass *NPArrayClass = arrayClass;
-
-NPArray *NPN_CreateArray (NPObject **objects, int32_t count)
-{
-    int32_t i;
-
-    assert (count >= 0);
-    
-    ArrayObject *array = (ArrayObject *)NPN_CreateObject(arrayClass);
-    array->objects = (NPObject **)malloc (sizeof(NPObject *)*count);
-    for (i = 0; i < count; i++) {
-        array->objects[i] = NPN_RetainObject (objects[i]);
-    }
-    
-    return (NPArray *)array;
-}
-
-NPArray *NPN_CreateArrayV (int32_t count, ...)
-{
-    va_list args;
-
-    assert (count >= 0);
-
-    ArrayObject *array = (ArrayObject *)NPN_CreateObject(arrayClass);
-    array->objects = (NPObject **)malloc (sizeof(NPObject *)*count);
-
-    va_start (args, count);
-    
-    int32_t i;
-    for (i = 0; i < count; i++) {
-        NPObject *obj = va_arg (args, NPObject *);
-        array->objects[i] = NPN_RetainObject (obj);
-    }
-        
-    va_end (args);
-
-    return (NPArray *)array;
-}
-
-/*
-NPVariant *NPN_ObjectAtIndex (NPArray *obj, int32_t index)
-{
-    ArrayObject *array = (ArrayObject *)obj;
-
-    assert (index < array->count && array > 0);
-
-    return NPN_RetainObject (array->objects[index]);
-}
-*/
diff --git a/JavaScriptCore/bindings/npruntime.h b/JavaScriptCore/bindings/npruntime.h
index 8fa2beb..9cc7a08 100644
--- a/JavaScriptCore/bindings/npruntime.h
+++ b/JavaScriptCore/bindings/npruntime.h
@@ -48,19 +48,6 @@ extern "C" {
     to support the extended Netscape script-ability API for plugins (NP-SAP).
     NP-SAP is an extension of the Netscape plugin API.  As such we have adopted the
     use of the "NP" prefix for this API.  
-    
-    The following NP-SAP entry points were added to the Netscape plugin API (in npsap.h):
-
-    NPObject *NPP_GetNativeObjectForScript (NPP instance);
-    NPScriptObject *NPN_GetWindowScriptObject (NPP instance);
-    NPScriptObject *NPN_GetInstanceScriptObject (NPP instance);
-
-    These functions are used to establish the initial binding between the user agent
-    and native code.  The DOM objects in the user agent can be examined and manipulated using
-    the NPN_ functions that operate on a NPScriptObject described in this header.
-    
-    To the extent possible the assumptions about the scripting language used by
-    the scripting environment have been minimized.
 */
 
 
@@ -71,11 +58,6 @@ extern "C" {
 typedef struct NPObject NPObject;
 typedef struct NPClass NPClass;
 
-/*
-    A NPScriptObject wraps a script Object in an NPObject.
-*/
-typedef NPObject NPScriptObject;
-
 typedef char NPUTF8;
 typedef struct _NPString {
     const NPUTF8 *UTF8Characters;
@@ -177,7 +159,7 @@ void NPN_InitializeVariantWithVariant (NPVariant *destination, const NPVariant *
 	String                      NPVariant (with type NPVariantStringType)
 	Undefined                   NPVariant (with type NPVariantUndefinedType)
 	Null                        NPVariant (with type NPVariantNullType)
-	Object (including Array)    NPVariant (with type NPVariantObjectType, objectValue will be a NPScriptObject)
+	Object (including Array)    NPVariant (with type NPVariantObjectType, objectValue will be a NPObject)
 	Object (NPObject wrapper)   NPVariant (with type NPVariantObjectType)
 
 
@@ -189,28 +171,26 @@ void NPN_InitializeVariantWithVariant (NPVariant *destination, const NPVariant *
 	NPVariant (with type NPVariantUndefinedType)          Undefined
 	NPVariant (with type NPVariantNullType)               Null
 	NPArray                                               Array (restricted)
-	NPScriptObject                                        Object
-	other NPObject                                        Object (NPObject wrapper)
+	NObject                                               Object or (NPObject wrapper)
 
 */
 
-typedef const void *NPIdentifier;
+typedef void *NPIdentifier;
 
 /*
-    NPObjects have methods and properties.  Methods and properties are named with NPIdentifiers.
-    These identifiers may be reflected in script.  NPIdentifiers can be compared using ==.
-    
-    NPN_IsValidIdentifier will return true if an identifier for the name has already been
-    assigned with either NPIdentifierFromUTF8() or NPN_GetIdentifiers();
-*/
-NPIdentifier NPN_GetIdentifier (const NPUTF8 *name);
-void NPN_GetIdentifiers (const NPUTF8 **names, int nameCount, NPIdentifier *identifiers);
-
-/*
-    The NPUTF8 returned from NPN_UTF8FromIdentifier should be freed.
+    NPObjects have methods and properties.  Methods and properties are
+    identified with NPIdentifiers.  These identifiers may be reflected
+    in script.  NPIdentifiers can be either strings or integers, IOW,
+    methods and properties can be identified by either strings or
+    integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
+    compared using ==.  In case of any errors, the requested
+    NPIdentifier(s) will be NULL.
 */
+NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
+void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers);
+NPIdentifier NPN_GetIntIdentifier(int32_t intid);
+NPBool NPN_IdentifierIsString(NPIdentifier identifier);
 NPUTF8 *NPN_UTF8FromIdentifier (NPIdentifier identifier);
-void NPN_ReleaseUTF8 (NPUTF8 *string);
 
 /*
     NPObject behavior is implemented using the following set of callback functions.
@@ -238,11 +218,11 @@ typedef NPBool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, con
     exist.
     
     NPInvalidateFunctionPtr is called by the scripting environment when the native code is
-    shutdown.  Any attempt to message a NPScriptObject instance after the invalidate
+    shutdown.  Any attempt to message a NPObject instance after the invalidate
     callback has been called will result in undefined behavior, even if the
-    native code is still retaining those NPScriptObject instances.
+    native code is still retaining those NPObject instances.
     (The runtime will typically return immediately, with 0 or NULL, from an attempt to
-    dispatch to a NPScriptObject, but this behavior should not be depended upon.)
+    dispatch to a NPObject, but this behavior should not be depended upon.)
 */
 struct NPClass
 {
@@ -287,15 +267,7 @@ NPObject *NPN_RetainObject (NPObject *obj);
 void NPN_ReleaseObject (NPObject *obj);
 
 /*
-    Built-in data types.  These classes can be passed to NPN_IsKindOfClass().
-*/
-extern NPClass *NPArrayClass;
-extern NPClass *NPScriptObjectClass;
-
-typedef NPObject NPArray;
-
-/*
-    Functions to access script objects represented by NPScriptObject.
+    Functions to access script objects represented by NPObject.
     
     Calls to script objects are asynchronous.  If a function returns a value, it
     will be supplied via the NPScriptResultFunctionPtr callback.
@@ -305,51 +277,16 @@ typedef NPObject NPArray;
     Calls made from script to the plugin will always be made on the main
     user agent thread, this include calls to NPScriptResultFunctionPtr callbacks.
 */
-typedef void (*NPScriptResultFunctionPtr)(const NPVariant *result, void *resultContext);
-
-void NPN_Call (NPScriptObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPScriptResultFunctionPtr resultCallback);
-void NPN_Evaluate (NPScriptObject *obj, NPString *script, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_GetProperty (NPScriptObject *obj, NPIdentifier  propertyName, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_SetProperty (NPScriptObject *obj, NPIdentifier  propertyName, const NPVariant *value);
-void NPN_RemoveProperty (NPScriptObject *obj, NPIdentifier propertyName);
-void NPN_ToString (NPScriptObject *obj, NPScriptResultFunctionPtr result, void *resultContext);
-void NPN_GetPropertyAtIndex (NPScriptObject *obj, int32_t index, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_SetPropertyAtIndex (NPScriptObject *obj, unsigned index, const NPVariant *value);
-
-/*
-    NPArrays are immutable.  They are used to pass arguments to 
-    the script functions that expect arrays, or to export 
-    arrays of properties.  NPArray is represented in JavaScript
-    by a restricted Array.  The Array in JavaScript is read-only,
-    only has index accessors, and may not be resized.
-    
-    Objects added to arrays are retained by the array.
-*/
-NPArray *NPN_CreateArray (NPVariant **, int32_t count);
-NPArray *NPN_CreateArrayV (int32_t count, ...);
-
-#if 0
-/*
-    Objects returned by NPN_ObjectAtIndex pass a reference count
-    to the caller.  The caller must release the object.
-*/
-const NPVariant *NPN_ObjectAtIndex (NPArray *array, int32_t index);
-#endif
-
-/*
-    Returns true if the object is a kind of class as specified by
-    aClass.
-*/
-bool NPN_IsKindOfClass (const NPObject *obj, const NPClass *aClass);
+NPBool NPN_Call (NPObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPVariant *result);
+NPBool NPN_Evaluate (NPObject *obj, NPString *script, NPVariant *result);
+NPBool NPN_GetProperty (NPObject *obj, NPIdentifier  propertyName, NPVariant *result);
+NPBool NPN_SetProperty (NPObject *obj, NPIdentifier  propertyName, const NPVariant *value);
+NPBool NPN_RemoveProperty (NPObject *obj, NPIdentifier propertyName);
 
 /*
     NPN_SetException may be called to trigger a script exception upon return
     from entry points into NPObjects.
-        
-    NPN_SetExceptionWithUTF8() takes an UTF8 string and a length.  -1 may be passed for
-    the length if the string is null terminated.
 */
-void NPN_SetExceptionWithUTF8 (NPObject *obj, const NPUTF8 *message, int32_t length);
 void NPN_SetException (NPObject *obj, NPString *message);
 
 #ifdef __cplusplus
diff --git a/JavaScriptCore/bindings/objc/WebScriptObject.mm b/JavaScriptCore/bindings/objc/WebScriptObject.mm
index 6a38d6d..6849730 100644
--- a/JavaScriptCore/bindings/objc/WebScriptObject.mm
+++ b/JavaScriptCore/bindings/objc/WebScriptObject.mm
@@ -328,7 +328,11 @@ static KJS::List listFromNSArray(ExecState *exec, NSArray *array)
         result = [NSNumber numberWithDouble:n.value()];
     }
     
-    // Boolean?
+    else if (value.type() == KJS::BooleanType) {
+        KJS::BooleanImp *b = static_cast<KJS::BooleanImp*>(value.imp());
+        result = [NSNumber numberWithBool:b->value()];
+    }
+    
     return result;
 }
 
diff --git a/JavaScriptCore/bindings/runtime_object.cpp b/JavaScriptCore/bindings/runtime_object.cpp
index 67738e7..614fb68 100644
--- a/JavaScriptCore/bindings/runtime_object.cpp
+++ b/JavaScriptCore/bindings/runtime_object.cpp
@@ -49,8 +49,9 @@ RuntimeObjectImp::RuntimeObjectImp(ObjectImp *proto)
 
 RuntimeObjectImp::~RuntimeObjectImp()
 {
-    if (ownsInstance)
+    if (ownsInstance) {
         delete instance;
+    }
 }
 
 RuntimeObjectImp::RuntimeObjectImp(Bindings::Instance *i, bool oi) : ObjectImp ((ObjectImp *)0)
diff --git a/JavaScriptCore/bindings/runtime_root.cpp b/JavaScriptCore/bindings/runtime_root.cpp
index 29cc174..5d633bc 100644
--- a/JavaScriptCore/bindings/runtime_root.cpp
+++ b/JavaScriptCore/bindings/runtime_root.cpp
@@ -129,6 +129,7 @@ const Bindings::RootObject *KJS::Bindings::rootForImp (ObjectImp *imp)
 const Bindings::RootObject *KJS::Bindings::rootForInterpreter (KJS::Interpreter *interpreter)
 {
     CFMutableDictionaryRef refsByRoot = getReferencesByRootDictionary ();
+    const Bindings::RootObject *aRootObject = 0, *result = 0;
     
     if (refsByRoot) {
         const void **allValues = 0;
@@ -140,15 +141,17 @@ const Bindings::RootObject *KJS::Bindings::rootForInterpreter (KJS::Interpreter
         allValues = (const void **)malloc (sizeof(void *) * count);
         CFDictionaryGetKeysAndValues (refsByRoot, allKeys, allValues);
         for(i = 0; i < count; i++) {
-            const Bindings::RootObject *aRootObject = (const Bindings::RootObject *)allKeys[i];
-            if (aRootObject->interpreter() == interpreter)
-                return aRootObject;
+            aRootObject = (const Bindings::RootObject *)allKeys[i];
+            if (aRootObject->interpreter() == interpreter) {
+                result = aRootObject;
+                break;
+            }
         }
         
         free ((void *)allKeys);
         free ((void *)allValues);
     }
-    return 0;
+    return result;
 }
 
 void KJS::Bindings::addNativeReference (const Bindings::RootObject *root, ObjectImp *imp)
diff --git a/JavaScriptCore/bindings/testbindings.cpp b/JavaScriptCore/bindings/testbindings.cpp
index 5c2764c..ea35bfc 100644
--- a/JavaScriptCore/bindings/testbindings.cpp
+++ b/JavaScriptCore/bindings/testbindings.cpp
@@ -97,8 +97,8 @@ static const NPUTF8 *myMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
 
 static void initializeIdentifiers()
 {
-	NPN_GetIdentifiers (myPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, myPropertyIdentifiers);
-	NPN_GetIdentifiers (myMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, myMethodIdentifiers);
+	NPN_GetStringIdentifiers (myPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, myPropertyIdentifiers);
+	NPN_GetStringIdentifiers (myMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, myMethodIdentifiers);
 };
 
 bool myHasProperty (NPClass *theClass, NPIdentifier name)
@@ -126,19 +126,40 @@ bool myHasMethod (NPClass *theClass, NPIdentifier name)
 
 void logMessage (const NPVariant *message)
 {
-	printf ("%s\n", message->value.stringValue.UTF8Characters);
+    if (message->type == NPVariantStringType) {
+    	char msgBuf[1024];
+    	strncpy (msgBuf, message->value.stringValue.UTF8Characters, message->value.stringValue.UTF8Length);
+    	msgBuf[message->value.stringValue.UTF8Length] = 0;
+        printf ("%s\n", msgBuf);
+    }
+    else if (message->type == NPVariantDoubleType)
+        printf ("%f\n", (float)message->value.doubleValue);
+    else if (message->type == NPVariantInt32Type)
+        printf ("%d\n", message->value.intValue);
+    else if (message->type == NPVariantObjectType)
+        printf ("%p\n", message->value.objectValue);
 }
 
 void setDoubleValue (MyObject *obj, const NPVariant *variant)
 {
-	if (!NPN_VariantToDouble (variant, &obj->doubleValue))
-		NPN_SetExceptionWithUTF8 ((NPObject *)obj, "Attempt to set double value with invalid type.", -1);
+	if (!NPN_VariantToDouble (variant, &obj->doubleValue)) {
+		NPUTF8 *msg = "Attempt to set double value with invalid type.";
+		NPString aString;
+		aString.UTF8Characters = msg;
+		aString.UTF8Length = strlen (msg);
+		NPN_SetException ((NPObject *)obj, &aString);
+	}
 }
 
 void setIntValue (MyObject *obj, const NPVariant *variant)
 {
-	if (!NPN_VariantToInt32 (variant, &obj->intValue))
-		NPN_SetExceptionWithUTF8 ((NPObject *)obj, "Attempt to set int value with invalid type.", -1);
+	if (!NPN_VariantToInt32 (variant, &obj->intValue)) {
+		NPUTF8 *msg = "Attempt to set int value with invalid type.";
+		NPString aString;
+		aString.UTF8Characters = msg;
+		aString.UTF8Length = strlen (msg);
+		NPN_SetException ((NPObject *)obj, &aString);
+	}
 }
 
 void setStringValue (MyObject *obj, const NPVariant *variant)
@@ -149,8 +170,13 @@ void setStringValue (MyObject *obj, const NPVariant *variant)
 
 void setBooleanValue (MyObject *obj, const NPVariant *variant)
 {
-	if (!NPN_VariantToBool (variant, (NPBool *)&obj->boolValue))
-		NPN_SetExceptionWithUTF8 ((NPObject *)obj, "Attempt to set bool value with invalid type.", -1);
+	if (!NPN_VariantToBool (variant, (NPBool *)&obj->boolValue)) {
+		NPUTF8 *msg = "Attempt to set bool value with invalid type.";
+		NPString aString;
+		aString.UTF8Characters = msg;
+		aString.UTF8Length = strlen (msg);
+		NPN_SetException ((NPObject *)obj, &aString);
+	}
 }
 
 void getDoubleValue (MyObject *obj, NPVariant *variant)
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7ad000c..0cb68f6 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,19 @@
+2004-06-23  Richard Williamson   <rjw at apple.com>
+
+	Implemented changes for latest npruntime.h.
+
+        Reviewed by Chris.
+
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart):
+        (KWQKHTMLPart::windowScriptNPObject):
+        (KWQKHTMLPart::getEmbedInstanceForView):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge windowScriptObject]):
+        (-[WebCoreBridge windowScriptNPObject]):
+
 2004-06-22  Richard Williamson   <rjw at apple.com>
 
 	Fixed <rdar://problem/3707162>: accessing embeds[] plug-in interface may crash
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index f3c830b..3a5da0d 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -38,6 +38,8 @@
 
 #include <JavaVM/jni.h>
 #include <JavaScriptCore/jni_jsobject.h>
+#include <JavaScriptCore/npruntime.h>
+#include <JavaScriptCore/NP_jsobject.h>
 #include <JavaScriptCore/runtime.h>
 
 #include "KWQDict.h"
@@ -307,6 +309,7 @@ public:
     KJS::Bindings::RootObject *bindingRootObject();
     
     WebScriptObject *windowScriptObject();
+    NPObject *KWQKHTMLPart::windowScriptNPObject();
     
     void partClearedInBegin();
     
@@ -383,6 +386,7 @@ private:
                                             // bound outside the context of a plugin.
     QPtrList<KJS::Bindings::RootObject> rootObjects;
     WebScriptObject *_windowScriptObject;
+    NPObject *_windowScriptNPObject;
     
     DOM::Node _dragSrc;     // element that may be a drag source, for the current mouse gesture
     bool _dragSrcIsLink;
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 7482959..fad2165 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -186,6 +186,7 @@ KWQKHTMLPart::KWQKHTMLPart()
     , _drawSelectionOnly(false)
     , _bindingRoot(0)
     , _windowScriptObject(0)
+    , _windowScriptNPObject(0)
     , _dragSrc(0)
     , _dragClipboard(0)
     , _elementToDraw(0)
@@ -1176,6 +1177,16 @@ WebScriptObject *KWQKHTMLPart::windowScriptObject()
     return _windowScriptObject;
 }
 
+NPObject *KWQKHTMLPart::windowScriptNPObject()
+{
+    if (!_windowScriptNPObject) {
+        KJS::ObjectImp *win = static_cast<KJS::ObjectImp *>(KJS::Window::retrieveWindow(this));
+        _windowScriptNPObject = _NPN_CreateScriptObject (win, bindingRootObject());
+    }
+
+    return _windowScriptNPObject;
+}
+
 void KWQKHTMLPart::partClearedInBegin()
 {
     [_bridge windowObjectCleared];
@@ -3281,6 +3292,7 @@ KJS::Bindings::Instance *KWQKHTMLPart::getAppletInstanceForView (NSView *aView)
 
 @interface NSObject (WebPlugIn)
 - (id)objectForWebScript;
+- (void *)pluginScriptableObject;
 @end
 
 KJS::Bindings::Instance *KWQKHTMLPart::getEmbedInstanceForView (NSView *aView)
@@ -3290,6 +3302,11 @@ KJS::Bindings::Instance *KWQKHTMLPart::getEmbedInstanceForView (NSView *aView)
         if (object)
             return KJS::Bindings::Instance::createBindingForLanguageInstance (KJS::Bindings::Instance::ObjectiveCLanguage, object);
     }
+    else if ([aView respondsToSelector:@selector(pluginScriptableObject)]){
+        void *object = [aView pluginScriptableObject];
+        if (object)
+            return KJS::Bindings::Instance::createBindingForLanguageInstance (KJS::Bindings::Instance::CLanguage, object);
+    }
     return 0;
 }
 
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 1ab3f45..78b7c3f 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -28,6 +28,7 @@
 
 #import <WebCore/WebCoreKeyboardAccess.h>
 
+#import <JavaScriptCore/npruntime.h>
 #import <JavaVM/jni.h>
 
 #ifdef __cplusplus
@@ -316,6 +317,7 @@ typedef enum {
 - (void)ensureCaretVisible;
 
 - (WebScriptObject *)windowScriptObject;
+- (NPObject *)windowScriptNPObject;
 
 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info;
 - (void)dragExitedWithDraggingInfo:(id <NSDraggingInfo>)info;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index ef272f7..d2248a9 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -52,6 +52,7 @@
 #import "render_style.h"
 #import "render_replaced.h"
 
+#import <JavaScriptCore/npruntime.h>
 #import <JavaScriptCore/jni_jsobject.h>
 #import <JavaScriptCore/object.h>
 #import <JavaScriptCore/runtime_root.h>
@@ -1095,6 +1096,11 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return _part->windowScriptObject();
 }
 
+- (NPObject *)windowScriptNPObject
+{
+    return _part->windowScriptNPObject();
+}
+
 - (DOMDocument *)DOMDocument
 {
     return [DOMDocument _documentWithImpl:_part->xmlDocImpl()];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 438f9d4..ff417fd 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2004-06-23  Richard Williamson   <rjw at apple.com>
+
+		Implemented changes for latest npruntime.h.
+		Made npruntime.h public.
+		
+        Reviewed by Chris.
+
+        * Plugins.subproj/WebBaseNetscapePluginView.h:
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView pluginScriptableObject]):
+        (-[WebBaseNetscapePluginView forceRedraw]):
+        (-[WebBaseNetscapePluginView getVariable:value:]):
+        * Plugins.subproj/WebBaseNetscapePluginViewPrivate.h:
+        * Plugins.subproj/WebNetscapePluginPackage.m:
+        (-[WebNetscapePluginPackage load]):
+        * Plugins.subproj/npapi.h:
+        * Plugins.subproj/npapi.m:
+        (NPN_GetValue):
+        * Plugins.subproj/npfunctions.h:
+        * Plugins.subproj/npruntime.h:
+        * WebKit.pbproj/project.pbxproj:
+
 2004-06-21  Darin Adler  <darin at apple.com>
 
         * English.lproj/StringsNotToBeLocalized.txt: Updated for recent changes.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
index 6adc86c..759dc9e 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
@@ -84,4 +84,7 @@
 - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
 - (void)viewDidMoveToHostWindow;
 
+/* Returns the NPObject that represents the plugin interface. */
+- (void *)pluginScriptableObject;
+
 @end
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 7fee8f4..050e535 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -1264,6 +1264,19 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     //FIXME: Need to send other NPReasons
 }
 
+- (void *)pluginScriptableObject
+{
+    void *value;
+    NPError npErr;
+    
+    npErr = NPP_GetValue (instance, NPPVpluginScriptableNPObject, (void *)&value);
+    if (npErr == NPERR_NO_ERROR)
+        return value;
+
+    return (void *)0;
+}
+
+
 @end
 
 @implementation WebBaseNetscapePluginView (WebNPPCallbacks)
@@ -1627,6 +1640,16 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     [[self window] displayIfNeeded];
 }
 
+- (NPError)getVariable:(NPNVariable)variable value:(void *)value
+{
+    if (variable == NPNVWindowNPObject) {
+        void **v = (void **)value;
+        *v = [[[self webFrame] _bridge] windowScriptNPObject];
+        return NPERR_NO_ERROR;
+    }
+    return NPERR_GENERIC_ERROR;
+}
+
 @end
 
 @implementation WebPluginRequest
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
index c25db2a..bda3550 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
@@ -22,5 +22,5 @@
 - (void)invalidateRect:(NPRect *)invalidRect;
 - (void)invalidateRegion:(NPRegion)invalidateRegion;
 - (void)forceRedraw;
-
+- (NPError)getVariable:(NPNVariable)variable value:(void *)value;
 @end
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index 1672329..9b9ba71 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -448,6 +448,22 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         browserFuncs.getJavaEnv = (NPN_GetJavaEnvProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetJavaEnv);
         browserFuncs.getJavaPeer = (NPN_GetJavaPeerProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetJavaPeer);
 
+        browserFuncs.releasevariantvalue = (NPN_ReleaseVariantValueProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_ReleaseVariantValue);
+        browserFuncs.getstringidentifier = (NPN_GetStringIdentifierProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetStringIdentifier);
+        browserFuncs.getstringidentifiers = (NPN_GetStringIdentifiersProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetStringIdentifiers);
+        browserFuncs.getintidentifier = (NPN_GetIntIdentifierProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetIntIdentifier);
+        browserFuncs.identifierisstring = (NPN_IdentifierIsStringProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_IdentifierIsString);
+        browserFuncs.utf8fromidentifier = (NPN_UTF8FromIdentifierProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_UTF8FromIdentifier);
+        browserFuncs.createobject = (NPN_CreateObjectProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_CreateObject);
+        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.getproperty = (NPN_GetPropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_GetProperty);
+        browserFuncs.setproperty = (NPN_SetPropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_SetProperty);
+        browserFuncs.removeproperty = (NPN_RemovePropertyProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_RemoveProperty);
+        browserFuncs.setexception = (NPN_SetExceptionProcPtr)tVectorForFunctionPointer((FunctionPointer)NPN_SetException);
+
 #if !LOG_DISABLED
         CFAbsoluteTime mainStart = CFAbsoluteTimeGetCurrent();
 #endif
@@ -526,6 +542,22 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
         browserFuncs.getJavaEnv = NPN_GetJavaEnv;
         browserFuncs.getJavaPeer = NPN_GetJavaPeer;
 
+        browserFuncs.releasevariantvalue = NPN_ReleaseVariantValue;
+        browserFuncs.getstringidentifier = NPN_GetStringIdentifier;
+        browserFuncs.getstringidentifiers = NPN_GetStringIdentifiers;
+        browserFuncs.getintidentifier = NPN_GetIntIdentifier;
+        browserFuncs.identifierisstring = NPN_IdentifierIsString;
+        browserFuncs.utf8fromidentifier = NPN_UTF8FromIdentifier;
+        browserFuncs.createobject = NPN_CreateObject;
+        browserFuncs.retainobject = NPN_RetainObject;
+        browserFuncs.releaseobject = NPN_ReleaseObject;
+        browserFuncs.call = NPN_Call;
+        browserFuncs.evalute = NPN_Evaluate;
+        browserFuncs.getproperty = NPN_GetProperty;
+        browserFuncs.setproperty = NPN_SetProperty;
+        browserFuncs.removeproperty = NPN_RemoveProperty;
+        browserFuncs.setexception = NPN_SetException;
+
 #if !LOG_DISABLED
         CFAbsoluteTime initializeStart = CFAbsoluteTimeGetCurrent();
 #endif
diff --git a/WebKit/Plugins.subproj/npapi.h b/WebKit/Plugins.subproj/npapi.h
index 64af9c7..585e2df 100644
--- a/WebKit/Plugins.subproj/npapi.h
+++ b/WebKit/Plugins.subproj/npapi.h
@@ -98,7 +98,10 @@ typedef long int32;
 #define NULL (0L)
 #endif
 
-typedef unsigned char    NPBool;
+#ifndef _NP_RUNTIME_H_
+// Ack!  Temporary hack to get build working.
+typedef unsigned char NPBool;
+#endif
 typedef int16            NPError;
 typedef int16            NPReason;
 typedef char*            NPMIMEType;
@@ -198,13 +201,69 @@ typedef struct
 #endif /* XP_UNIX */
 
 /*
+ *   The following masks are applied on certain platforms to NPNV and 
+ *   NPPV selectors that pass around pointers to COM interfaces. Newer 
+ *   compilers on some platforms may generate vtables that are not 
+ *   compatible with older compilers. To prevent older plugins from 
+ *   not understanding a new browser's ABI, these masks change the 
+ *   values of those selectors on those platforms. To remain backwards
+ *   compatible with differenet versions of the browser, plugins can 
+ *   use these masks to dynamically determine and use the correct C++
+ *   ABI that the browser is expecting. This does not apply to Windows 
+ *   as Microsoft's COM ABI will likely not change.
+ */
+
+#define NP_ABI_GCC3_MASK  0x10000000
+/*
+ *   gcc 3.x generated vtables on UNIX and OSX are incompatible with 
+ *   previous compilers.
+ */
+#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
+#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
+#else
+#define _NP_ABI_MIXIN_FOR_GCC3 0
+#endif
+
+#define NP_ABI_MACHO_MASK 0x01000000
+/*
+ *   On OSX, the Mach-O executable format is significantly
+ *   different than CFM. In addition to having a different
+ *   C++ ABI, it also has has different C calling convention.
+ *   You must use glue code when calling between CFM and
+ *   Mach-O C functions. 
+ */
+#if (defined(TARGET_RT_MAC_MACHO))
+#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
+#else
+#define _NP_ABI_MIXIN_FOR_MACHO 0
+#endif
+
+
+#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
+
+/*
  * List of variable names for which NPP_GetValue shall be implemented
  */
 typedef enum {
     NPPVpluginNameString = 1,
     NPPVpluginDescriptionString,
     NPPVpluginWindowBool,
-    NPPVpluginTransparentBool
+    NPPVpluginTransparentBool,
+
+    NPPVjavaClass,                /* Not implemented in WebKit */
+    NPPVpluginWindowSize,         /* Not implemented in WebKit */
+    NPPVpluginTimerInterval,      /* Not implemented in WebKit */
+
+    NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
+    NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
+
+    /* 12 and over are available on Mozilla builds starting with 0.9.9 */
+    NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
+    NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
+    NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
+
+    /* Get the NPObject for scripting the plugin. */
+    NPPVpluginScriptableNPObject
 } NPPVariable;
 
 /*
@@ -216,7 +275,20 @@ typedef enum {
     NPNVnetscapeWindow,
     NPNVjavascriptEnabledBool,
     NPNVasdEnabledBool,
-    NPNVisOfflineBool
+    NPNVisOfflineBool,
+
+    /* 10 and over are available on Mozilla builds starting with 0.9.4 */
+    NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
+    NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
+    NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
+    NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
+    NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
+
+    /* Get the NPObject wrapper for the browser window. */
+    NPNVWindowNPObject,
+
+    /* Get the NPObject wrapper for the plugins DOM element. */
+    NPNVPluginElementNPObject                 /* Not implemented in WebKit */
 } NPNVariable;
 
 /*
@@ -430,9 +502,9 @@ int16            NPP_HandleEvent(NPP instance, void* event);
 void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
                                       NPReason reason, void* notifyData);
 jref        NP_LOADDS            NPP_GetJavaClass(void);
-NPError     NPP_GetValue(void *instance, NPPVariable variable,
+NPError     NPP_GetValue(NPP instance, NPPVariable variable,
                                      void *value);
-NPError     NPP_SetValue(void *instance, NPNVariable variable,
+NPError     NPP_SetValue(NPP instance, NPNVariable variable,
                                      void *value);
 
 /*
diff --git a/WebKit/Plugins.subproj/npapi.m b/WebKit/Plugins.subproj/npapi.m
index 55900bb..ab880be 100644
--- a/WebKit/Plugins.subproj/npapi.m
+++ b/WebKit/Plugins.subproj/npapi.m
@@ -115,16 +115,12 @@ void NPN_ForceRedraw(NPP instance)
     [pluginViewForInstance(instance) forceRedraw];
 }
 
-// Unsupported functions
-
-// According to the plug-in API documentation,
-// NPN_GetValue and NPN_SetValue are not used in Mac OS.
 NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
 {
-    LOG(Plugins, "NPN_GetValue");
-    return NPERR_GENERIC_ERROR;
+    return [pluginViewForInstance(instance) getVariable:variable value:value];
 }
 
+// Unsupported functions
 NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 {
     LOG(Plugins, "NPN_SetValue");
diff --git a/WebKit/Plugins.subproj/npfunctions.h b/WebKit/Plugins.subproj/npfunctions.h
index 6c40244..9e5adf4 100644
--- a/WebKit/Plugins.subproj/npfunctions.h
+++ b/WebKit/Plugins.subproj/npfunctions.h
@@ -1,7 +1,8 @@
 #ifndef _NPFUNCTIONS_H_
 #define _NPFUNCTIONS_H_
 
-#include "npapi.h"
+#include <WebKit/npruntime.h>
+#include <WebKit/npapi.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -29,6 +30,24 @@ typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* URL, const char*
 typedef void* (*NPN_GetJavaEnvProcPtr)(void);
 typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
 
+typedef void (*NPN_ReleaseVariantValueProcPtr) (NPVariant *variant);
+
+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 NPBool (*NPN_IdentifierIsStringProcPtr) (NPIdentifier identifier);
+typedef NPUTF8 *(*NPN_UTF8FromIdentifierProcPtr) (NPIdentifier identifier);
+
+typedef NPObject* (*NPN_CreateObjectProcPtr) (NPClass *aClass);
+typedef NPObject* (*NPN_RetainObjectProcPtr) (NPObject *obj);
+typedef void (*NPN_ReleaseObjectProcPtr) (NPObject *obj);
+typedef NPBool (*NPN_CallProcPtr) (NPObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPVariant *result);
+typedef NPBool (*NPN_EvaluateProcPtr) (NPObject *obj, NPString *script, NPVariant *result);
+typedef NPBool (*NPN_GetPropertyProcPtr) (NPObject *obj, NPIdentifier  propertyName, NPVariant *result);
+typedef NPBool (*NPN_SetPropertyProcPtr) (NPObject *obj, NPIdentifier  propertyName, const NPVariant *value);
+typedef NPBool (*NPN_RemovePropertyProcPtr) (NPObject *obj, NPIdentifier propertyName);
+typedef void (*NPN_SetExceptionProcPtr) (NPObject *obj, NPString *message);
+
 typedef NPError	(*NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
 typedef NPError	(*NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
 typedef NPError	(*NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
@@ -36,7 +55,7 @@ typedef NPError	(*NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream*
 typedef NPError	(*NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
 typedef void 	(*NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
 typedef int32 (*NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
-typedef int32 (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+typedef int32 (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
 typedef void (*NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
 typedef int16 (*NPP_HandleEventProcPtr)(NPP instance, void* event);
 typedef void (*NPP_URLNotifyProcPtr)(NPP instance, const char* URL, NPReason reason, void* notifyData);
@@ -47,9 +66,6 @@ typedef void (*NPP_ShutdownProcPtr)(void);
 typedef void *(*NPP_GetJavaClassProcPtr)(void);
 typedef void*	JRIGlobalRef; //not using this right now
 
-typedef void *(*NPN_GenericFunction)(void);
-typedef NPN_GenericFunction (*NPN_GetFunctionProcPtr)(const char *functionName);
-
 typedef struct _NPNetscapeFuncs {
     uint16 size;
     uint16 version;
@@ -76,9 +92,21 @@ typedef struct _NPNetscapeFuncs {
     NPN_InvalidateRegionProcPtr invalidateregion;
     NPN_ForceRedrawProcPtr forceredraw;
     
-    // Version 12+
-    NPN_GetFunctionProcPtr getFunction;
-    
+    NPN_ReleaseVariantValueProcPtr releasevariantvalue;
+    NPN_GetStringIdentifierProcPtr getstringidentifier;
+    NPN_GetStringIdentifiersProcPtr getstringidentifiers;
+    NPN_GetIntIdentifierProcPtr getintidentifier;
+    NPN_IdentifierIsStringProcPtr identifierisstring;
+    NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
+    NPN_CreateObjectProcPtr createobject;
+    NPN_RetainObjectProcPtr retainobject;
+    NPN_ReleaseObjectProcPtr releaseobject;
+    NPN_CallProcPtr call;
+    NPN_EvaluateProcPtr evalute;
+    NPN_GetPropertyProcPtr getproperty;
+    NPN_SetPropertyProcPtr setproperty;
+    NPN_RemovePropertyProcPtr removeproperty;
+    NPN_SetExceptionProcPtr setexception;
 } NPNetscapeFuncs;
 
 typedef struct _NPPluginFuncs {
diff --git a/WebKit/Plugins.subproj/npruntime.h b/WebKit/Plugins.subproj/npruntime.h
index 8fa2beb..9cc7a08 100644
--- a/WebKit/Plugins.subproj/npruntime.h
+++ b/WebKit/Plugins.subproj/npruntime.h
@@ -48,19 +48,6 @@ extern "C" {
     to support the extended Netscape script-ability API for plugins (NP-SAP).
     NP-SAP is an extension of the Netscape plugin API.  As such we have adopted the
     use of the "NP" prefix for this API.  
-    
-    The following NP-SAP entry points were added to the Netscape plugin API (in npsap.h):
-
-    NPObject *NPP_GetNativeObjectForScript (NPP instance);
-    NPScriptObject *NPN_GetWindowScriptObject (NPP instance);
-    NPScriptObject *NPN_GetInstanceScriptObject (NPP instance);
-
-    These functions are used to establish the initial binding between the user agent
-    and native code.  The DOM objects in the user agent can be examined and manipulated using
-    the NPN_ functions that operate on a NPScriptObject described in this header.
-    
-    To the extent possible the assumptions about the scripting language used by
-    the scripting environment have been minimized.
 */
 
 
@@ -71,11 +58,6 @@ extern "C" {
 typedef struct NPObject NPObject;
 typedef struct NPClass NPClass;
 
-/*
-    A NPScriptObject wraps a script Object in an NPObject.
-*/
-typedef NPObject NPScriptObject;
-
 typedef char NPUTF8;
 typedef struct _NPString {
     const NPUTF8 *UTF8Characters;
@@ -177,7 +159,7 @@ void NPN_InitializeVariantWithVariant (NPVariant *destination, const NPVariant *
 	String                      NPVariant (with type NPVariantStringType)
 	Undefined                   NPVariant (with type NPVariantUndefinedType)
 	Null                        NPVariant (with type NPVariantNullType)
-	Object (including Array)    NPVariant (with type NPVariantObjectType, objectValue will be a NPScriptObject)
+	Object (including Array)    NPVariant (with type NPVariantObjectType, objectValue will be a NPObject)
 	Object (NPObject wrapper)   NPVariant (with type NPVariantObjectType)
 
 
@@ -189,28 +171,26 @@ void NPN_InitializeVariantWithVariant (NPVariant *destination, const NPVariant *
 	NPVariant (with type NPVariantUndefinedType)          Undefined
 	NPVariant (with type NPVariantNullType)               Null
 	NPArray                                               Array (restricted)
-	NPScriptObject                                        Object
-	other NPObject                                        Object (NPObject wrapper)
+	NObject                                               Object or (NPObject wrapper)
 
 */
 
-typedef const void *NPIdentifier;
+typedef void *NPIdentifier;
 
 /*
-    NPObjects have methods and properties.  Methods and properties are named with NPIdentifiers.
-    These identifiers may be reflected in script.  NPIdentifiers can be compared using ==.
-    
-    NPN_IsValidIdentifier will return true if an identifier for the name has already been
-    assigned with either NPIdentifierFromUTF8() or NPN_GetIdentifiers();
-*/
-NPIdentifier NPN_GetIdentifier (const NPUTF8 *name);
-void NPN_GetIdentifiers (const NPUTF8 **names, int nameCount, NPIdentifier *identifiers);
-
-/*
-    The NPUTF8 returned from NPN_UTF8FromIdentifier should be freed.
+    NPObjects have methods and properties.  Methods and properties are
+    identified with NPIdentifiers.  These identifiers may be reflected
+    in script.  NPIdentifiers can be either strings or integers, IOW,
+    methods and properties can be identified by either strings or
+    integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
+    compared using ==.  In case of any errors, the requested
+    NPIdentifier(s) will be NULL.
 */
+NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
+void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers);
+NPIdentifier NPN_GetIntIdentifier(int32_t intid);
+NPBool NPN_IdentifierIsString(NPIdentifier identifier);
 NPUTF8 *NPN_UTF8FromIdentifier (NPIdentifier identifier);
-void NPN_ReleaseUTF8 (NPUTF8 *string);
 
 /*
     NPObject behavior is implemented using the following set of callback functions.
@@ -238,11 +218,11 @@ typedef NPBool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, con
     exist.
     
     NPInvalidateFunctionPtr is called by the scripting environment when the native code is
-    shutdown.  Any attempt to message a NPScriptObject instance after the invalidate
+    shutdown.  Any attempt to message a NPObject instance after the invalidate
     callback has been called will result in undefined behavior, even if the
-    native code is still retaining those NPScriptObject instances.
+    native code is still retaining those NPObject instances.
     (The runtime will typically return immediately, with 0 or NULL, from an attempt to
-    dispatch to a NPScriptObject, but this behavior should not be depended upon.)
+    dispatch to a NPObject, but this behavior should not be depended upon.)
 */
 struct NPClass
 {
@@ -287,15 +267,7 @@ NPObject *NPN_RetainObject (NPObject *obj);
 void NPN_ReleaseObject (NPObject *obj);
 
 /*
-    Built-in data types.  These classes can be passed to NPN_IsKindOfClass().
-*/
-extern NPClass *NPArrayClass;
-extern NPClass *NPScriptObjectClass;
-
-typedef NPObject NPArray;
-
-/*
-    Functions to access script objects represented by NPScriptObject.
+    Functions to access script objects represented by NPObject.
     
     Calls to script objects are asynchronous.  If a function returns a value, it
     will be supplied via the NPScriptResultFunctionPtr callback.
@@ -305,51 +277,16 @@ typedef NPObject NPArray;
     Calls made from script to the plugin will always be made on the main
     user agent thread, this include calls to NPScriptResultFunctionPtr callbacks.
 */
-typedef void (*NPScriptResultFunctionPtr)(const NPVariant *result, void *resultContext);
-
-void NPN_Call (NPScriptObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPScriptResultFunctionPtr resultCallback);
-void NPN_Evaluate (NPScriptObject *obj, NPString *script, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_GetProperty (NPScriptObject *obj, NPIdentifier  propertyName, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_SetProperty (NPScriptObject *obj, NPIdentifier  propertyName, const NPVariant *value);
-void NPN_RemoveProperty (NPScriptObject *obj, NPIdentifier propertyName);
-void NPN_ToString (NPScriptObject *obj, NPScriptResultFunctionPtr result, void *resultContext);
-void NPN_GetPropertyAtIndex (NPScriptObject *obj, int32_t index, NPScriptResultFunctionPtr resultCallback, void *resultContext);
-void NPN_SetPropertyAtIndex (NPScriptObject *obj, unsigned index, const NPVariant *value);
-
-/*
-    NPArrays are immutable.  They are used to pass arguments to 
-    the script functions that expect arrays, or to export 
-    arrays of properties.  NPArray is represented in JavaScript
-    by a restricted Array.  The Array in JavaScript is read-only,
-    only has index accessors, and may not be resized.
-    
-    Objects added to arrays are retained by the array.
-*/
-NPArray *NPN_CreateArray (NPVariant **, int32_t count);
-NPArray *NPN_CreateArrayV (int32_t count, ...);
-
-#if 0
-/*
-    Objects returned by NPN_ObjectAtIndex pass a reference count
-    to the caller.  The caller must release the object.
-*/
-const NPVariant *NPN_ObjectAtIndex (NPArray *array, int32_t index);
-#endif
-
-/*
-    Returns true if the object is a kind of class as specified by
-    aClass.
-*/
-bool NPN_IsKindOfClass (const NPObject *obj, const NPClass *aClass);
+NPBool NPN_Call (NPObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPVariant *result);
+NPBool NPN_Evaluate (NPObject *obj, NPString *script, NPVariant *result);
+NPBool NPN_GetProperty (NPObject *obj, NPIdentifier  propertyName, NPVariant *result);
+NPBool NPN_SetProperty (NPObject *obj, NPIdentifier  propertyName, const NPVariant *value);
+NPBool NPN_RemoveProperty (NPObject *obj, NPIdentifier propertyName);
 
 /*
     NPN_SetException may be called to trigger a script exception upon return
     from entry points into NPObjects.
-        
-    NPN_SetExceptionWithUTF8() takes an UTF8 string and a length.  -1 may be passed for
-    the length if the string is null terminated.
 */
-void NPN_SetExceptionWithUTF8 (NPObject *obj, const NPUTF8 *message, int32_t length);
 void NPN_SetException (NPObject *obj, NPString *message);
 
 #ifdef __cplusplus
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 5e2b530..7e68db3 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -1549,7 +1549,7 @@
 			isa = PBXBuildFile;
 			settings = {
 				ATTRIBUTES = (
-					Private,
+					Public,
 				);
 			};
 		};

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list