[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:29:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 044d81c06cfae658cd495fd4c0f44089d552aa47
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 10 22:25:33 2004 +0000

    	Made changes to support new asychronous approach to calls from
    	plugin to JavaScript
    
            Reviewed by Chris.
    
            * bindings/NP_jsobject.cpp:
            (NP_Call):
            (NP_Evaluate):
            (NP_GetProperty):
            (NP_ToString):
            (NP_GetPropertyAtIndex):
            * bindings/NP_runtime.h:
            * bindings/make_testbindings:
            * bindings/runtime.cpp:
            (Instance::createBindingForLanguageInstance):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1209a52..bd360d4 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,23 @@
 2004-03-10  Richard Williamson   <rjw at apple.com>
 
+	Made changes to support new asychronous approach to calls from
+	plugin to JavaScript
+
+        Reviewed by Chris.
+
+        * bindings/NP_jsobject.cpp:
+        (NP_Call):
+        (NP_Evaluate):
+        (NP_GetProperty):
+        (NP_ToString):
+        (NP_GetPropertyAtIndex):
+        * bindings/NP_runtime.h:
+        * bindings/make_testbindings:
+        * bindings/runtime.cpp:
+        (Instance::createBindingForLanguageInstance):
+
+2004-03-10  Richard Williamson   <rjw at apple.com>
+
 	Updated header to include proposed changes from
 	plugin-futures list.  Calls from plugin to JavaScript
 	are now asynchronous.
diff --git a/JavaScriptCore/bindings/NP_jsobject.cpp b/JavaScriptCore/bindings/NP_jsobject.cpp
index abcbbb2..81a1072 100644
--- a/JavaScriptCore/bindings/NP_jsobject.cpp
+++ b/JavaScriptCore/bindings/NP_jsobject.cpp
@@ -106,7 +106,7 @@ Identifier identiferFromNPIdentifier(NP_Identifier ident)
     return identifier;
 }
 
