From: jsbell@chromium.org Date: Tue, 3 Jul 2012 01:08:24 +0000 (+0000) Subject: IDL overloads should not treat wrapper types as nullable by default X-Git-Tag: 070512121124~182 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=112ad74b9d856d572b02f1f8739affd95e87174a;p=profile%2Fivi%2Fwebkit-efl.git IDL overloads should not treat wrapper types as nullable by default https://bugs.webkit.org/show_bug.cgi?id=90218 Reviewed by Kentaro Hara. Wrapper types were being treated as Nullable by default during overloaded method dispatching, which deviates from the WebIDL specification. This change introduces the "?" type suffix into the parser, and treats wrapper types only nullable if specified. (The behavior of array types and other non-wrapper types are not changed, and only overloaded methods are checked.) IDL files with affected overloads are modified to include the "?" suffix so that no behavior changes are introduced by this patch - the JS and V8 generator results before/after the change show no diffs. Test: bindings/scripts/test/TestObj.idl (a non-nullable overload) * Modules/indexeddb/IDBDatabase.idl: Added "?" where necessary. * Modules/indexeddb/IDBIndex.idl: Added "?" where necessary. * Modules/indexeddb/IDBObjectStore.idl: Added "?" where necessary. * Modules/webaudio/AudioContext.idl: Added "?" where necessary. * Modules/webaudio/AudioNode.idl: Added "?" where necessary. * bindings/scripts/CodeGeneratorJS.pm: (GenerateParametersCheckExpression): Add isNullable check. * bindings/scripts/CodeGeneratorV8.pm: (GenerateParametersCheckExpression): Add isNullable check. * bindings/scripts/IDLParser.pm: Parse/set isNullable. (parseParameters): * bindings/scripts/IDLStructure.pm: Add basic type suffix parsing. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8): (WebCore): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): * bindings/scripts/test/TestObj.idl: Mark previous overload params with ?, add new one without. * bindings/scripts/test/V8/V8TestObj.cpp: (WebCore::TestObjV8Internal::overloadedMethod8Callback): (TestObjV8Internal): (WebCore::TestObjV8Internal::overloadedMethodCallback): * dom/DataTransferItemList.idl: Added "?" where necessary. * fileapi/WebKitBlobBuilder.idl: Added "?" where necessary. * html/DOMURL.idl: Added "?" where necessary. * html/canvas/CanvasRenderingContext2D.idl: Added "?" where necessary. * html/canvas/WebGLRenderingContext.idl: Added "?" where necessary. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121714 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index e5795e0..bec863f 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,49 @@ +2012-07-02 Joshua Bell + + IDL overloads should not treat wrapper types as nullable by default + https://bugs.webkit.org/show_bug.cgi?id=90218 + + Reviewed by Kentaro Hara. + + Wrapper types were being treated as Nullable by default during overloaded + method dispatching, which deviates from the WebIDL specification. This change + introduces the "?" type suffix into the parser, and treats wrapper types + only nullable if specified. (The behavior of array types and other non-wrapper + types are not changed, and only overloaded methods are checked.) + + IDL files with affected overloads are modified to include the "?" suffix + so that no behavior changes are introduced by this patch - the JS and V8 + generator results before/after the change show no diffs. + + Test: bindings/scripts/test/TestObj.idl (a non-nullable overload) + + * Modules/indexeddb/IDBDatabase.idl: Added "?" where necessary. + * Modules/indexeddb/IDBIndex.idl: Added "?" where necessary. + * Modules/indexeddb/IDBObjectStore.idl: Added "?" where necessary. + * Modules/webaudio/AudioContext.idl: Added "?" where necessary. + * Modules/webaudio/AudioNode.idl: Added "?" where necessary. + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheckExpression): Add isNullable check. + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheckExpression): Add isNullable check. + * bindings/scripts/IDLParser.pm: Parse/set isNullable. + (parseParameters): + * bindings/scripts/IDLStructure.pm: Add basic type suffix parsing. + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8): + (WebCore): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): + * bindings/scripts/test/TestObj.idl: Mark previous overload params with ?, add new one without. + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::overloadedMethod8Callback): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::overloadedMethodCallback): + * dom/DataTransferItemList.idl: Added "?" where necessary. + * fileapi/WebKitBlobBuilder.idl: Added "?" where necessary. + * html/DOMURL.idl: Added "?" where necessary. + * html/canvas/CanvasRenderingContext2D.idl: Added "?" where necessary. + * html/canvas/WebGLRenderingContext.idl: Added "?" where necessary. + 2012-07-02 No'am Rosenthal [Qt] Get rid of GraphicsLayerQt diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl index 95f6c23..70e83f5 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl @@ -45,7 +45,7 @@ module storage { raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBVersionChangeRequest setVersion(in DOMString version) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in [Optional=DefaultIsNullString] DOMString mode) + [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList? storeNames, in [Optional=DefaultIsNullString] DOMString mode) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in [Optional=DefaultIsNullString] DOMString mode) raises (IDBDatabaseException); @@ -53,7 +53,7 @@ module storage { raises (IDBDatabaseException); // FIXME: remove these when https://bugs.webkit.org/show_bug.cgi?id=85326 is fixed. - [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in unsigned short mode) + [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList? storeNames, in unsigned short mode) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in unsigned short mode) raises (IDBDatabaseException); diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.idl b/Source/WebCore/Modules/indexeddb/IDBIndex.idl index ab6ceb7..a1708ca 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndex.idl +++ b/Source/WebCore/Modules/indexeddb/IDBIndex.idl @@ -34,36 +34,36 @@ module storage { readonly attribute boolean unique; readonly attribute boolean multiEntry; - [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] DOMString direction) + [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange? range, in [Optional] DOMString direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openCursor(in IDBKey key, in [Optional] DOMString direction) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] DOMString direction) + [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange? range, in [Optional] DOMString direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in IDBKey key, in [Optional] DOMString direction) raises (IDBDatabaseException); // FIXME: remove these when // https://bugs.webkit.org/show_bug.cgi?id=85326 is fixed. - [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction) + [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange? range, in [Optional] unsigned short direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openCursor(in IDBKey key, in [Optional] unsigned short direction) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction) + [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange? range, in [Optional] unsigned short direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in IDBKey key, in [Optional] unsigned short direction) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKeyRange key) + [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKeyRange? key) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest getKey(in IDBKeyRange key) + [CallWith=ScriptExecutionContext] IDBRequest getKey(in IDBKeyRange? key) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest getKey(in IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest count(in [Optional] IDBKeyRange range) + [CallWith=ScriptExecutionContext] IDBRequest count(in [Optional] IDBKeyRange? range) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest count(in IDBKey key) raises (IDBDatabaseException); diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl b/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl index 2b58e03..9ed1422 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl @@ -38,23 +38,23 @@ module storage { raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKeyRange keyRange) + [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKeyRange? keyRange) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKey key) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest clear() raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKeyRange key) + [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKeyRange? key) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] DOMString direction) + [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange? range, in [Optional] DOMString direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openCursor(in IDBKey key, in [Optional] DOMString direction) raises (IDBDatabaseException); // FIXME: remove these when https://bugs.webkit.org/show_bug.cgi?id=85326 is fixed. - [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction) + [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange? range, in [Optional] unsigned short direction) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest openCursor(in IDBKey key, in [Optional] unsigned short direction) raises (IDBDatabaseException); @@ -67,7 +67,7 @@ module storage { raises (IDBDatabaseException); void deleteIndex(in DOMString name) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBRequest count(in [Optional] IDBKeyRange range) + [CallWith=ScriptExecutionContext] IDBRequest count(in [Optional] IDBKeyRange? range) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest count(in IDBKey key) raises (IDBDatabaseException); diff --git a/Source/WebCore/Modules/webaudio/AudioContext.idl b/Source/WebCore/Modules/webaudio/AudioContext.idl index 1d02288..204b0c7 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.idl +++ b/Source/WebCore/Modules/webaudio/AudioContext.idl @@ -49,7 +49,7 @@ module webaudio { AudioBuffer createBuffer(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate) raises(DOMException); - AudioBuffer createBuffer(in ArrayBuffer buffer, in boolean mixToMono) + AudioBuffer createBuffer(in ArrayBuffer? buffer, in boolean mixToMono) raises(DOMException); // Asynchronous audio file data decoding. diff --git a/Source/WebCore/Modules/webaudio/AudioNode.idl b/Source/WebCore/Modules/webaudio/AudioNode.idl index 13bdc75..e85c747 100644 --- a/Source/WebCore/Modules/webaudio/AudioNode.idl +++ b/Source/WebCore/Modules/webaudio/AudioNode.idl @@ -30,10 +30,10 @@ module audio { readonly attribute unsigned long numberOfInputs; readonly attribute unsigned long numberOfOutputs; - void connect(in AudioNode destination, in [Optional=DefaultIsUndefined] unsigned long output, in [Optional=DefaultIsUndefined] unsigned long input) + void connect(in AudioNode? destination, in [Optional=DefaultIsUndefined] unsigned long output, in [Optional=DefaultIsUndefined] unsigned long input) raises(DOMException); - void connect(in AudioParam destination, in [Optional=DefaultIsUndefined] unsigned long output) + void connect(in AudioParam? destination, in [Optional=DefaultIsUndefined] unsigned long output) raises(DOMException); void disconnect(in [Optional=DefaultIsUndefined] unsigned long output) diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 527e193..74c40bf 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -1263,7 +1263,11 @@ sub GenerateParametersCheckExpression push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(&JSArray::s_info)))"); $usedArguments{$parameterIndex} = 1; } elsif (!IsNativeType($type)) { - push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info)))"); + if ($parameter->isNullable) { + push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info)))"); + } else { + push(@andExpression, "(${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))"); + } $usedArguments{$parameterIndex} = 1; } $parameterIndex++; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 6d4f552..f3874a5 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1359,7 +1359,11 @@ sub GenerateParametersCheckExpression # FIXME: Add proper support for T[], T[]?, sequence. push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())"); } elsif (IsWrapperType($type)) { - push(@andExpression, "(${value}->IsNull() || V8${type}::HasInstance($value))"); + if ($parameter->isNullable) { + push(@andExpression, "(${value}->IsNull() || V8${type}::HasInstance($value))"); + } else { + push(@andExpression, "(V8${type}::HasInstance($value))"); + } } $parameterIndex++; diff --git a/Source/WebCore/bindings/scripts/IDLParser.pm b/Source/WebCore/bindings/scripts/IDLParser.pm index 0f08a35..af02c64 100644 --- a/Source/WebCore/bindings/scripts/IDLParser.pm +++ b/Source/WebCore/bindings/scripts/IDLParser.pm @@ -244,13 +244,17 @@ sub parseParameters my $paramDirection = $1; my $paramExtendedAttributes = (defined($2) ? $2 : " "); chop($paramExtendedAttributes); my $paramType = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)")); - my $paramName = (defined($4) ? $4 : die("Parsing error!\nSource:\n$line\n)")); + my $paramTypeSuffix = defined($4) ? $4 : ""; + my $paramName = (defined($5) ? $5 : die("Parsing error!\nSource:\n$line\n)")); + + my $isNullable = $paramTypeSuffix eq "?"; my $paramDataNode = new domSignature(); $paramDataNode->direction($paramDirection); $paramDataNode->name($paramName); $paramDataNode->type($paramType); $paramDataNode->extendedAttributes(parseExtendedAttributes($paramExtendedAttributes)); + $paramDataNode->isNullable($isNullable); my $arrayRef = $newDataNode->parameters; push(@$arrayRef, $paramDataNode); diff --git a/Source/WebCore/bindings/scripts/IDLStructure.pm b/Source/WebCore/bindings/scripts/IDLStructure.pm index 5424153..5e1ab45 100644 --- a/Source/WebCore/bindings/scripts/IDLStructure.pm +++ b/Source/WebCore/bindings/scripts/IDLStructure.pm @@ -65,7 +65,8 @@ struct( domSignature => { direction => '$', # Variable direction (in or out) name => '$', # Variable name type => '$', # Variable type - extendedAttributes => '$' # Extended attributes + extendedAttributes => '$', # Extended attributes + isNullable => '$' # Is variable type Nullable (T?) }); # Used to represent string constants @@ -90,6 +91,7 @@ our $idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier # Magic IDL parsing regular expressions my $supportedTypes = "((?:(?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))(?:\\[\\]|<(?:$idlIdNsList*)>)?)"; +my $supportedTypeSuffix = "(\\?)?"; # Special IDL notations. This regular expression extracts the string between the first [ and its corresponding ]. our $extendedAttributeSyntax = qr/\[[^\[\]]*(?:(??{$IDLStructure::extendedAttributeSyntax})[^\[\]]*)*\]/x; # Used for extended attributes @@ -104,9 +106,9 @@ our $setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)' our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; -our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|]*)'; -our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>]*)'; -our $interfaceParameterSelector = '(in|out)\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; +our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|?]*)'; +our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>?]*)'; +our $interfaceParameterSelector = '(in|out)\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . $supportedTypeSuffix . '\s*(' . $idlIdNs . '*)'; our $interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index f4a5cd8..90b1340 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -2143,6 +2143,23 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod7( return JSValue::encode(jsUndefined()); } +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod8(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = jsCast(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createNotEnoughArgumentsError(exec)); + TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->overloadedMethod(objArg); + return JSValue::encode(jsUndefined()); +} + EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { size_t argsCount = exec->argumentCount(); @@ -2162,6 +2179,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecStat return jsTestObjPrototypeFunctionOverloadedMethod6(exec); if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(&JSArray::s_info))))) return jsTestObjPrototypeFunctionOverloadedMethod7(exec); + if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(&JSTestObj::s_info)))) + return jsTestObjPrototypeFunctionOverloadedMethod8(exec); return throwVMTypeError(exec); } diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index ef342f8..61dcf9d 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -163,13 +163,14 @@ module test { #if defined(TESTING_V8) || defined(TESTING_JS) // Overloads - void overloadedMethod(in TestObj objArg, in DOMString strArg); - void overloadedMethod(in TestObj objArg, in [Optional] long intArg); + void overloadedMethod(in TestObj? objArg, in DOMString strArg); + void overloadedMethod(in TestObj? objArg, in [Optional] long intArg); void overloadedMethod(in DOMString strArg); void overloadedMethod(in long intArg); void overloadedMethod(in [Callback] TestCallback callback); - void overloadedMethod(in DOMStringList listArg); + void overloadedMethod(in DOMStringList? listArg); void overloadedMethod(in DOMString[] arrayArg); + void overloadedMethod(in TestObj objArg); #endif // Class methods within JavaScript (like what's used for IDBKeyRange). diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index a396dbb..ee22488 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -1571,6 +1571,17 @@ static v8::Handle overloadedMethod7Callback(const v8::Arguments& args return v8::Handle(); } +static v8::Handle overloadedMethod8Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.overloadedMethod8"); + if (args.Length() < 1) + return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0); + imp->overloadedMethod(objArg); + return v8::Handle(); +} + static v8::Handle overloadedMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.overloadedMethod"); @@ -1588,6 +1599,8 @@ static v8::Handle overloadedMethodCallback(const v8::Arguments& args) return overloadedMethod6Callback(args); if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray()))) return overloadedMethod7Callback(args); + if ((args.Length() == 1 && (V8TestObj::HasInstance(args[0])))) + return overloadedMethod8Callback(args); return V8Proxy::throwTypeError(0, args.GetIsolate()); } diff --git a/Source/WebCore/dom/DataTransferItemList.idl b/Source/WebCore/dom/DataTransferItemList.idl index d1de50e..aee92e7 100644 --- a/Source/WebCore/dom/DataTransferItemList.idl +++ b/Source/WebCore/dom/DataTransferItemList.idl @@ -42,7 +42,7 @@ module core { DataTransferItem item(in [Optional=DefaultIsUndefined] unsigned long index); void clear(); - void add(in File file); + void add(in File? file); void add(in [Optional=DefaultIsUndefined] DOMString data, in [Optional=DefaultIsUndefined] DOMString type) raises(DOMException); }; diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.idl b/Source/WebCore/fileapi/WebKitBlobBuilder.idl index e3479a4..8ec1280 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.idl +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.idl @@ -39,10 +39,10 @@ module html { #if !defined(LANGUAGE_OBJECTIVE_C) Blob getBlob(in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); #endif - void append(in Blob blob); + void append(in Blob? blob); #if defined(ENABLE_BLOB) && ENABLE_BLOB - [CallWith=ScriptExecutionContext] void append(in ArrayBuffer arrayBuffer); - void append(in ArrayBufferView arrayBufferView); + [CallWith=ScriptExecutionContext] void append(in ArrayBuffer? arrayBuffer); + void append(in ArrayBufferView? arrayBufferView); #endif void append(in DOMString value, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString endings) raises (DOMException); }; diff --git a/Source/WebCore/html/DOMURL.idl b/Source/WebCore/html/DOMURL.idl index 44bb638..ed04c23 100644 --- a/Source/WebCore/html/DOMURL.idl +++ b/Source/WebCore/html/DOMURL.idl @@ -34,9 +34,9 @@ module html { InterfaceName=URL ] DOMURL { #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaStream stream); + [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaStream? stream); #endif - [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in Blob blob); + [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in Blob? blob); [CallWith=ScriptExecutionContext] static void revokeObjectURL(in DOMString url); }; } diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl index d41f875..cffa8da 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -168,24 +168,24 @@ module html { in [Optional=DefaultIsUndefined] float height, in [Optional] float lineWidth); - void drawImage(in HTMLImageElement image, in float x, in float y) + void drawImage(in HTMLImageElement? image, in float x, in float y) raises (DOMException); - void drawImage(in HTMLImageElement image, in float x, in float y, in float width, in float height) + void drawImage(in HTMLImageElement? image, in float x, in float y, in float width, in float height) raises (DOMException); - void drawImage(in HTMLImageElement image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + void drawImage(in HTMLImageElement? image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) raises (DOMException); - void drawImage(in HTMLCanvasElement canvas, in float x, in float y) + void drawImage(in HTMLCanvasElement? canvas, in float x, in float y) raises (DOMException); - void drawImage(in HTMLCanvasElement canvas, in float x, in float y, in float width, in float height) + void drawImage(in HTMLCanvasElement? canvas, in float x, in float y, in float width, in float height) raises (DOMException); - void drawImage(in HTMLCanvasElement canvas, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + void drawImage(in HTMLCanvasElement? canvas, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO - void drawImage(in HTMLVideoElement video, in float x, in float y) + void drawImage(in HTMLVideoElement? video, in float x, in float y) raises (DOMException); - void drawImage(in HTMLVideoElement video, in float x, in float y, in float width, in float height) + void drawImage(in HTMLVideoElement? video, in float x, in float y, in float width, in float height) raises (DOMException); - void drawImage(in HTMLVideoElement video, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + void drawImage(in HTMLVideoElement? video, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) raises (DOMException); #endif @@ -199,21 +199,21 @@ module html { void setShadow(in float width, in float height, in float blur, in float r, in float g, in float b, in float a); void setShadow(in float width, in float height, in float blur, in float c, in float m, in float y, in float k, in float a); - void putImageData(in ImageData imagedata, in float dx, in float dy) + void putImageData(in ImageData? imagedata, in float dx, in float dy) raises(DOMException); - void putImageData(in ImageData imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) + void putImageData(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) raises(DOMException); - void webkitPutImageDataHD(in ImageData imagedata, in float dx, in float dy) + void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy) raises(DOMException); - void webkitPutImageDataHD(in ImageData imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) + void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) raises(DOMException); - CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs=NullString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLCanvasElement? canvas, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); - CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=NullString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLImageElement? image, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); - ImageData createImageData(in ImageData imagedata) + ImageData createImageData(in ImageData? imagedata) raises (DOMException); ImageData createImageData(in float sw, in float sh) raises (DOMException); diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.idl b/Source/WebCore/html/canvas/WebGLRenderingContext.idl index 0f73fbd..9bf6ff5 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.idl @@ -461,11 +461,11 @@ module html { [StrictTypeChecking] void blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha); [StrictTypeChecking] void blendFunc(in unsigned long sfactor, in unsigned long dfactor); [StrictTypeChecking] void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); - [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBuffer data, in unsigned long usage) raises (DOMException); - [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBufferView data, in unsigned long usage) raises (DOMException); + [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBuffer? data, in unsigned long usage) raises (DOMException); + [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBufferView? data, in unsigned long usage) raises (DOMException); [StrictTypeChecking] void bufferData(in unsigned long target, in long long size, in unsigned long usage) raises (DOMException); - [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBuffer data) raises (DOMException); - [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBufferView data) raises (DOMException); + [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBuffer? data) raises (DOMException); + [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBufferView? data) raises (DOMException); [StrictTypeChecking] unsigned long checkFramebufferStatus(in unsigned long target); [StrictTypeChecking] void clear(in unsigned long mask); @@ -602,30 +602,30 @@ module html { // Supported forms: [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height, - in long border, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises (DOMException); + in long border, in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in ImageData pixels) raises (DOMException); + in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); #endif [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long width, in long height, - in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises (DOMException); + in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in ImageData pixels) raises (DOMException); + in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); + in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); #endif [StrictTypeChecking] void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException);