run-bindings-tests output a lot of errors in TestSerializedScriptValueInterface.idl
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2012 23:08:13 +0000 (23:08 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2012 23:08:13 +0000 (23:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81852

Reviewed by Adam Barth.

run-bindings-tests output a lot of errors in TestSerializedScriptValueInterface.idl:

Use of uninitialized value in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2743.
Use of uninitialized value $name in substitution (s///) at WebCore/bindings/scripts/CodeGenerator.pm line 119.
Use of uninitialized value $type in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2969.
Use of uninitialized value $type in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2972.
Use of uninitialized value $type in hash element at WebCore/bindings/scripts/CodeGenerator.pm line 367.
Use of uninitialized value $type in hash element at WebCore/bindings/scripts/CodeGenerator.pm line 368.
...

This is because [Constructor(...)] does not yet support [Optional] arguments.
It just supports [Optional=DefaultIsUndefined] and [Optional=DefaultIsNullString] arguments:
https://trac.webkit.org/wiki/WebKitIDL#Constructor

This patch replaces [Optional] with [Optional=DefaultIsUndefined]
in TestSerializedScriptValueInterface.idl.

Test: bindings/scripts/test/TestSerializedScriptValueInterface.idl

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorDefinition):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateConstructorCallback):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface):
* bindings/scripts/test/TestSerializedScriptValueInterface.idl:
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::V8TestSerializedScriptValueInterface::constructorCallback):

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

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl
Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

index 5ba8017..f4d4e32 100644 (file)
@@ -1,3 +1,39 @@
+2012-03-22  Kentaro Hara  <haraken@chromium.org>
+
+        run-bindings-tests output a lot of errors in TestSerializedScriptValueInterface.idl
+        https://bugs.webkit.org/show_bug.cgi?id=81852
+
+        Reviewed by Adam Barth.
+
+        run-bindings-tests output a lot of errors in TestSerializedScriptValueInterface.idl:
+
+        Use of uninitialized value in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2743.
+        Use of uninitialized value $name in substitution (s///) at WebCore/bindings/scripts/CodeGenerator.pm line 119.
+        Use of uninitialized value $type in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2969.
+        Use of uninitialized value $type in string eq at WebCore/bindings/scripts/CodeGeneratorJS.pm line 2972.
+        Use of uninitialized value $type in hash element at WebCore/bindings/scripts/CodeGenerator.pm line 367.
+        Use of uninitialized value $type in hash element at WebCore/bindings/scripts/CodeGenerator.pm line 368.
+        ...
+
+        This is because [Constructor(...)] does not yet support [Optional] arguments.
+        It just supports [Optional=DefaultIsUndefined] and [Optional=DefaultIsNullString] arguments:
+        https://trac.webkit.org/wiki/WebKitIDL#Constructor
+
+        This patch replaces [Optional] with [Optional=DefaultIsUndefined]
+        in TestSerializedScriptValueInterface.idl.
+
+        Test: bindings/scripts/test/TestSerializedScriptValueInterface.idl
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateConstructorDefinition):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateConstructorCallback):
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface):
+        * bindings/scripts/test/TestSerializedScriptValueInterface.idl:
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+        (WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
+
 2012-03-22  Michal Mocny  <mmocny@google.com>
 
         [chromium] LayerRendererChromium should use GpuMemoryAllocationChanged callback to explicitly manage framebuffer.
index 267a6e0..448256b 100644 (file)
@@ -3581,9 +3581,9 @@ END
                 push(@$outputArray, "    ExceptionCode ec = 0;\n");
             }
 
-            # For now, we do not support SVG constructors.
-            # We do not also support a constructor [Optional] argument without CallWithDefaultValue
-            # nor CallWithNullValue.
+            # FIXME: For now, we do not support SVG constructors.
+            # FIXME: Currently [Constructor(...)] does not yet support [Optional] arguments.
+            # It just supports [Optional=DefaultIsUndefined] or [Optional=DefaultIsNullString].
             my $numParameters = @{$function->parameters};
             my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $dataNode, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef);
 
index bb2268c..53df9fc 100644 (file)
@@ -1721,6 +1721,8 @@ END
         push(@implContent, "    ExceptionCode ec = 0;\n");
     }
 
+    # FIXME: Currently [Constructor(...)] does not yet support [Optional] arguments.
+    # It just supports [Optional=DefaultIsUndefined] or [Optional=DefaultIsNullString].
     my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $implClassName);
     push(@implContent, $parameterCheckString);
 
index ef6a7b3..32e44d5 100644 (file)
 #include <runtime/Error.h>
 #include <wtf/GetPtr.h>
 
-#if ENABLE(Condition1) || ENABLE(Condition2)
-#include ".h"
-#include "JS.h"
-#endif
-
 using namespace JSC;
 
 namespace WebCore {
@@ -99,14 +94,6 @@ EncodedJSValue JSC_HOST_CALL JSTestSerializedScriptValueInterfaceConstructor::co
     RefPtr<SerializedScriptValue> data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = exec->argumentCount();
-    if (argsCount <= 2) {
-
-        JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->constructorCallback(hello, data)));
-        return JSValue::encode(result);
-    }
-
     Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined)));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
index 7e954d5..c4b886a 100644 (file)
@@ -29,7 +29,7 @@ module test {
     interface [
         Conditional=Condition1|Condition2,
         Constructor(in DOMString hello, in SerializedScriptValue value),
-        Constructor(in DOMString hello, in [TransferList=transferList] SerializedScriptValue data, in [Optional] Array transferList),
+        Constructor(in DOMString hello, in [TransferList=transferList] SerializedScriptValue data, in [Optional=DefaultIsUndefined] Array transferList),
     ] TestSerializedScriptValueInterface {
         attribute SerializedScriptValue value;
         readonly attribute SerializedScriptValue readonlyValue;
index e2a68c3..5a1c50d 100644 (file)
 #include "MessagePort.h"
 #include "RuntimeEnabledFeatures.h"
 #include "SerializedScriptValue.h"
-#include "V8.h"
 #include "V8Binding.h"
 #include "V8BindingMacros.h"
 #include "V8BindingState.h"
 #include "V8DOMWrapper.h"
 #include "V8IsolatedContext.h"
 #include "V8Proxy.h"
-#include <wtf/GetPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
 #include <wtf/UnusedParam.h>
 
 namespace WebCore {
@@ -217,9 +213,6 @@ v8::Handle<v8::Value> V8TestSerializedScriptValueInterface::constructorCallback(
     RefPtr<SerializedScriptValue> data = SerializedScriptValue::create(args[1], &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow);
     if (dataDidThrow)
         return v8::Undefined();
-    if (args.Length() <= 2) {
-        return toV8(imp->Constructor(hello, data));
-    }
 
     RefPtr<TestSerializedScriptValueInterface> impl = TestSerializedScriptValueInterface::create(hello, data, messagePortArrayTransferList);
     v8::Handle<v8::Object> wrapper = args.Holder();