| OLD | NEW |
| 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
| 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |
| 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |
| (...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3673 return $code; | 3673 return $code; |
| 3674 } | 3674 } |
| 3675 | 3675 |
| 3676 sub GenerateImplementationIndexedPropertyGetter | 3676 sub GenerateImplementationIndexedPropertyGetter |
| 3677 { | 3677 { |
| 3678 my $interface = shift; | 3678 my $interface = shift; |
| 3679 my $indexedGetterFunction = shift; | 3679 my $indexedGetterFunction = shift; |
| 3680 my $implClassName = GetImplName($interface); | 3680 my $implClassName = GetImplName($interface); |
| 3681 my $v8ClassName = GetV8ClassName($interface); | 3681 my $v8ClassName = GetV8ClassName($interface); |
| 3682 my $methodName = GetImplName($indexedGetterFunction) || "anonymousIndexedGet
ter"; | 3682 my $methodName = GetImplName($indexedGetterFunction) || "anonymousIndexedGet
ter"; |
| 3683 my $interfaceName = $interface->name; |
| 3683 | 3684 |
| 3684 my $returnType = $indexedGetterFunction->type; | 3685 my $returnType = $indexedGetterFunction->type; |
| 3685 my $nativeType = GetNativeType($returnType); | 3686 my $nativeType = GetNativeType($returnType); |
| 3686 my $nativeValue = "result"; | 3687 my $nativeValue = "result"; |
| 3687 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3688 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3688 my $isNull = GenerateIsNullExpression($returnType, "result"); | 3689 my $isNull = GenerateIsNullExpression($returnType, "result"); |
| 3689 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "imp", "", "return"); | 3690 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "imp", "", "return"); |
| 3690 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3691 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3691 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "index", $raisesExceptions); | 3692 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "index", $raisesExceptions); |
| 3692 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3693 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3693 $getterCode .= "{\n"; | 3694 $getterCode .= "{\n"; |
| 3694 $getterCode .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Ho
lder());\n"; | 3695 $getterCode .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Ho
lder());\n"; |
| 3695 if ($raisesExceptions) { | 3696 if ($raisesExceptions) { |
| 3696 $getterCode .= " ExceptionState exceptionState(info.Holder(), info.Ge
tIsolate());\n"; | 3697 $getterCode .= " ExceptionState exceptionState(ExceptionState::Indexe
dGetterContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 3697 } | 3698 } |
| 3698 $getterCode .= $methodCallCode . "\n"; | 3699 $getterCode .= $methodCallCode . "\n"; |
| 3699 if ($raisesExceptions) { | 3700 if ($raisesExceptions) { |
| 3700 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; | 3701 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; |
| 3701 $getterCode .= " return;\n"; | 3702 $getterCode .= " return;\n"; |
| 3702 } | 3703 } |
| 3703 if (IsUnionType($returnType)) { | 3704 if (IsUnionType($returnType)) { |
| 3704 $getterCode .= "${returnJSValueCode}\n"; | 3705 $getterCode .= "${returnJSValueCode}\n"; |
| 3705 $getterCode .= " return;\n"; | 3706 $getterCode .= " return;\n"; |
| 3706 } else { | 3707 } else { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3788 | 3789 |
| 3789 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3790 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3790 $code .= "{\n"; | 3791 $code .= "{\n"; |
| 3791 | 3792 |
| 3792 my $asSetterValue = 0; | 3793 my $asSetterValue = 0; |
| 3793 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; | 3794 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
| 3794 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); | 3795 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); |
| 3795 | 3796 |
| 3796 my $extraArguments = ""; | 3797 my $extraArguments = ""; |
| 3797 if ($raisesExceptions || IsIntegerType($type)) { | 3798 if ($raisesExceptions || IsIntegerType($type)) { |
| 3798 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 3799 $code .= " ExceptionState exceptionState(ExceptionState::IndexedSette
rContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 3799 if ($raisesExceptions) { | 3800 if ($raisesExceptions) { |
| 3800 $extraArguments = ", exceptionState"; | 3801 $extraArguments = ", exceptionState"; |
| 3801 } | 3802 } |
| 3802 } | 3803 } |
| 3803 | 3804 |
| 3804 if ($indexedSetterFunction->extendedAttributes->{"StrictTypeChecking"} && Is
WrapperType($type)) { | 3805 if ($indexedSetterFunction->extendedAttributes->{"StrictTypeChecking"} && Is
WrapperType($type)) { |
| 3805 $code .= <<END; | 3806 $code .= <<END; |
| 3806 if (!isUndefinedOrNull(jsValue) && !V8${type}::hasInstance(jsValue, info.Get
Isolate())) { | 3807 if (!isUndefinedOrNull(jsValue) && !V8${type}::hasInstance(jsValue, info.Get
Isolate())) { |
| 3807 exceptionState.throwTypeError("The provided value is not of type '$type'
."); | 3808 exceptionState.throwTypeError("The provided value is not of type '$type'
."); |
| 3808 exceptionState.throwIfNeeded(); | 3809 exceptionState.throwIfNeeded(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4041 } | 4042 } |
| 4042 } | 4043 } |
| 4043 | 4044 |
| 4044 sub GenerateImplementationNamedPropertyGetter | 4045 sub GenerateImplementationNamedPropertyGetter |
| 4045 { | 4046 { |
| 4046 my $interface = shift; | 4047 my $interface = shift; |
| 4047 my $namedGetterFunction = shift; | 4048 my $namedGetterFunction = shift; |
| 4048 my $implClassName = GetImplName($interface); | 4049 my $implClassName = GetImplName($interface); |
| 4049 my $v8ClassName = GetV8ClassName($interface); | 4050 my $v8ClassName = GetV8ClassName($interface); |
| 4050 my $methodName = GetImplName($namedGetterFunction) || "anonymousNamedGetter"
; | 4051 my $methodName = GetImplName($namedGetterFunction) || "anonymousNamedGetter"
; |
| 4052 my $interfaceName = $interface->name; |
| 4051 | 4053 |
| 4052 my $returnType = $namedGetterFunction->type; | 4054 my $returnType = $namedGetterFunction->type; |
| 4053 my $isNull = GenerateIsNullExpression($returnType, "result"); | 4055 my $isNull = GenerateIsNullExpression($returnType, "result"); |
| 4054 my $nativeValue = "result"; | 4056 my $nativeValue = "result"; |
| 4055 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 4057 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 4056 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate()",
"info", "imp", "", "return"); | 4058 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate()",
"info", "imp", "", "return"); |
| 4057 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 4059 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
| 4058 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "propertyName", $raisesExceptions); | 4060 my $methodCallCode = GenerateMethodCall($returnType, "result", "imp->${metho
dName}", "propertyName", $raisesExceptions); |
| 4059 | 4061 |
| 4060 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 4062 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 4061 $code .= "{\n"; | 4063 $code .= "{\n"; |
| 4062 if (!$interface->extendedAttributes->{"OverrideBuiltins"}) { | 4064 if (!$interface->extendedAttributes->{"OverrideBuiltins"}) { |
| 4063 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 4065 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
| 4064 $code .= " return;\n"; | 4066 $code .= " return;\n"; |
| 4065 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 4067 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
| 4066 $code .= " return;\n"; | 4068 $code .= " return;\n"; |
| 4067 $code .= "\n"; | 4069 $code .= "\n"; |
| 4068 } | 4070 } |
| 4069 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; | 4071 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
| 4070 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; | 4072 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; |
| 4071 if ($raisesExceptions) { | 4073 if ($raisesExceptions) { |
| 4072 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4074 $code .= " v8::String::Utf8Value namedProperty(name);\n"; |
| 4075 $code .= " ExceptionState exceptionState(ExceptionState::GetterContex
t, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 4073 } | 4076 } |
| 4074 $code .= $methodCallCode . "\n"; | 4077 $code .= $methodCallCode . "\n"; |
| 4075 if ($raisesExceptions) { | 4078 if ($raisesExceptions) { |
| 4076 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4079 $code .= " if (exceptionState.throwIfNeeded())\n"; |
| 4077 $code .= " return;\n"; | 4080 $code .= " return;\n"; |
| 4078 } | 4081 } |
| 4079 $code .= " if (${isNull})\n"; | 4082 $code .= " if (${isNull})\n"; |
| 4080 $code .= " return;\n"; | 4083 $code .= " return;\n"; |
| 4081 $code .= $returnJSValueCode . "\n"; | 4084 $code .= $returnJSValueCode . "\n"; |
| 4082 $code .= "}\n\n"; | 4085 $code .= "}\n\n"; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4107 $code .= "\n"; | 4110 $code .= "\n"; |
| 4108 } | 4111 } |
| 4109 | 4112 |
| 4110 my $asSetterValue = 0; | 4113 my $asSetterValue = 0; |
| 4111 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; | 4114 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
| 4112 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); | 4115 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); |
| 4113 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); | 4116 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); |
| 4114 | 4117 |
| 4115 my $extraArguments = ""; | 4118 my $extraArguments = ""; |
| 4116 if ($raisesExceptions || IsIntegerType($type)) { | 4119 if ($raisesExceptions || IsIntegerType($type)) { |
| 4117 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4120 $code .= " v8::String::Utf8Value namedProperty(name);\n"; |
| 4121 $code .= " ExceptionState exceptionState(ExceptionState::SetterContex
t, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 4118 if ($raisesExceptions) { | 4122 if ($raisesExceptions) { |
| 4119 $extraArguments = ", exceptionState"; | 4123 $extraArguments = ", exceptionState"; |
| 4120 } | 4124 } |
| 4121 } | 4125 } |
| 4122 | 4126 |
| 4123 $code .= " bool result = imp->$methodName(propertyName, propertyValue$ext
raArguments);\n"; | 4127 $code .= " bool result = imp->$methodName(propertyName, propertyValue$ext
raArguments);\n"; |
| 4124 if ($raisesExceptions) { | 4128 if ($raisesExceptions) { |
| 4125 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4129 $code .= " if (exceptionState.throwIfNeeded())\n"; |
| 4126 $code .= " return;\n"; | 4130 $code .= " return;\n"; |
| 4127 } | 4131 } |
| 4128 $code .= " if (!result)\n"; | 4132 $code .= " if (!result)\n"; |
| 4129 $code .= " return;\n"; | 4133 $code .= " return;\n"; |
| 4130 $code .= " v8SetReturnValue(info, jsValue);\n"; | 4134 $code .= " v8SetReturnValue(info, jsValue);\n"; |
| 4131 $code .= "}\n\n"; | 4135 $code .= "}\n\n"; |
| 4132 $implementation{nameSpaceInternal}->add($code); | 4136 $implementation{nameSpaceInternal}->add($code); |
| 4133 } | 4137 } |
| 4134 | 4138 |
| 4135 sub GenerateImplementationIndexedPropertyDeleter | 4139 sub GenerateImplementationIndexedPropertyDeleter |
| 4136 { | 4140 { |
| 4137 my $interface = shift; | 4141 my $interface = shift; |
| 4138 my $indexedDeleterFunction = shift; | 4142 my $indexedDeleterFunction = shift; |
| 4139 my $implClassName = GetImplName($interface); | 4143 my $implClassName = GetImplName($interface); |
| 4140 my $v8ClassName = GetV8ClassName($interface); | 4144 my $v8ClassName = GetV8ClassName($interface); |
| 4141 my $methodName = GetImplName($indexedDeleterFunction) || "anonymousIndexedDe
leter"; | 4145 my $methodName = GetImplName($indexedDeleterFunction) || "anonymousIndexedDe
leter"; |
| 4146 my $interfaceName = $interface->name; |
| 4142 | 4147 |
| 4143 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; | 4148 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; |
| 4144 | 4149 |
| 4145 my $code = "static void indexedPropertyDeleter(uint32_t index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; | 4150 my $code = "static void indexedPropertyDeleter(uint32_t index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; |
| 4146 $code .= "{\n"; | 4151 $code .= "{\n"; |
| 4147 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; | 4152 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
| 4148 my $extraArguments = ""; | 4153 my $extraArguments = ""; |
| 4149 if ($raisesExceptions) { | 4154 if ($raisesExceptions) { |
| 4150 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4155 $code .= " ExceptionState exceptionState(ExceptionState::IndexedDelet
ionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 4151 $extraArguments = ", exceptionState"; | 4156 $extraArguments = ", exceptionState"; |
| 4152 } | 4157 } |
| 4153 $code .= " DeleteResult result = imp->${methodName}(index$extraArguments)
;\n"; | 4158 $code .= " DeleteResult result = imp->${methodName}(index$extraArguments)
;\n"; |
| 4154 if ($raisesExceptions) { | 4159 if ($raisesExceptions) { |
| 4155 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4160 $code .= " if (exceptionState.throwIfNeeded())\n"; |
| 4156 $code .= " return;\n"; | 4161 $code .= " return;\n"; |
| 4157 } | 4162 } |
| 4158 $code .= " if (result != DeleteUnknownProperty)\n"; | 4163 $code .= " if (result != DeleteUnknownProperty)\n"; |
| 4159 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; | 4164 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; |
| 4160 $code .= "}\n\n"; | 4165 $code .= "}\n\n"; |
| 4161 $implementation{nameSpaceInternal}->add($code); | 4166 $implementation{nameSpaceInternal}->add($code); |
| 4162 } | 4167 } |
| 4163 | 4168 |
| 4164 sub GenerateImplementationNamedPropertyDeleter | 4169 sub GenerateImplementationNamedPropertyDeleter |
| 4165 { | 4170 { |
| 4166 my $interface = shift; | 4171 my $interface = shift; |
| 4167 my $namedDeleterFunction = shift; | 4172 my $namedDeleterFunction = shift; |
| 4168 my $implClassName = GetImplName($interface); | 4173 my $implClassName = GetImplName($interface); |
| 4169 my $v8ClassName = GetV8ClassName($interface); | 4174 my $v8ClassName = GetV8ClassName($interface); |
| 4170 my $methodName = GetImplName($namedDeleterFunction) || "anonymousNamedDelete
r"; | 4175 my $methodName = GetImplName($namedDeleterFunction) || "anonymousNamedDelete
r"; |
| 4176 my $interfaceName = $interface->name; |
| 4171 | 4177 |
| 4172 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; | 4178 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; |
| 4173 | 4179 |
| 4174 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; | 4180 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; |
| 4175 $code .= "{\n"; | 4181 $code .= "{\n"; |
| 4176 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; | 4182 $code .= " ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()
);\n"; |
| 4177 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; | 4183 $code .= " AtomicString propertyName = toCoreAtomicString(name);\n"; |
| 4178 my $extraArguments = ""; | 4184 my $extraArguments = ""; |
| 4179 if ($raisesExceptions) { | 4185 if ($raisesExceptions) { |
| 4180 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 4186 $code .= " v8::String::Utf8Value namedProperty(name);\n"; |
| 4187 $code .= " ExceptionState exceptionState(ExceptionState::DeletionCont
ext, *namedProperty, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"
; |
| 4181 $extraArguments .= ", exceptionState"; | 4188 $extraArguments .= ", exceptionState"; |
| 4182 } | 4189 } |
| 4183 $code .= " DeleteResult result = imp->${methodName}(propertyName$extraArg
uments);\n"; | 4190 $code .= " DeleteResult result = imp->${methodName}(propertyName$extraArg
uments);\n"; |
| 4184 if ($raisesExceptions) { | 4191 if ($raisesExceptions) { |
| 4185 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4192 $code .= " if (exceptionState.throwIfNeeded())\n"; |
| 4186 $code .= " return;\n"; | 4193 $code .= " return;\n"; |
| 4187 } | 4194 } |
| 4188 $code .= " if (result != DeleteUnknownProperty)\n"; | 4195 $code .= " if (result != DeleteUnknownProperty)\n"; |
| 4189 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; | 4196 $code .= " return v8SetReturnValueBool(info, result == DeleteSuccess)
;\n"; |
| 4190 $code .= "}\n\n"; | 4197 $code .= "}\n\n"; |
| 4191 $implementation{nameSpaceInternal}->add($code); | 4198 $implementation{nameSpaceInternal}->add($code); |
| 4192 } | 4199 } |
| 4193 | 4200 |
| 4194 sub GenerateImplementationNamedPropertyEnumerator | 4201 sub GenerateImplementationNamedPropertyEnumerator |
| 4195 { | 4202 { |
| 4196 my $interface = shift; | 4203 my $interface = shift; |
| 4197 my $implClassName = GetImplName($interface); | 4204 my $implClassName = GetImplName($interface); |
| 4198 my $v8ClassName = GetV8ClassName($interface); | 4205 my $v8ClassName = GetV8ClassName($interface); |
| 4206 my $interfaceName = $interface->name; |
| 4199 | 4207 |
| 4200 $implementation{nameSpaceInternal}->add(<<END); | 4208 $implementation{nameSpaceInternal}->add(<<END); |
| 4201 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 4209 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 4202 { | 4210 { |
| 4203 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 4211 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
| 4204 Vector<String> names; | 4212 Vector<String> names; |
| 4205 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 4213 ExceptionState exceptionState(ExceptionState::EnumerationContext, \"${interf
aceName}\", info.Holder(), info.GetIsolate()); |
| 4206 imp->namedPropertyEnumerator(names, exceptionState); | 4214 imp->namedPropertyEnumerator(names, exceptionState); |
| 4207 if (exceptionState.throwIfNeeded()) | 4215 if (exceptionState.throwIfNeeded()) |
| 4208 return; | 4216 return; |
| 4209 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 4217 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 4210 for (size_t i = 0; i < names.size(); ++i) | 4218 for (size_t i = 0; i < names.size(); ++i) |
| 4211 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 4219 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 4212 v8SetReturnValue(info, v8names); | 4220 v8SetReturnValue(info, v8names); |
| 4213 } | 4221 } |
| 4214 | 4222 |
| 4215 END | 4223 END |
| 4216 } | 4224 } |
| 4217 | 4225 |
| 4218 sub GenerateImplementationNamedPropertyQuery | 4226 sub GenerateImplementationNamedPropertyQuery |
| 4219 { | 4227 { |
| 4220 my $interface = shift; | 4228 my $interface = shift; |
| 4221 my $implClassName = GetImplName($interface); | 4229 my $implClassName = GetImplName($interface); |
| 4222 my $v8ClassName = GetV8ClassName($interface); | 4230 my $v8ClassName = GetV8ClassName($interface); |
| 4231 my $interfaceName = $interface->name; |
| 4223 | 4232 |
| 4224 $implementation{nameSpaceInternal}->add(<<END); | 4233 $implementation{nameSpaceInternal}->add(<<END); |
| 4225 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 4234 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 4226 { | 4235 { |
| 4227 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 4236 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
| 4228 AtomicString propertyName = toCoreAtomicString(name); | 4237 AtomicString propertyName = toCoreAtomicString(name); |
| 4229 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 4238 v8::String::Utf8Value namedProperty(name); |
| 4239 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"${interfaceName}", info.Holder(), info.GetIsolate()); |
| 4230 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 4240 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
| 4231 if (exceptionState.throwIfNeeded()) | 4241 if (exceptionState.throwIfNeeded()) |
| 4232 return; | 4242 return; |
| 4233 if (!result) | 4243 if (!result) |
| 4234 return; | 4244 return; |
| 4235 v8SetReturnValueInt(info, v8::None); | 4245 v8SetReturnValueInt(info, v8::None); |
| 4236 } | 4246 } |
| 4237 | 4247 |
| 4238 END | 4248 END |
| 4239 } | 4249 } |
| (...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6458 if ($parameter->type eq "SerializedScriptValue") { | 6468 if ($parameter->type eq "SerializedScriptValue") { |
| 6459 return 1; | 6469 return 1; |
| 6460 } elsif (IsIntegerType($parameter->type)) { | 6470 } elsif (IsIntegerType($parameter->type)) { |
| 6461 return 1; | 6471 return 1; |
| 6462 } | 6472 } |
| 6463 } | 6473 } |
| 6464 return 0; | 6474 return 0; |
| 6465 } | 6475 } |
| 6466 | 6476 |
| 6467 1; | 6477 1; |
| OLD | NEW |