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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 | 1263 |
1264 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 1264 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
1265 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 1265 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
1266 $implementation{nameSpaceInternal}->add(<<END); | 1266 $implementation{nameSpaceInternal}->add(<<END); |
1267 static void ${implClassName}DomainSafeFunctionSetter(v8::Local<v8::String> name,
v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 1267 static void ${implClassName}DomainSafeFunctionSetter(v8::Local<v8::String> name,
v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
1268 { | 1268 { |
1269 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${
v8ClassName}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); | 1269 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${
v8ClassName}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); |
1270 if (holder.IsEmpty()) | 1270 if (holder.IsEmpty()) |
1271 return; | 1271 return; |
1272 ${implClassName}* imp = ${v8ClassName}::toNative(holder); | 1272 ${implClassName}* imp = ${v8ClassName}::toNative(holder); |
1273 ExceptionState exceptionState(info.GetIsolate()); | 1273 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
1274 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 1274 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
1275 exceptionState.throwIfNeeded(); | 1275 exceptionState.throwIfNeeded(); |
1276 return; | 1276 return; |
1277 } | 1277 } |
1278 | 1278 |
1279 info.This()->SetHiddenValue(name, jsValue); | 1279 info.This()->SetHiddenValue(name, jsValue); |
1280 } | 1280 } |
1281 | 1281 |
1282 END | 1282 END |
1283 } | 1283 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1502 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
1503 END | 1503 END |
1504 } | 1504 } |
1505 } | 1505 } |
1506 | 1506 |
1507 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; | 1507 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; |
1508 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Getter"); | 1508 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Getter"); |
1509 if ($useExceptions || $attribute->extendedAttributes->{"CheckSecurity"}) { | 1509 if ($useExceptions || $attribute->extendedAttributes->{"CheckSecurity"}) { |
1510 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 1510 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
1511 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 1511 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
1512 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 1512 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
1513 } | 1513 } |
1514 | 1514 |
1515 # Generate security checks if necessary | 1515 # Generate security checks if necessary |
1516 if ($attribute->extendedAttributes->{"CheckSecurity"}) { | 1516 if ($attribute->extendedAttributes->{"CheckSecurity"}) { |
1517 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 1517 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
1518 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($attribute) . "(), exceptionState)) {\n"; | 1518 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($attribute) . "(), exceptionState)) {\n"; |
1519 $code .= " v8SetReturnValueNull(info);\n"; | 1519 $code .= " v8SetReturnValueNull(info);\n"; |
1520 $code .= " exceptionState.throwIfNeeded();\n"; | 1520 $code .= " exceptionState.throwIfNeeded();\n"; |
1521 $code .= " return;\n"; | 1521 $code .= " return;\n"; |
1522 $code .= " }\n"; | 1522 $code .= " }\n"; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 | 1771 |
1772 my $code = ""; | 1772 my $code = ""; |
1773 $code .= <<END; | 1773 $code .= <<END; |
1774 static void ${implClassName}ReplaceableAttributeSetter(v8::Local<v8::String> nam
e, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 1774 static void ${implClassName}ReplaceableAttributeSetter(v8::Local<v8::String> nam
e, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
1775 { | 1775 { |
1776 END | 1776 END |
1777 if ($interface->extendedAttributes->{"CheckSecurity"}) { | 1777 if ($interface->extendedAttributes->{"CheckSecurity"}) { |
1778 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 1778 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
1779 $code .= <<END; | 1779 $code .= <<END; |
1780 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1780 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
1781 ExceptionState exceptionState(info.GetIsolate()); | 1781 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
1782 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 1782 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
1783 exceptionState.throwIfNeeded(); | 1783 exceptionState.throwIfNeeded(); |
1784 return; | 1784 return; |
1785 } | 1785 } |
1786 END | 1786 END |
1787 } | 1787 } |
1788 | 1788 |
1789 $code .= <<END; | 1789 $code .= <<END; |
1790 info.This()->ForceSet(name, jsValue); | 1790 info.This()->ForceSet(name, jsValue); |
1791 } | 1791 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 END | 2005 END |
2006 $expression = $expression . "->propertyReference()"; | 2006 $expression = $expression . "->propertyReference()"; |
2007 } | 2007 } |
2008 | 2008 |
2009 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; | 2009 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; |
2010 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Setter"); | 2010 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Setter"); |
2011 | 2011 |
2012 if ($useExceptions) { | 2012 if ($useExceptions) { |
2013 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2013 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
2014 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2014 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2015 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 2015 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
2016 } | 2016 } |
2017 | 2017 |
2018 if ($attribute->type eq "EventHandler") { | 2018 if ($attribute->type eq "EventHandler") { |
2019 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"}; | 2019 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"}; |
2020 my $implementedByImplName; | 2020 my $implementedByImplName; |
2021 if ($implementedBy) { | 2021 if ($implementedBy) { |
2022 $implementedByImplName = GetImplNameFromImplementedBy($implementedBy
); | 2022 $implementedByImplName = GetImplNameFromImplementedBy($implementedBy
); |
2023 } | 2023 } |
2024 if (!InheritsInterface($interface, "Node")) { | 2024 if (!InheritsInterface($interface, "Node")) { |
2025 my $attrImplName = GetImplName($attribute); | 2025 my $attrImplName = GetImplName($attribute); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; | 2308 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; |
2309 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" :
"remove"; | 2309 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" :
"remove"; |
2310 | 2310 |
2311 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 2311 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
2312 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2312 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2313 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 2313 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
2314 AddToImplIncludes("core/frame/DOMWindow.h"); | 2314 AddToImplIncludes("core/frame/DOMWindow.h"); |
2315 $code .= <<END; | 2315 $code .= <<END; |
2316 EventTarget* impl = ${v8ClassName}::toNative(info.Holder()); | 2316 EventTarget* impl = ${v8ClassName}::toNative(info.Holder()); |
2317 if (DOMWindow* window = impl->toDOMWindow()) { | 2317 if (DOMWindow* window = impl->toDOMWindow()) { |
2318 ExceptionState exceptionState(info.GetIsolate()); | 2318 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
2319 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio
nState)) { | 2319 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio
nState)) { |
2320 exceptionState.throwIfNeeded(); | 2320 exceptionState.throwIfNeeded(); |
2321 return; | 2321 return; |
2322 } | 2322 } |
2323 if (!window->document()) | 2323 if (!window->document()) |
2324 return; | 2324 return; |
2325 } | 2325 } |
2326 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFind${lookupType}); | 2326 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFind${lookupType}); |
2327 if (listener) { | 2327 if (listener) { |
2328 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); | 2328 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 2375 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
2376 END | 2376 END |
2377 } | 2377 } |
2378 | 2378 |
2379 $code .= GenerateCustomElementInvocationScopeIfNeeded($funcExt); | 2379 $code .= GenerateCustomElementInvocationScopeIfNeeded($funcExt); |
2380 | 2380 |
2381 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} ||
($interface->extendedAttributes->{"CheckSecurity"} && !$function->extendedAttri
butes->{"DoNotCheckSecurity"}); | 2381 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} ||
($interface->extendedAttributes->{"CheckSecurity"} && !$function->extendedAttri
butes->{"DoNotCheckSecurity"}); |
2382 if ($raisesExceptions) { | 2382 if ($raisesExceptions) { |
2383 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2383 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
2384 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2384 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2385 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 2385 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
2386 } | 2386 } |
2387 | 2387 |
2388 # Check domain security if needed | 2388 # Check domain security if needed |
2389 if ($interface->extendedAttributes->{"CheckSecurity"} && !$function->extende
dAttributes->{"DoNotCheckSecurity"}) { | 2389 if ($interface->extendedAttributes->{"CheckSecurity"} && !$function->extende
dAttributes->{"DoNotCheckSecurity"}) { |
2390 # We have not find real use cases yet. | 2390 # We have not find real use cases yet. |
2391 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 2391 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
2392 $code .= <<END; | 2392 $code .= <<END; |
2393 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 2393 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
2394 exceptionState.throwIfNeeded(); | 2394 exceptionState.throwIfNeeded(); |
2395 return; | 2395 return; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 { | 2702 { |
2703 END | 2703 END |
2704 | 2704 |
2705 if ($function->overloadedIndex == 0) { | 2705 if ($function->overloadedIndex == 0) { |
2706 $code .= GenerateArgumentsCountCheck($function, $interface); | 2706 $code .= GenerateArgumentsCountCheck($function, $interface); |
2707 } | 2707 } |
2708 | 2708 |
2709 if ($raisesExceptions) { | 2709 if ($raisesExceptions) { |
2710 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2710 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
2711 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2711 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2712 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 2712 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
2713 } | 2713 } |
2714 | 2714 |
2715 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] | 2715 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] |
2716 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); | 2716 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); |
2717 $code .= $parameterCheckString; | 2717 $code .= $parameterCheckString; |
2718 | 2718 |
2719 if ($interface->extendedAttributes->{"ConstructorCallWith"}) { | 2719 if ($interface->extendedAttributes->{"ConstructorCallWith"}) { |
2720 if ($interface->extendedAttributes->{"ConstructorCallWith"} eq "Executio
nContext") { | 2720 if ($interface->extendedAttributes->{"ConstructorCallWith"} eq "Executio
nContext") { |
2721 push(@beforeArgumentList, "context"); | 2721 push(@beforeArgumentList, "context"); |
2722 $code .= "\n"; | 2722 $code .= "\n"; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 // may end up being the only node in the map and get garbage-collected prema
turely. | 2992 // may end up being the only node in the map and get garbage-collected prema
turely. |
2993 toV8(document, info.Holder(), info.GetIsolate()); | 2993 toV8(document, info.Holder(), info.GetIsolate()); |
2994 | 2994 |
2995 END | 2995 END |
2996 | 2996 |
2997 $code .= GenerateArgumentsCountCheck($function, $interface); | 2997 $code .= GenerateArgumentsCountCheck($function, $interface); |
2998 | 2998 |
2999 if ($raisesExceptions) { | 2999 if ($raisesExceptions) { |
3000 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 3000 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
3001 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 3001 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
3002 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3002 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3003 } | 3003 } |
3004 | 3004 |
3005 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); | 3005 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); |
3006 $code .= $parameterCheckString; | 3006 $code .= $parameterCheckString; |
3007 | 3007 |
3008 push(@beforeArgumentList, "*document"); | 3008 push(@beforeArgumentList, "*document"); |
3009 | 3009 |
3010 if ($constructorRaisesException) { | 3010 if ($constructorRaisesException) { |
3011 push(@afterArgumentList, "exceptionState"); | 3011 push(@afterArgumentList, "exceptionState"); |
3012 } | 3012 } |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3496 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3496 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
3497 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3497 my $isNull = GenerateIsNullExpression($returnType, "element"); |
3498 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "collection", "", "return"); | 3498 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.GetIsolate
()", "info", "collection", "", "return"); |
3499 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3499 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
3500 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); | 3500 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); |
3501 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3501 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
3502 $getterCode .= "{\n"; | 3502 $getterCode .= "{\n"; |
3503 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; | 3503 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; |
3504 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; | 3504 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; |
3505 if ($raisesExceptions) { | 3505 if ($raisesExceptions) { |
3506 $getterCode .= " ExceptionState exceptionState(info.GetIsolate());\n"
; | 3506 $getterCode .= " ExceptionState exceptionState(info.Holder(), info.Ge
tIsolate());\n"; |
3507 } | 3507 } |
3508 $getterCode .= $methodCallCode . "\n"; | 3508 $getterCode .= $methodCallCode . "\n"; |
3509 if ($raisesExceptions) { | 3509 if ($raisesExceptions) { |
3510 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; | 3510 $getterCode .= " if (exceptionState.throwIfNeeded())\n"; |
3511 $getterCode .= " return;\n"; | 3511 $getterCode .= " return;\n"; |
3512 } | 3512 } |
3513 if (IsUnionType($returnType)) { | 3513 if (IsUnionType($returnType)) { |
3514 $getterCode .= "${returnJSValueCode}\n"; | 3514 $getterCode .= "${returnJSValueCode}\n"; |
3515 $getterCode .= " return;\n"; | 3515 $getterCode .= " return;\n"; |
3516 } else { | 3516 } else { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3596 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; | 3596 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; |
3597 my $asSetterValue = 0; | 3597 my $asSetterValue = 0; |
3598 | 3598 |
3599 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3599 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
3600 $code .= "{\n"; | 3600 $code .= "{\n"; |
3601 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3601 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3602 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); | 3602 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); |
3603 | 3603 |
3604 my $extraArguments = ""; | 3604 my $extraArguments = ""; |
3605 if ($raisesExceptions) { | 3605 if ($raisesExceptions) { |
3606 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3606 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3607 $extraArguments = ", exceptionState"; | 3607 $extraArguments = ", exceptionState"; |
3608 } | 3608 } |
3609 my @conditions = (); | 3609 my @conditions = (); |
3610 my @statements = (); | 3610 my @statements = (); |
3611 if ($treatNullAs && $treatNullAs ne "NullString") { | 3611 if ($treatNullAs && $treatNullAs ne "NullString") { |
3612 push @conditions, "jsValue->IsNull()"; | 3612 push @conditions, "jsValue->IsNull()"; |
3613 push @statements, "collection->${treatNullAs}(index$extraArguments);"; | 3613 push @statements, "collection->${treatNullAs}(index$extraArguments);"; |
3614 } | 3614 } |
3615 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | 3615 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { |
3616 push @conditions, "jsValue->IsUndefined()"; | 3616 push @conditions, "jsValue->IsUndefined()"; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3861 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3861 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
3862 $code .= " return;\n"; | 3862 $code .= " return;\n"; |
3863 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 3863 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
3864 $code .= " return;\n"; | 3864 $code .= " return;\n"; |
3865 } | 3865 } |
3866 $code .= "\n"; | 3866 $code .= "\n"; |
3867 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"; | 3867 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"; |
3868 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3868 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3869 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; | 3869 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; |
3870 if ($raisesExceptions) { | 3870 if ($raisesExceptions) { |
3871 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3871 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3872 } | 3872 } |
3873 $code .= $methodCallCode . "\n"; | 3873 $code .= $methodCallCode . "\n"; |
3874 if ($raisesExceptions) { | 3874 if ($raisesExceptions) { |
3875 $code .= " if (exceptionState.throwIfNeeded())\n"; | 3875 $code .= " if (exceptionState.throwIfNeeded())\n"; |
3876 $code .= " return;\n"; | 3876 $code .= " return;\n"; |
3877 } | 3877 } |
3878 if (IsUnionType($returnType)) { | 3878 if (IsUnionType($returnType)) { |
3879 $code .= "${returnJSValueCode}\n"; | 3879 $code .= "${returnJSValueCode}\n"; |
3880 $code .= " return;\n"; | 3880 $code .= " return;\n"; |
3881 } else { | 3881 } else { |
(...skipping 26 matching lines...) Expand all Loading... |
3908 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3908 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
3909 $code .= " return;\n"; | 3909 $code .= " return;\n"; |
3910 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 3910 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
3911 $code .= " return;\n"; | 3911 $code .= " return;\n"; |
3912 } | 3912 } |
3913 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3913 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3914 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); | 3914 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); |
3915 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); | 3915 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); |
3916 my $extraArguments = ""; | 3916 my $extraArguments = ""; |
3917 if ($raisesExceptions) { | 3917 if ($raisesExceptions) { |
3918 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3918 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3919 $extraArguments = ", exceptionState"; | 3919 $extraArguments = ", exceptionState"; |
3920 } | 3920 } |
3921 | 3921 |
3922 my @conditions = (); | 3922 my @conditions = (); |
3923 my @statements = (); | 3923 my @statements = (); |
3924 if ($treatNullAs && $treatNullAs ne "NullString") { | 3924 if ($treatNullAs && $treatNullAs ne "NullString") { |
3925 push @conditions, "jsValue->IsNull()"; | 3925 push @conditions, "jsValue->IsNull()"; |
3926 push @statements, "collection->${treatNullAs}(propertyName$extraArgument
s);"; | 3926 push @statements, "collection->${treatNullAs}(propertyName$extraArgument
s);"; |
3927 } | 3927 } |
3928 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | 3928 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { |
(...skipping 23 matching lines...) Expand all Loading... |
3952 my $v8ClassName = GetV8ClassName($interface); | 3952 my $v8ClassName = GetV8ClassName($interface); |
3953 my $methodName = GetImplName($indexedDeleterFunction); | 3953 my $methodName = GetImplName($indexedDeleterFunction); |
3954 | 3954 |
3955 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; | 3955 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; |
3956 | 3956 |
3957 my $code = "static void indexedPropertyDeleter(unsigned index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; | 3957 my $code = "static void indexedPropertyDeleter(unsigned index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; |
3958 $code .= "{\n"; | 3958 $code .= "{\n"; |
3959 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3959 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3960 my $extraArguments = ""; | 3960 my $extraArguments = ""; |
3961 if ($raisesExceptions) { | 3961 if ($raisesExceptions) { |
3962 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3962 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3963 $extraArguments = ", exceptionState"; | 3963 $extraArguments = ", exceptionState"; |
3964 } | 3964 } |
3965 $code .= " bool result = collection->${methodName}(index$extraArguments);
\n"; | 3965 $code .= " bool result = collection->${methodName}(index$extraArguments);
\n"; |
3966 if ($raisesExceptions) { | 3966 if ($raisesExceptions) { |
3967 $code .= " if (exceptionState.throwIfNeeded())\n"; | 3967 $code .= " if (exceptionState.throwIfNeeded())\n"; |
3968 $code .= " return;\n"; | 3968 $code .= " return;\n"; |
3969 } | 3969 } |
3970 $code .= " return v8SetReturnValueBool(info, result);\n"; | 3970 $code .= " return v8SetReturnValueBool(info, result);\n"; |
3971 $code .= "}\n\n"; | 3971 $code .= "}\n\n"; |
3972 $implementation{nameSpaceInternal}->add($code); | 3972 $implementation{nameSpaceInternal}->add($code); |
3973 } | 3973 } |
3974 | 3974 |
3975 sub GenerateImplementationNamedPropertyDeleter | 3975 sub GenerateImplementationNamedPropertyDeleter |
3976 { | 3976 { |
3977 my $interface = shift; | 3977 my $interface = shift; |
3978 my $namedDeleterFunction = shift; | 3978 my $namedDeleterFunction = shift; |
3979 my $implClassName = GetImplName($interface); | 3979 my $implClassName = GetImplName($interface); |
3980 my $v8ClassName = GetV8ClassName($interface); | 3980 my $v8ClassName = GetV8ClassName($interface); |
3981 my $methodName = GetImplName($namedDeleterFunction); | 3981 my $methodName = GetImplName($namedDeleterFunction); |
3982 | 3982 |
3983 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; | 3983 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; |
3984 | 3984 |
3985 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; | 3985 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; |
3986 $code .= "{\n"; | 3986 $code .= "{\n"; |
3987 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3987 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3988 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; | 3988 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; |
3989 my $extraArguments = ""; | 3989 my $extraArguments = ""; |
3990 if ($raisesExceptions) { | 3990 if ($raisesExceptions) { |
3991 $code .= " ExceptionState exceptionState(info.GetIsolate());\n"; | 3991 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3992 $extraArguments = ", exceptionState"; | 3992 $extraArguments = ", exceptionState"; |
3993 } | 3993 } |
3994 $code .= " bool result = collection->${methodName}(propertyName$extraArgu
ments);\n"; | 3994 $code .= " bool result = collection->${methodName}(propertyName$extraArgu
ments);\n"; |
3995 if ($raisesExceptions) { | 3995 if ($raisesExceptions) { |
3996 $code .= " if (exceptionState.throwIfNeeded())\n"; | 3996 $code .= " if (exceptionState.throwIfNeeded())\n"; |
3997 $code .= " return;\n"; | 3997 $code .= " return;\n"; |
3998 } | 3998 } |
3999 $code .= " return v8SetReturnValueBool(info, result);\n"; | 3999 $code .= " return v8SetReturnValueBool(info, result);\n"; |
4000 $code .= "}\n\n"; | 4000 $code .= "}\n\n"; |
4001 $implementation{nameSpaceInternal}->add($code); | 4001 $implementation{nameSpaceInternal}->add($code); |
4002 } | 4002 } |
4003 | 4003 |
4004 sub GenerateImplementationNamedPropertyEnumerator | 4004 sub GenerateImplementationNamedPropertyEnumerator |
4005 { | 4005 { |
4006 my $interface = shift; | 4006 my $interface = shift; |
4007 my $implClassName = GetImplName($interface); | 4007 my $implClassName = GetImplName($interface); |
4008 my $v8ClassName = GetV8ClassName($interface); | 4008 my $v8ClassName = GetV8ClassName($interface); |
4009 | 4009 |
4010 $implementation{nameSpaceInternal}->add(<<END); | 4010 $implementation{nameSpaceInternal}->add(<<END); |
4011 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 4011 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
4012 { | 4012 { |
4013 ExceptionState exceptionState(info.GetIsolate()); | 4013 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
4014 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 4014 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); |
4015 Vector<String> names; | 4015 Vector<String> names; |
4016 collection->namedPropertyEnumerator(names, exceptionState); | 4016 collection->namedPropertyEnumerator(names, exceptionState); |
4017 if (exceptionState.throwIfNeeded()) | 4017 if (exceptionState.throwIfNeeded()) |
4018 return; | 4018 return; |
4019 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); | 4019 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); |
4020 for (size_t i = 0; i < names.size(); ++i) | 4020 for (size_t i = 0; i < names.size(); ++i) |
4021 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i],
info.GetIsolate())); | 4021 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i],
info.GetIsolate())); |
4022 v8SetReturnValue(info, v8names); | 4022 v8SetReturnValue(info, v8names); |
4023 } | 4023 } |
4024 | 4024 |
4025 END | 4025 END |
4026 } | 4026 } |
4027 | 4027 |
4028 sub GenerateImplementationNamedPropertyQuery | 4028 sub GenerateImplementationNamedPropertyQuery |
4029 { | 4029 { |
4030 my $interface = shift; | 4030 my $interface = shift; |
4031 my $implClassName = GetImplName($interface); | 4031 my $implClassName = GetImplName($interface); |
4032 my $v8ClassName = GetV8ClassName($interface); | 4032 my $v8ClassName = GetV8ClassName($interface); |
4033 | 4033 |
4034 $implementation{nameSpaceInternal}->add(<<END); | 4034 $implementation{nameSpaceInternal}->add(<<END); |
4035 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 4035 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
4036 { | 4036 { |
4037 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 4037 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); |
4038 AtomicString propertyName = toWebCoreAtomicString(name); | 4038 AtomicString propertyName = toWebCoreAtomicString(name); |
4039 ExceptionState exceptionState(info.GetIsolate()); | 4039 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
4040 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 4040 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
4041 if (exceptionState.throwIfNeeded()) | 4041 if (exceptionState.throwIfNeeded()) |
4042 return; | 4042 return; |
4043 if (!result) | 4043 if (!result) |
4044 return; | 4044 return; |
4045 v8SetReturnValueInt(info, v8::None); | 4045 v8SetReturnValueInt(info, v8::None); |
4046 } | 4046 } |
4047 | 4047 |
4048 END | 4048 END |
4049 } | 4049 } |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6268 my $interface = shift; | 6268 my $interface = shift; |
6269 | 6269 |
6270 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6270 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
6271 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6271 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
6272 return 1 if InheritsInterface($interface, "Document"); | 6272 return 1 if InheritsInterface($interface, "Document"); |
6273 | 6273 |
6274 return 0; | 6274 return 0; |
6275 } | 6275 } |
6276 | 6276 |
6277 1; | 6277 1; |
OLD | NEW |