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

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

Issue 163883006: Add context to generated named and indexed property operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. Created 6 years, 10 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/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index c1b92a04da6809022d4c0aa83fd25911c51967f3..920d5463721990c929e7241f26f31668145267ee 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -3680,6 +3680,7 @@ sub GenerateImplementationIndexedPropertyGetter
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $methodName = GetImplName($indexedGetterFunction) || "anonymousIndexedGetter";
+ my $interfaceName = $interface->name;
my $returnType = $indexedGetterFunction->type;
my $nativeType = GetNativeType($returnType);
@@ -3693,7 +3694,7 @@ sub GenerateImplementationIndexedPropertyGetter
$getterCode .= "{\n";
$getterCode .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());\n";
if ($raisesExceptions) {
- $getterCode .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $getterCode .= " ExceptionState exceptionState(ExceptionState::IndexedGetterContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
}
$getterCode .= $methodCallCode . "\n";
if ($raisesExceptions) {
@@ -3795,7 +3796,7 @@ sub GenerateImplementationIndexedPropertySetter
my $extraArguments = "";
if ($raisesExceptions || IsIntegerType($type)) {
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::IndexedSetterContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
if ($raisesExceptions) {
$extraArguments = ", exceptionState";
}
@@ -4048,6 +4049,7 @@ sub GenerateImplementationNamedPropertyGetter
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $methodName = GetImplName($namedGetterFunction) || "anonymousNamedGetter";
+ my $interfaceName = $interface->name;
my $returnType = $namedGetterFunction->type;
my $isNull = GenerateIsNullExpression($returnType, "result");
@@ -4069,7 +4071,8 @@ sub GenerateImplementationNamedPropertyGetter
$code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());\n";
$code .= " AtomicString propertyName = toCoreAtomicString(name);\n";
if ($raisesExceptions) {
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " v8::String::Utf8Value namedProperty(name);\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
}
$code .= $methodCallCode . "\n";
if ($raisesExceptions) {
@@ -4114,7 +4117,8 @@ sub GenerateImplementationNamedPropertySetter
my $extraArguments = "";
if ($raisesExceptions || IsIntegerType($type)) {
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " v8::String::Utf8Value namedProperty(name);\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
if ($raisesExceptions) {
$extraArguments = ", exceptionState";
}
@@ -4139,6 +4143,7 @@ sub GenerateImplementationIndexedPropertyDeleter
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $methodName = GetImplName($indexedDeleterFunction) || "anonymousIndexedDeleter";
+ my $interfaceName = $interface->name;
my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"RaisesException"};
@@ -4147,7 +4152,7 @@ sub GenerateImplementationIndexedPropertyDeleter
$code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());\n";
my $extraArguments = "";
if ($raisesExceptions) {
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
$extraArguments = ", exceptionState";
}
$code .= " DeleteResult result = imp->${methodName}(index$extraArguments);\n";
@@ -4168,6 +4173,7 @@ sub GenerateImplementationNamedPropertyDeleter
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $methodName = GetImplName($namedDeleterFunction) || "anonymousNamedDeleter";
+ my $interfaceName = $interface->name;
my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesException"};
@@ -4177,7 +4183,8 @@ sub GenerateImplementationNamedPropertyDeleter
$code .= " AtomicString propertyName = toCoreAtomicString(name);\n";
my $extraArguments = "";
if ($raisesExceptions) {
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " v8::String::Utf8Value namedProperty(name);\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::DeletionContext, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
$extraArguments .= ", exceptionState";
}
$code .= " DeleteResult result = imp->${methodName}(propertyName$extraArguments);\n";
@@ -4196,13 +4203,14 @@ sub GenerateImplementationNamedPropertyEnumerator
my $interface = shift;
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
+ my $interfaceName = $interface->name;
$implementation{nameSpaceInternal}->add(<<END);
static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
{
${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());
Vector<String> names;
- ExceptionState exceptionState(info.Holder(), info.GetIsolate());
+ ExceptionState exceptionState(ExceptionState::EnumerationContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());
imp->namedPropertyEnumerator(names, exceptionState);
if (exceptionState.throwIfNeeded())
return;
@@ -4220,13 +4228,15 @@ sub GenerateImplementationNamedPropertyQuery
my $interface = shift;
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
+ my $interfaceName = $interface->name;
$implementation{nameSpaceInternal}->add(<<END);
static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());
AtomicString propertyName = toCoreAtomicString(name);
- ExceptionState exceptionState(info.Holder(), info.GetIsolate());
+ v8::String::Utf8Value namedProperty(name);
+ ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "${interfaceName}", info.Holder(), info.GetIsolate());
bool result = imp->namedPropertyQuery(propertyName, exceptionState);
if (exceptionState.throwIfNeeded())
return;
« no previous file with comments | « LayoutTests/fast/dom/script-tests/dataset-xhtml.js ('k') | Source/bindings/tests/results/V8TestEventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698