[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:41:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 203f5722e76bc6687b9e53d207d3e814ec48f915
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon May 24 22:19:02 2004 +0000

    	Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
    	fixed ClassInfo to correctly reflect inheritance.  This is required
    	because of the runtime checks in JSC for arrays, i.e. in
    	the Function objects apply method.
    
            Reviewed by Ken.
    
            * bindings/jni/jni_runtime.cpp:
            (JavaArray::convertJObjectToArray):
            * bindings/objc/objc_utility.mm:
            (KJS::Bindings::convertObjcValueToValue):
            * bindings/runtime_array.cpp:
            (RuntimeArrayImp::RuntimeArrayImp):
            * bindings/runtime_array.h:
            * bindings/testM.js: Added.
            * bindings/testbindings.mm:
            (+[MyFirstInterface webScriptNameForSelector:]):
            (-[MyFirstInterface logMessages:]):
            (-[MyFirstInterface logMessage:prefix:]):
            (-[MyFirstInterface callJSObject::]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6677 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 0c99f6a..4646bcd 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,26 @@
+2004-05-24  Richard Williamson   <rjw at apple.com>
+
+	Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
+	fixed ClassInfo to correctly reflect inheritance.  This is required
+	because of the runtime checks in JSC for arrays, i.e. in
+	the Function objects apply method.
+
+        Reviewed by Ken.
+
+        * bindings/jni/jni_runtime.cpp:
+        (JavaArray::convertJObjectToArray):
+        * bindings/objc/objc_utility.mm:
+        (KJS::Bindings::convertObjcValueToValue):
+        * bindings/runtime_array.cpp:
+        (RuntimeArrayImp::RuntimeArrayImp):
+        * bindings/runtime_array.h:
+        * bindings/testM.js: Added.
+        * bindings/testbindings.mm:
+        (+[MyFirstInterface webScriptNameForSelector:]):
+        (-[MyFirstInterface logMessages:]):
+        (-[MyFirstInterface logMessage:prefix:]):
+        (-[MyFirstInterface callJSObject::]):
+
 2004-05-22  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/JavaScriptCore/bindings/jni/jni_runtime.cpp b/JavaScriptCore/bindings/jni/jni_runtime.cpp
index 99574b5..bb4dd25 100644
--- a/JavaScriptCore/bindings/jni/jni_runtime.cpp
+++ b/JavaScriptCore/bindings/jni/jni_runtime.cpp
@@ -62,7 +62,7 @@ KJS::Value JavaArray::convertJObjectToArray (KJS::ExecState *exec, jobject anObj
     if (type[0] != '[')
         return Undefined();
 
-    return KJS::Object(new RuntimeArrayImp(new JavaArray ((jobject)anObject, type)));
+    return KJS::Object(new RuntimeArrayImp(exec, new JavaArray ((jobject)anObject, type)));
 }
 
 KJS::Value JavaField::valueFromInstance(KJS::ExecState *exec, const Instance *i) const 
diff --git a/JavaScriptCore/bindings/objc/objc_utility.mm b/JavaScriptCore/bindings/objc/objc_utility.mm
index f18acb3..9ca994b 100644
--- a/JavaScriptCore/bindings/objc/objc_utility.mm
+++ b/JavaScriptCore/bindings/objc/objc_utility.mm
@@ -198,7 +198,7 @@ Value KJS::Bindings::convertObjcValueToValue (KJS::ExecState *exec, void *buffer
                     aValue = Number([*obj doubleValue]);
                 }
                 else if ([*obj isKindOfClass:[NSArray class]]) {
-                    aValue = Object(new RuntimeArrayImp(new ObjcArray (*obj)));
+                    aValue = Object(new RuntimeArrayImp(exec, new ObjcArray (*obj)));
                 }
                 else if ([*obj isKindOfClass:[WebScriptObject class]]) {
                     WebScriptObject *jsobject = (WebScriptObject *)*obj;
diff --git a/JavaScriptCore/bindings/runtime_array.cpp b/JavaScriptCore/bindings/runtime_array.cpp
index fa4e509..1ff4ec1 100644
--- a/JavaScriptCore/bindings/runtime_array.cpp
+++ b/JavaScriptCore/bindings/runtime_array.cpp
@@ -29,9 +29,9 @@
 
 using namespace KJS;
 
-const ClassInfo RuntimeArrayImp::info = {"RuntimeArray", 0, 0, 0};
+const ClassInfo RuntimeArrayImp::info = {"RuntimeArray", &ArrayInstanceImp::info, 0, 0};
 
-RuntimeArrayImp::RuntimeArrayImp(Bindings::Array *a)
+RuntimeArrayImp::RuntimeArrayImp(ExecState *exec, Bindings::Array *a) : ArrayInstanceImp (exec->lexicalInterpreter()->builtinArrayPrototype().imp(), a->getLength())
 {
     // Always takes ownership of concrete array.
     _array = a;
diff --git a/JavaScriptCore/bindings/runtime_array.h b/JavaScriptCore/bindings/runtime_array.h
index 2792a64..e05ee21 100644
--- a/JavaScriptCore/bindings/runtime_array.h
+++ b/JavaScriptCore/bindings/runtime_array.h
@@ -25,15 +25,16 @@
 #ifndef _RUNTIME_ARRAY_H_
 #define _RUNTIME_ARRAY_H_
 
+#include <array_instance.h>
 #include <object.h>
 #include <runtime.h>
 
 
 namespace KJS {
     
-class RuntimeArrayImp : public ObjectImp {
+class RuntimeArrayImp : public ArrayInstanceImp {
 public:
-    RuntimeArrayImp(Bindings::Array *i);
+    RuntimeArrayImp(ExecState *exec, Bindings::Array *i);
     ~RuntimeArrayImp();
     
     virtual Value get(ExecState *exec, const Identifier &propertyName) const;
diff --git a/JavaScriptCore/bindings/test.js b/JavaScriptCore/bindings/testM.js
similarity index 59%
copy from JavaScriptCore/bindings/test.js
copy to JavaScriptCore/bindings/testM.js
index 5d4f79f..6d17563 100644
--- a/JavaScriptCore/bindings/test.js
+++ b/JavaScriptCore/bindings/testM.js
@@ -1,12 +1,16 @@
 myInterface.logMessage ("Starting test");
 
 myInterface.logMessage ("Testing properties:");
-myInterface.logMessage ("myInterface.doubleValue = " + myInterface.doubleValue);
-myInterface.logMessage ("myInterface.intValue = " + myInterface.intValue);
-myInterface.logMessage ("myInterface.stringValue = " + myInterface.stringValue);
-myInterface.logMessage ("myInterface.booleanValue = " + myInterface.booleanValue);
-myInterface.logMessage ("myInterface.nullValue = " + myInterface.nullValue);
-myInterface.logMessage ("myInterface.undefinedValue = " + myInterface.undefinedValue);
+
+myInterface.jsobject = new Function ("arg1","arg2","return arg1 + arg2;");
+myInterface.logMessage ("myInterface.jsobject =" + myInterface.jsobject);
+
+var functionBody = 'return arg1*arg2;'
+
+myInterface.setJSObject_(new Function ("arg1","arg2",functionBody));
+myInterface.logMessage ("myInterface.jsobject =" + myInterface.jsobject);
+myInterface.callJSObject__(5,6);
+myInterface.callJSObject__(8,9);
 
 myInterface.logMessage ("myInterface.setInt_(666) = " + myInterface.setInt_(666));
 myInterface.logMessage ("myInterface.getInt() = " + myInterface.getInt());
@@ -17,3 +21,9 @@ myInterface.myInt = 777;
 myInterface.logMessage ("myInterface.myInt = " + myInterface.myInt);
 myInterface.logMessage ("myInterface.getMySecondInterface().doubleValue = " + myInterface.getMySecondInterface().doubleValue);
 myInterface.logMessage ("myInterface.getMySecondInterface() = " + myInterface.getMySecondInterface());
+
+myInterface.logMessageWithPrefix ("msg", "prefix");
+
+var strings = [ "one", "two", "three" ];
+
+myInterface.logMessages (strings);
\ No newline at end of file
diff --git a/JavaScriptCore/bindings/testbindings.mm b/JavaScriptCore/bindings/testbindings.mm
index d3b090c..b6d8ed1 100644
--- a/JavaScriptCore/bindings/testbindings.mm
+++ b/JavaScriptCore/bindings/testbindings.mm
@@ -75,6 +75,17 @@
 
 @implementation MyFirstInterface
 
++ (NSString *)webScriptNameForSelector:(SEL)aSelector
+{
+    if (aSelector == @selector(logMessage:))
+        return @"logMessage";
+    if (aSelector == @selector(logMessages:))
+        return @"logMessages";
+    if (aSelector == @selector(logMessage:prefix:))
+        return @"logMessageWithPrefix";
+    return nil;
+}
+
 - init
 {
     LOG ("\n");
@@ -89,13 +100,6 @@
     [super dealloc];
 }
 
-+ (NSString *)webScriptNameForSelector:(SEL)aSelector
-{
-    if (aSelector == @selector(logMessage:))
-        return @"logMessage";
-    return nil;
-}
-
 - (int)getInt 
 {
     LOG ("myInt = %d\n", myInt);
@@ -124,6 +128,18 @@
     printf ("%s\n", [message lossyCString]);
 }
 
+- (void)logMessages:(id)messages
+{
+    int i, count = [[messages valueForKey:@"length"] intValue];
+    for (i = 0; i < count; i++)
+        printf ("%s\n", [[messages webScriptValueAtIndex:i] lossyCString]);
+}
+
+- (void)logMessage:(NSString *)message prefix:(NSString *)prefix
+{
+    printf ("%s:%s\n", [prefix lossyCString], [message lossyCString]);
+}
+
 - (void)setJSObject:(id)jso
 {
     [jsobject autorelease];
@@ -132,8 +148,10 @@
 
 - (void)callJSObject:(int)arg1 :(int)arg2
 {
-    id foo = [jsobject callWebScriptMethod:@"call" withArguments:[NSArray arrayWithObjects:jsobject, [NSNumber numberWithInt:arg1], [NSNumber numberWithInt:arg2], nil]];
-    printf ("foo = %s\n", [[foo description] lossyCString] );
+    id foo1 = [jsobject callWebScriptMethod:@"call" withArguments:[NSArray arrayWithObjects:jsobject, [NSNumber numberWithInt:arg1], [NSNumber numberWithInt:arg2], nil]];
+    printf ("foo (via call) = %s\n", [[foo1 description] lossyCString] );
+    id foo2 = [jsobject callWebScriptMethod:@"apply" withArguments:[NSArray arrayWithObjects:jsobject, [NSArray arrayWithObjects:[NSNumber numberWithInt:arg1], [NSNumber numberWithInt:arg2], nil], nil]];
+    printf ("foo (via apply) = %s\n", [[foo2 description] lossyCString] );
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list