CodeGeneratorJS doesn't generate header includes for sequence<type>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 20:37:10 +0000 (20:37 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 20:37:10 +0000 (20:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121314

Reviewed by Dean Jackson.

* bindings/scripts/CodeGeneratorJS.pm:
(SkipIncludeHeader): Don't return false for sequence and array types.
(AddIncludesForType): Do add includes for sequence and array types.
(GenerateCallbackImplementation):
* bindings/scripts/test/JS/JSTestTypedefs.cpp: Regenerated
* bindings/scripts/test/JS/JSTestTypedefs.h: Ditto.
* bindings/scripts/test/TestTypedefs.idl: Add a method that takes a sequence<TestEventTarget>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155718 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h
Source/WebCore/bindings/scripts/test/TestTypedefs.idl

index 2527866..7041d47 100644 (file)
@@ -1,3 +1,18 @@
+2013-09-13  Eric Carlson  <eric.carlson@apple.com>
+
+        CodeGeneratorJS doesn't generate header includes for sequence<type>
+        https://bugs.webkit.org/show_bug.cgi?id=121314
+
+        Reviewed by Dean Jackson.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (SkipIncludeHeader): Don't return false for sequence and array types.
+        (AddIncludesForType): Do add includes for sequence and array types.
+        (GenerateCallbackImplementation):
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp: Regenerated
+        * bindings/scripts/test/JS/JSTestTypedefs.h: Ditto.
+        * bindings/scripts/test/TestTypedefs.idl: Add a method that takes a sequence<TestEventTarget>.
+
 2013-09-13  Andreas Kling  <akling@apple.com>
 
         CTTE: RenderSVGResourcePattern always has an SVGPatternElement.
 2013-09-13  Andreas Kling  <akling@apple.com>
 
         CTTE: RenderSVGResourcePattern always has an SVGPatternElement.
index ad8fbce..52cc60c 100644 (file)
@@ -206,7 +206,6 @@ sub SkipIncludeHeader
     my $type = shift;
 
     return 1 if $codeGenerator->SkipIncludeHeader($type);
     my $type = shift;
 
     return 1 if $codeGenerator->SkipIncludeHeader($type);
-    return 1 if $codeGenerator->GetSequenceType($type) or $codeGenerator->GetArrayType($type);
     return $typesWithoutHeader{$type};
 }
 
     return $typesWithoutHeader{$type};
 }
 
@@ -225,6 +224,19 @@ sub AddIncludesForType
         $includesRef->{"JSCustomXPathNSResolver.h"} = 1;
     } elsif ($isCallback && $codeGenerator->IsWrapperType($type)) {
         $includesRef->{"JS${type}.h"} = 1;
         $includesRef->{"JSCustomXPathNSResolver.h"} = 1;
     } elsif ($isCallback && $codeGenerator->IsWrapperType($type)) {
         $includesRef->{"JS${type}.h"} = 1;
+    } elsif ($codeGenerator->GetSequenceType($type) or $codeGenerator->GetArrayType($type)) {
+        my $arrayType = $codeGenerator->GetArrayType($type);
+        my $sequenceType = $codeGenerator->GetSequenceType($type);
+        my $arrayOrSequenceType = $arrayType || $sequenceType;
+
+        if ($arrayType eq "DOMString") {
+            $includesRef->{"JSDOMStringList.h"} = 1;
+            $includesRef->{"DOMStringList.h"} = 1;
+        } elsif ($codeGenerator->IsRefPtrType($arrayOrSequenceType)) {
+            $includesRef->{"JS${arrayOrSequenceType}.h"} = 1;
+            $includesRef->{"${arrayOrSequenceType}.h"} = 1;
+        }
+        $includesRef->{"<runtime/JSArray.h>"} = 1;
     } else {
         # default, include the same named file
         $includesRef->{"${type}.h"} = 1;
     } else {
         # default, include the same named file
         $includesRef->{"${type}.h"} = 1;
index 00d78f5..829511c 100644 (file)
@@ -28,6 +28,7 @@
 #include "JSSVGPoint.h"
 #include "JSSerializedScriptValue.h"
 #include "JSTestCallback.h"
 #include "JSSVGPoint.h"
 #include "JSSerializedScriptValue.h"
 #include "JSTestCallback.h"
+#include "JSTestEventTarget.h"
 #include "JSTestSubObj.h"
 #include "KURL.h"
 #include "SVGPoint.h"
 #include "JSTestSubObj.h"
 #include "KURL.h"
 #include "SVGPoint.h"
@@ -119,6 +120,7 @@ static const HashTableValue JSTestTypedefsPrototypeTableValues[] =
     { "immutablePointFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t)0, NoIntrinsic },
     { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
     { "stringArrayFunction2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t)1, NoIntrinsic },
     { "immutablePointFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t)0, NoIntrinsic },
     { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
     { "stringArrayFunction2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t)1, NoIntrinsic },
+    { "callWithSequenceThatRequiresInclude", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude), (intptr_t)1, NoIntrinsic },
     { "methodWithException", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t)0, NoIntrinsic },
     { 0, 0, 0, 0, NoIntrinsic }
 };
     { "methodWithException", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t)0, NoIntrinsic },
     { 0, 0, 0, 0, NoIntrinsic }
 };
@@ -527,6 +529,24 @@ EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2
     return JSValue::encode(result);
 }
 
     return JSValue::encode(result);
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(JSTestTypedefs::info()))
+        return throwVMTypeError(exec);
+    JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
+    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+    Vector<RefPtr<TestEventTarget> > sequenceArg((toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(exec, exec->argument(0), &toTestEventTarget)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    JSC::JSValue result = jsBoolean(impl->callWithSequenceThatRequiresInclude(sequenceArg));
+    return JSValue::encode(result);
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();
 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();
index d35dbe2..c1f9f76 100644 (file)
@@ -151,6 +151,7 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(J
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(JSC::ExecState*);
 // Attributes
 
 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(JSC::ExecState*);
 // Attributes
 
index bc555a8..d2aaa9f 100644 (file)
@@ -55,6 +55,8 @@
     [RaisesException] ARRAY_OF_STRINGS stringArrayFunction(ARRAY_OF_STRINGS values);
     [RaisesException] STRING[] stringArrayFunction2(STRING[] values);
 
     [RaisesException] ARRAY_OF_STRINGS stringArrayFunction(ARRAY_OF_STRINGS values);
     [RaisesException] STRING[] stringArrayFunction2(STRING[] values);
 
+    boolean callWithSequenceThatRequiresInclude(sequence<TestEventTarget> sequenceArg);
+
     // Exceptions
     [RaisesException] void methodWithException();
     [GetterRaisesException] attribute long attrWithGetterException;
     // Exceptions
     [RaisesException] void methodWithException();
     [GetterRaisesException] attribute long attrWithGetterException;
@@ -75,3 +77,4 @@ typedef TestCallback               TEST_CALLBACK;
 typedef TestSubObjConstructor      T;
 typedef Int32Array                 ARRAY;
 typedef DOMException               E;
 typedef TestSubObjConstructor      T;
 typedef Int32Array                 ARRAY;
 typedef DOMException               E;
+typedef TestEventTarget            TEST_EVENT_TARGET;