diff options
Diffstat (limited to 'WebCore/bindings/scripts/CodeGeneratorV8.pm')
-rw-r--r-- | WebCore/bindings/scripts/CodeGeneratorV8.pm | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index c963e04..c852f7b 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1139,7 +1139,7 @@ END my $raisesExceptions = @{$function->raisesExceptions}; if (!$raisesExceptions) { foreach my $parameter (@{$function->parameters}) { - if (TypeCanFailConversion($parameter) or $parameter->extendedAttributes->{"IsIndex"}) { + if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { $raisesExceptions = 1; } } @@ -1183,6 +1183,21 @@ END push(@implContentDecls, " }\n"); } + if ($parameter->extendedAttributes->{"Callback"}) { + my $className = GetCallbackClassName($parameter->type); + $implIncludes{"$className.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n"); + push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); + if ($parameter->type eq "VoidCallback") { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex], getScriptExecutionContext());\n"); + } else { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex]);\n"); + } + $paramIndex++; + next; + } + if ($parameter->type eq "SerializedScriptValue") { $implIncludes{"SerializedScriptValue.h"} = 1; push(@implContentDecls, " bool ${parameterName}DidThrow = false;\n"); @@ -3235,6 +3250,14 @@ sub GetVisibleInterfaceName return $interfaceName; } +sub GetCallbackClassName +{ + my $interfaceName = shift; + + return "V8CustomVoidCallback" if $interfaceName eq "VoidCallback"; + return "V8$interfaceName"; +} + sub DebugPrint { my $output = shift; |