-NP_Object *NP_Call (NP_JavaScriptObject *o, NP_Identifier ident, NP_Object **args, unsigned argCount)
+void NP_Call (NP_JavaScriptObject *o, NP_Identifier ident, NP_Object **args, unsigned argCount, NP_JavaScriptResultInterface resultCallback)
 {
     JavaScriptObject *obj = (JavaScriptObject *)o; 
 
@@ -116,9 +116,13 @@ NP_Object *NP_Call (NP_JavaScriptObject *o, NP_Identifier ident, NP_Object **arg
     
     Value func = obj->imp->get (exec, identiferFromNPIdentifier(ident));
     Interpreter::unlock();
-    if (func.isNull() || func.type() == UndefinedType) {
-        // Maybe throw an exception here?
-        return 0;
+    if (func.isNull()) {
+        resultCallback (NP_GetNull());
+        return;
+    }
+    else if ( func.type() == UndefinedType) {
+        resultCallback (NP_GetUndefined());
+        return;
     }
 
     // Call the function object.
@@ -130,10 +134,12 @@ NP_Object *NP_Call (NP_JavaScriptObject *o, NP_Identifier ident, NP_Object **arg
     Interpreter::unlock();
 
     // Convert and return the result of the function call.
-    return convertValueToNPValueType(exec, result);
+    NP_Object *npresult = convertValueToNPValueType(exec, result);
+
+    resultCallback (npresult);
 }
 
-NP_Object *NP_Evaluate (NP_JavaScriptObject *o, NP_String *s)
+void NP_Evaluate (NP_JavaScriptObject *o, NP_String *s, NP_JavaScriptResultInterface resultCallback)
 {
     JavaScriptObject *obj = (JavaScriptObject *)o; 
 
@@ -145,10 +151,13 @@ NP_Object *NP_Evaluate (NP_JavaScriptObject *o, NP_String *s)
     KJS::Value result = obj->root->interpreter()->evaluate(UString((const UChar *)script,length)).value();
     Interpreter::unlock();
     free (script);
-    return convertValueToNPValueType(exec, result);
+    
+    NP_Object *npresult = convertValueToNPValueType(exec, result);
+
+    resultCallback (npresult);
 }
 
-NP_Object *NP_GetProperty (NP_JavaScriptObject *o, NP_Identifier propertyName)
+void NP_GetProperty (NP_JavaScriptObject *o, NP_Identifier propertyName, NP_JavaScriptResultInterface resultCallback)
 {
     JavaScriptObject *obj = (JavaScriptObject *)o; 
 
@@ -156,7 +165,10 @@ NP_Object *NP_GetProperty (NP_JavaScriptObject *o, NP_Identifier propertyName)
     Interpreter::lock();
     Value result = obj->imp->get (exec, identiferFromNPIdentifier(propertyName));
     Interpreter::unlock();
-    return convertValueToNPValueType(exec, result);
+    
+    NP_Object *npresult = convertValueToNPValueType(exec, result);
+    
+    resultCallback (npresult);
 }
 
 void NP_SetProperty (NP_JavaScriptObject *o, NP_Identifier propertyName, NP_Object *value)
@@ -179,7 +191,7 @@ void NP_RemoveProperty (NP_JavaScriptObject *o, NP_Identifier propertyName)
     Interpreter::unlock();
 }
 
-NP_String *NP_ToString (NP_JavaScriptObject *o)
+void NP_ToString (NP_JavaScriptObject *o, NP_JavaScriptResultInterface resultCallback)
 {
     JavaScriptObject *obj = (JavaScriptObject *)o; 
     
@@ -191,10 +203,10 @@ NP_String *NP_ToString (NP_JavaScriptObject *o)
 
     Interpreter::unlock();
     
-    return value;
+    resultCallback (value);
 }
 
-NP_Object *NP_GetPropertyAtIndex (NP_JavaScriptObject *o, int32_t index)
+void NP_GetPropertyAtIndex (NP_JavaScriptObject *o, int32_t index, NP_JavaScriptResultInterface resultCallback)
 {
     JavaScriptObject *obj = (JavaScriptObject *)o; 
 
@@ -203,7 +215,9 @@ NP_Object *NP_GetPropertyAtIndex (NP_JavaScriptObject *o, int32_t index)
     Value result = obj->imp->get (exec, (unsigned)index);
     Interpreter::unlock();
 
-    return convertValueToNPValueType(exec, result);
+    NP_Object *npresult = convertValueToNPValueType(exec, result);
+    
+    resultCallback (npresult);
 }
 
 void NP_SetPropertyAtIndex (NP_JavaScriptObject *o, unsigned index, NP_Object value)
diff --git a/JavaScriptCore/bindings/make_testbindings b/JavaScriptCore/bindings/make_testbindings
index 6a7a361..228862b 100755
--- a/JavaScriptCore/bindings/make_testbindings
+++ b/JavaScriptCore/bindings/make_testbindings
@@ -1 +1,2 @@
 cc -g -o testbindings testbindings.mm -I../kjs -F$SYMROOTS -framework JavaScriptCore -framework Foundation -lstdc++
+cc -g -o testbindings testbindings.cpp -I../kjs -F$SYMROOTS -framework JavaScriptCore -framework Foundation -lstdc++
diff --git a/JavaScriptCore/bindings/npruntime.h b/JavaScriptCore/bindings/npruntime.h
index f613476..2e8a499 100644
--- a/JavaScriptCore/bindings/npruntime.h
+++ b/JavaScriptCore/bindings/npruntime.h
@@ -209,11 +209,11 @@ typedef void (*NP_JavaScriptResultInterface)(NP_Object *obj);
 
 void NP_Call (NP_JavaScriptObject *obj, NP_Identifier methodName, NP_Object **args, unsigned argCount, NP_JavaScriptResultInterface result);
 void NP_Evaluate (NP_JavaScriptObject *obj, NP_String *script, NP_JavaScriptResultInterface result);
-void NP_GetProperty (NP_JavaScriptObject *obj, NP_Identifier  propertyName, NP_JavaScriptResultInterface);
+void NP_GetProperty (NP_JavaScriptObject *obj, NP_Identifier  propertyName, NP_JavaScriptResultInterface result);
 void NP_SetProperty (NP_JavaScriptObject *obj, NP_Identifier  propertyName, NP_Object *value);
 void NP_RemoveProperty (NP_JavaScriptObject *obj, NP_Identifier propertyName);
-void NP_ToString (NP_JavaScriptObject *obj, NP_JavaScriptResultInterface);
-void NP_GetPropertyAtIndex (NP_JavaScriptObject *obj, int32_t index, NP_JavaScriptResultInterface);
+void NP_ToString (NP_JavaScriptObject *obj, NP_JavaScriptResultInterface result);
+void NP_GetPropertyAtIndex (NP_JavaScriptObject *obj, int32_t index, NP_JavaScriptResultInterface result);
 void NP_SetPropertyAtIndex (NP_JavaScriptObject *obj, unsigned index, NP_Object *value);
 
 /*
diff --git a/JavaScriptCore/bindings/runtime.cpp b/JavaScriptCore/bindings/runtime.cpp
index 0b48ade..966bddf 100644
--- a/JavaScriptCore/bindings/runtime.cpp
+++ b/JavaScriptCore/bindings/runtime.cpp
@@ -96,6 +96,8 @@ Instance *Instance::createBindingForLanguageInstance (BindingLanguage language,
         return new Bindings::JavaInstance ((jobject)instance);
     if (language == Instance::ObjectiveCLanguage)
         return new Bindings::ObjcInstance ((struct objc_object *)instance);
+    if (language == Instance::CLanguage)
+        return new Bindings::ObjcInstance ((struct objc_object *)instance);
     return 0;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list