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

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

Issue 14049021: 'length' property is invalid for some DOM bindings functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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
« no previous file with comments | « LayoutTests/fast/js/function-length-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/CodeGeneratorV8.pm
diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm
index 5ecf344c1e37fbba8a55317ea5aaf65a60004362..d6fe6e612029653088c15aa9d40e590363c6922a 100644
--- a/Source/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm
@@ -869,6 +869,7 @@ sub GenerateDomainSafeFunctionGetter
my $v8InterfaceName = "V8" . $interfaceName;
my $funcName = $function->signature->name;
+ my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersCheck($function);
my $signature = "v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&" . $v8InterfaceName . "::info, currentWorldType))";
if ($function->signature->extendedAttributes->{"DoNotCheckSignature"}) {
$signature = "v8::Local<v8::Signature>()";
@@ -884,7 +885,7 @@ static v8::Handle<v8::Value> ${funcName}AttrGetter(v8::Local<v8::String> name, c
static const char* privateTemplateUniqueKey = "${funcName}PrivateTemplate";
WrapperWorldType currentWorldType = worldType(info.GetIsolate());
V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
- v8::Persistent<v8::FunctionTemplate> privateTemplate = data->privateTemplate(currentWorldType, &privateTemplateUniqueKey, $newTemplateParams);
+ v8::Persistent<v8::FunctionTemplate> privateTemplate = data->privateTemplate(currentWorldType, &privateTemplateUniqueKey, $newTemplateParams, $numMandatoryParams);
v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${v8InterfaceName}::GetTemplate(info.GetIsolate(), currentWorldType));
if (holder.IsEmpty()) {
@@ -895,7 +896,7 @@ static v8::Handle<v8::Value> ${funcName}AttrGetter(v8::Local<v8::String> name, c
${interfaceName}* imp = ${v8InterfaceName}::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
static const char* sharedTemplateUniqueKey = "${funcName}SharedTemplate";
- v8::Persistent<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams);
+ v8::Persistent<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams, $numMandatoryParams);
return sharedTemplate->GetFunction();
}
@@ -2772,16 +2773,18 @@ END
die "This shouldn't happen: Intraface '$interfaceName' $commentInfo\n";
}
+ my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersCheck($function);
+
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
$code .= "#if ${conditionalString}\n" if $conditionalString;
if ($function->signature->extendedAttributes->{"PerWorldBindings"}) {
$code .= " if (currentWorldType == MainWorld) {\n";
- $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallbackForMainWorld, v8Undefined(), ${signature})$property_attributes);\n";
+ $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallbackForMainWorld, v8Undefined(), ${signature}, $numMandatoryParams)$property_attributes);\n";
$code .= " } else {\n";
- $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature})$property_attributes);\n";
+ $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature}, $numMandatoryParams)$property_attributes);\n";
$code .= " }\n";
} else {
- $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature})$property_attributes);\n";
+ $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature}, $numMandatoryParams)$property_attributes);\n";
}
$code .= "#endif // ${conditionalString}\n" if $conditionalString;
return $code;
@@ -3641,12 +3644,13 @@ END
foreach my $runtimeFunc (@enabledPerContextFunctions) {
my $enableFunction = GetContextEnableFunction($runtimeFunc->signature);
+ my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersCheck($runtimeFunc);
my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeFunc->signature);
$code .= "\n#if ${conditionalString}\n" if $conditionalString;
$code .= " if (context && context->isDocument() && ${enableFunction}(toDocument(context))) {\n";
my $name = $runtimeFunc->signature->name;
$code .= <<END;
- proto->Set(v8::String::NewSymbol("${name}"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), defaultSignature)->GetFunction());
+ proto->Set(v8::String::NewSymbol("${name}"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), defaultSignature, $numMandatoryParams)->GetFunction());
END
$code .= " }\n";
$code .= "#endif // ${conditionalString}\n" if $conditionalString;
« no previous file with comments | « LayoutTests/fast/js/function-length-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698