Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: Source/bindings/scripts/deprecated_code_generator_v8.pm

Issue 22604003: Make DataTransferItem.getAsString() argument mandatory and nullable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take Arv's feedback into consideration Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/deprecated_code_generator_v8.pm
diff --git a/Source/bindings/scripts/deprecated_code_generator_v8.pm b/Source/bindings/scripts/deprecated_code_generator_v8.pm
index 509aef934798ea65d3b26a22d1522d1eaae1c768..ee8ac669ec20e87a11bbc9fa9bfac41f00a581b4 100644
--- a/Source/bindings/scripts/deprecated_code_generator_v8.pm
+++ b/Source/bindings/scripts/deprecated_code_generator_v8.pm
@@ -2327,11 +2327,19 @@ sub GenerateParametersCheck
$parameterCheckString .= " $parameterName = ${v8ClassName}::create(args[$paramIndex], getScriptExecutionContext());\n";
$parameterCheckString .= " }\n";
} else {
- $parameterCheckString .= " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsFunction()) {\n";
+ $parameterCheckString .= " if (args.Length() <= $paramIndex || ";
+ if ($parameter->isNullable) {
+ $parameterCheckString .= "!(args[$paramIndex]->IsFunction() || args[$paramIndex]->IsNull())";
+ } else {
+ $parameterCheckString .= "!args[$paramIndex]->IsFunction()";
+ }
+ $parameterCheckString .= ") {\n";
$parameterCheckString .= " throwTypeError(args.GetIsolate());\n";
$parameterCheckString .= " return;\n";
$parameterCheckString .= " }\n";
- $parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName = ${v8ClassName}::create(args[$paramIndex], getScriptExecutionContext());\n";
+ $parameterCheckString .= " RefPtr<" . $parameter->type . "> $parameterName = ";
+ $parameterCheckString .= "args[$paramIndex]->IsNull() ? 0 : " if $parameter->isNullable;
+ $parameterCheckString .= "${v8ClassName}::create(args[$paramIndex], getScriptExecutionContext());\n";
}
} elsif ($parameter->extendedAttributes->{"Clamp"}) {
my $nativeValue = "${parameterName}NativeValue";

Powered by Google App Engine
This is Rietveld 408576698