| 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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 1418 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
| 1419 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($attribute) . "())) {\n"; | 1419 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($attribute) . "())) {\n"; |
| 1420 $code .= " v8SetReturnValueNull(info);\n"; | 1420 $code .= " v8SetReturnValueNull(info);\n"; |
| 1421 $code .= " return;\n"; | 1421 $code .= " return;\n"; |
| 1422 $code .= " }\n"; | 1422 $code .= " }\n"; |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 my $useExceptions = 1 if $attribute->extendedAttributes->{"GetterRaisesExcep
tion"} || $attribute->extendedAttributes->{"RaisesException"}; | 1425 my $useExceptions = 1 if $attribute->extendedAttributes->{"GetterRaisesExcep
tion"} || $attribute->extendedAttributes->{"RaisesException"}; |
| 1426 my $isNullable = $attribute->isNullable; | 1426 my $isNullable = $attribute->isNullable; |
| 1427 if ($useExceptions) { | 1427 if ($useExceptions) { |
| 1428 AddToImplIncludes("core/dom/ExceptionCode.h"); | 1428 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 1429 $code .= " ExceptionCode ec = 0;\n"; | 1429 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 if ($isNullable) { | 1432 if ($isNullable) { |
| 1433 $code .= " bool isNull = false;\n"; | 1433 $code .= " bool isNull = false;\n"; |
| 1434 } | 1434 } |
| 1435 | 1435 |
| 1436 my $returnType = $attribute->type; | 1436 my $returnType = $attribute->type; |
| 1437 my $getterString; | 1437 my $getterString; |
| 1438 | 1438 |
| 1439 if ($getterStringUsesImp) { | 1439 if ($getterStringUsesImp) { |
| 1440 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri
bute); | 1440 my ($functionName, @arguments) = GetterExpression($interfaceName, $attri
bute); |
| 1441 push(@arguments, "isNull") if $isNullable; | 1441 push(@arguments, "isNull") if $isNullable; |
| 1442 push(@arguments, "ec") if $useExceptions; | 1442 push(@arguments, "es") if $useExceptions; |
| 1443 if ($attribute->extendedAttributes->{"ImplementedBy"}) { | 1443 if ($attribute->extendedAttributes->{"ImplementedBy"}) { |
| 1444 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"
}; | 1444 my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"
}; |
| 1445 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); | 1445 my $implementedByImplName = GetImplNameFromImplementedBy($implemente
dBy); |
| 1446 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edByImplName)); | 1446 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
edByImplName)); |
| 1447 unshift(@arguments, "imp") if !$attribute->isStatic; | 1447 unshift(@arguments, "imp") if !$attribute->isStatic; |
| 1448 $functionName = "${implementedByImplName}::${functionName}"; | 1448 $functionName = "${implementedByImplName}::${functionName}"; |
| 1449 } elsif ($attribute->isStatic) { | 1449 } elsif ($attribute->isStatic) { |
| 1450 $functionName = "${implClassName}::${functionName}"; | 1450 $functionName = "${implClassName}::${functionName}"; |
| 1451 } else { | 1451 } else { |
| 1452 $functionName = "imp->${functionName}"; | 1452 $functionName = "imp->${functionName}"; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 if ($isNullable) { | 1475 if ($isNullable) { |
| 1476 $code .= " if (isNull) {\n"; | 1476 $code .= " if (isNull) {\n"; |
| 1477 $code .= " v8SetReturnValueNull(info);\n"; | 1477 $code .= " v8SetReturnValueNull(info);\n"; |
| 1478 $code .= " return;\n"; | 1478 $code .= " return;\n"; |
| 1479 $code .= " }\n"; | 1479 $code .= " }\n"; |
| 1480 } | 1480 } |
| 1481 | 1481 |
| 1482 if ($useExceptions) { | 1482 if ($useExceptions) { |
| 1483 $code .= " if (UNLIKELY(ec)) {\n"; | 1483 if ($useExceptions) { |
| 1484 $code .= " setDOMException(ec, info.GetIsolate());\n"; | 1484 $code .= " if (UNLIKELY(es.throwIfNeeded()))\n"; |
| 1485 $code .= " return;\n"; | 1485 $code .= " return;\n"; |
| 1486 $code .= " };\n"; | 1486 } |
| 1487 | 1487 |
| 1488 if (ExtendedAttributeContains($attribute->extendedAttributes->{"Call
With"}, "ScriptState")) { | 1488 if (ExtendedAttributeContains($attribute->extendedAttributes->{"Call
With"}, "ScriptState")) { |
| 1489 $code .= " if (state.hadException()) {\n"; | 1489 $code .= " if (state.hadException()) {\n"; |
| 1490 $code .= " throwError(state.exception(), info.GetIsolate(
));\n"; | 1490 $code .= " throwError(state.exception(), info.GetIsolate(
));\n"; |
| 1491 $code .= " return;\n"; | 1491 $code .= " return;\n"; |
| 1492 $code .= " }\n"; | 1492 $code .= " }\n"; |
| 1493 } | 1493 } |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 $expression = "v"; | 1496 $expression = "v"; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 } | 1786 } |
| 1787 | 1787 |
| 1788 my $svgNativeType = GetSVGTypeNeedingTearOff($interfaceName); | 1788 my $svgNativeType = GetSVGTypeNeedingTearOff($interfaceName); |
| 1789 if ($svgNativeType) { | 1789 if ($svgNativeType) { |
| 1790 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($interfaceNam
e); | 1790 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($interfaceNam
e); |
| 1791 if ($svgWrappedNativeType =~ /List$/) { | 1791 if ($svgWrappedNativeType =~ /List$/) { |
| 1792 $code .= <<END; | 1792 $code .= <<END; |
| 1793 $svgNativeType* imp = ${v8ClassName}::toNative(info.Holder()); | 1793 $svgNativeType* imp = ${v8ClassName}::toNative(info.Holder()); |
| 1794 END | 1794 END |
| 1795 } else { | 1795 } else { |
| 1796 AddToImplIncludes("core/dom/ExceptionCode.h"); | 1796 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 1797 $code .= " $svgNativeType* wrapper = ${v8ClassName}::toNative(inf
o.Holder());\n"; | 1797 $code .= " $svgNativeType* wrapper = ${v8ClassName}::toNative(inf
o.Holder());\n"; |
| 1798 $code .= " if (wrapper->isReadOnly()) {\n"; | 1798 $code .= " if (wrapper->isReadOnly()) {\n"; |
| 1799 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.
GetIsolate());\n"; | 1799 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.
GetIsolate());\n"; |
| 1800 $code .= " return;\n"; | 1800 $code .= " return;\n"; |
| 1801 $code .= " }\n"; | 1801 $code .= " }\n"; |
| 1802 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; | 1802 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; |
| 1803 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; | 1803 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; |
| 1804 } | 1804 } |
| 1805 } elsif ($attrExt->{"OnProto"}) { | 1805 } elsif ($attrExt->{"OnProto"}) { |
| 1806 $code .= <<END; | 1806 $code .= <<END; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 my $returnType = $attribute->type; | 1870 my $returnType = $attribute->type; |
| 1871 if (IsRefPtrType($returnType) && !GetArrayType($returnType)) { | 1871 if (IsRefPtrType($returnType) && !GetArrayType($returnType)) { |
| 1872 $expression = "WTF::getPtr(" . $expression . ")"; | 1872 $expression = "WTF::getPtr(" . $expression . ")"; |
| 1873 } | 1873 } |
| 1874 | 1874 |
| 1875 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->extendedAt
tributes); | 1875 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->extendedAt
tributes); |
| 1876 | 1876 |
| 1877 my $useExceptions = 1 if $attribute->extendedAttributes->{"SetterRaisesExcep
tion"} || $attribute->extendedAttributes->{"RaisesException"}; | 1877 my $useExceptions = 1 if $attribute->extendedAttributes->{"SetterRaisesExcep
tion"} || $attribute->extendedAttributes->{"RaisesException"}; |
| 1878 | 1878 |
| 1879 if ($useExceptions) { | 1879 if ($useExceptions) { |
| 1880 AddToImplIncludes("core/dom/ExceptionCode.h"); | 1880 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 1881 $code .= " ExceptionCode ec = 0;\n"; | 1881 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 1882 } | 1882 } |
| 1883 | 1883 |
| 1884 if ($interfaceName eq "SVGNumber") { | 1884 if ($interfaceName eq "SVGNumber") { |
| 1885 $code .= " *imp = $expression;\n"; | 1885 $code .= " *imp = $expression;\n"; |
| 1886 } else { | 1886 } else { |
| 1887 if ($attribute->type eq "EventListener") { | 1887 if ($attribute->type eq "EventListener") { |
| 1888 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); | 1888 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); |
| 1889 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | 1889 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
| 1890 if (!InheritsInterface($interface, "Node")) { | 1890 if (!InheritsInterface($interface, "Node")) { |
| 1891 my $attrImplName = GetImplName($attribute); | 1891 my $attrImplName = GetImplName($attribute); |
| 1892 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::e
ventListenerCacheIndex, info.GetIsolate());\n"; | 1892 $code .= " transferHiddenDependency(info.Holder(), imp->${att
rImplName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::e
ventListenerCacheIndex, info.GetIsolate());\n"; |
| 1893 } | 1893 } |
| 1894 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 1894 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
| 1895 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalSc
ope") and $attribute->name eq "onerror") { | 1895 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalSc
ope") and $attribute->name eq "onerror") { |
| 1896 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); | 1896 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); |
| 1897 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(inf
o.GetIsolate()));\n"; | 1897 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::findOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(inf
o.GetIsolate()));\n"; |
| 1898 } else { | 1898 } else { |
| 1899 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(
info.GetIsolate()));\n"; | 1899 $code .= " imp->set$implSetterFunctionName(V8EventListenerLis
t::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(
info.GetIsolate()));\n"; |
| 1900 } | 1900 } |
| 1901 } else { | 1901 } else { |
| 1902 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); | 1902 my ($functionName, @arguments) = SetterExpression($interfaceName, $a
ttribute); |
| 1903 push(@arguments, $expression); | 1903 push(@arguments, $expression); |
| 1904 push(@arguments, "ec") if $useExceptions; | 1904 push(@arguments, "es") if $useExceptions; |
| 1905 if ($attribute->extendedAttributes->{"ImplementedBy"}) { | 1905 if ($attribute->extendedAttributes->{"ImplementedBy"}) { |
| 1906 my $implementedBy = $attribute->extendedAttributes->{"Implemente
dBy"}; | 1906 my $implementedBy = $attribute->extendedAttributes->{"Implemente
dBy"}; |
| 1907 my $implementedByImplName = GetImplNameFromImplementedBy($implem
entedBy); | 1907 my $implementedByImplName = GetImplNameFromImplementedBy($implem
entedBy); |
| 1908 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedByImplName)); | 1908 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $imple
mentedByImplName)); |
| 1909 unshift(@arguments, "imp") if !$attribute->isStatic; | 1909 unshift(@arguments, "imp") if !$attribute->isStatic; |
| 1910 $functionName = "${implementedByImplName}::${functionName}"; | 1910 $functionName = "${implementedByImplName}::${functionName}"; |
| 1911 } elsif ($attribute->isStatic) { | 1911 } elsif ($attribute->isStatic) { |
| 1912 $functionName = "${implClassName}::${functionName}"; | 1912 $functionName = "${implClassName}::${functionName}"; |
| 1913 } else { | 1913 } else { |
| 1914 $functionName = "imp->${functionName}"; | 1914 $functionName = "imp->${functionName}"; |
| 1915 } | 1915 } |
| 1916 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttribute
s->{"SetterCallWith"} || $attribute->extendedAttributes->{"CallWith"}, " ", 1
); | 1916 my ($arg, $subCode) = GenerateCallWith($attribute->extendedAttribute
s->{"SetterCallWith"} || $attribute->extendedAttributes->{"CallWith"}, " ", 1
); |
| 1917 $code .= $subCode; | 1917 $code .= $subCode; |
| 1918 unshift(@arguments, @$arg); | 1918 unshift(@arguments, @$arg); |
| 1919 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; | 1919 $code .= " ${functionName}(" . join(", ", @arguments) . ");\n"; |
| 1920 } | 1920 } |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 if ($useExceptions) { | 1923 if ($useExceptions) { |
| 1924 $code .= " if (UNLIKELY(ec))\n"; | 1924 $code .= " es.throwIfNeeded();\n"; |
| 1925 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 1926 } | 1925 } |
| 1927 | 1926 |
| 1928 if (ExtendedAttributeContains($attribute->extendedAttributes->{"CallWith"},
"ScriptState")) { | 1927 if (ExtendedAttributeContains($attribute->extendedAttributes->{"CallWith"},
"ScriptState")) { |
| 1929 $code .= " if (state.hadException())\n"; | 1928 $code .= " if (state.hadException())\n"; |
| 1930 $code .= " throwError(state.exception(), info.GetIsolate());\n"; | 1929 $code .= " throwError(state.exception(), info.GetIsolate());\n"; |
| 1931 } | 1930 } |
| 1932 | 1931 |
| 1933 if ($svgNativeType) { | 1932 if ($svgNativeType) { |
| 1934 if ($useExceptions) { | 1933 if ($useExceptions) { |
| 1935 $code .= " if (!ec)\n"; | 1934 $code .= " if (!es.hadException())\n"; |
| 1936 $code .= " wrapper->commitChange();\n"; | 1935 $code .= " wrapper->commitChange();\n"; |
| 1937 } else { | 1936 } else { |
| 1938 $code .= " wrapper->commitChange();\n"; | 1937 $code .= " wrapper->commitChange();\n"; |
| 1939 } | 1938 } |
| 1940 } | 1939 } |
| 1941 | 1940 |
| 1942 if ($attribute->type eq "SerializedScriptValue" && $attribute->extendedAttri
butes->{"CachedAttribute"}) { | 1941 if ($attribute->type eq "SerializedScriptValue" && $attribute->extendedAttri
butes->{"CachedAttribute"}) { |
| 1943 $code .= <<END; | 1942 $code .= <<END; |
| 1944 info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("${attrName}")); // I
nvalidate the cached value. | 1943 info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("${attrName}")); // I
nvalidate the cached value. |
| 1945 END | 1944 END |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 return; | 2195 return; |
| 2197 } | 2196 } |
| 2198 | 2197 |
| 2199 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); | 2198 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); |
| 2200 | 2199 |
| 2201 if ($svgNativeType) { | 2200 if ($svgNativeType) { |
| 2202 my $nativeClassName = GetNativeType($interfaceName); | 2201 my $nativeClassName = GetNativeType($interfaceName); |
| 2203 if ($interfaceName =~ /List$/) { | 2202 if ($interfaceName =~ /List$/) { |
| 2204 $code .= " $nativeClassName imp = ${v8ClassName}::toNative(args.H
older());\n"; | 2203 $code .= " $nativeClassName imp = ${v8ClassName}::toNative(args.H
older());\n"; |
| 2205 } else { | 2204 } else { |
| 2206 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2205 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2207 $code .= " $nativeClassName wrapper = ${v8ClassName}::toNative(ar
gs.Holder());\n"; | 2206 $code .= " $nativeClassName wrapper = ${v8ClassName}::toNative(ar
gs.Holder());\n"; |
| 2208 $code .= " if (wrapper->isReadOnly()) {\n"; | 2207 $code .= " if (wrapper->isReadOnly()) {\n"; |
| 2209 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.
GetIsolate());\n"; | 2208 $code .= " setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.
GetIsolate());\n"; |
| 2210 $code .= " return;\n"; | 2209 $code .= " return;\n"; |
| 2211 $code .= " }\n"; | 2210 $code .= " }\n"; |
| 2212 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($interfac
eName); | 2211 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($interfac
eName); |
| 2213 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; | 2212 $code .= " $svgWrappedNativeType& impInstance = wrapper->property
Reference();\n"; |
| 2214 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; | 2213 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; |
| 2215 } | 2214 } |
| 2216 } elsif (!$function->isStatic) { | 2215 } elsif (!$function->isStatic) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2235 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; | 2234 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; |
| 2236 if (!$raisesExceptions) { | 2235 if (!$raisesExceptions) { |
| 2237 foreach my $parameter (@{$function->parameters}) { | 2236 foreach my $parameter (@{$function->parameters}) { |
| 2238 if ($parameter->extendedAttributes->{"IsIndex"}) { | 2237 if ($parameter->extendedAttributes->{"IsIndex"}) { |
| 2239 $raisesExceptions = 1; | 2238 $raisesExceptions = 1; |
| 2240 } | 2239 } |
| 2241 } | 2240 } |
| 2242 } | 2241 } |
| 2243 | 2242 |
| 2244 if ($raisesExceptions) { | 2243 if ($raisesExceptions) { |
| 2245 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2244 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2246 $code .= " ExceptionCode ec = 0;\n"; | 2245 $code .= " ExceptionState es(args.GetIsolate());\n"; |
| 2247 } | 2246 } |
| 2248 | 2247 |
| 2249 if ($function->extendedAttributes->{"CheckSecurityForNode"}) { | 2248 if ($function->extendedAttributes->{"CheckSecurityForNode"}) { |
| 2250 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 2249 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
| 2251 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($function) . "(ec))) {\n"; | 2250 # FIXME: Change to ExceptionState |
| 2251 $code .= " if (!BindingSecurity::shouldAllowAccessToNode(imp->" . Get
ImplName($function) . "(es))) {\n"; |
| 2252 $code .= " v8SetReturnValueNull(args);\n"; | 2252 $code .= " v8SetReturnValueNull(args);\n"; |
| 2253 $code .= " return;\n"; | 2253 $code .= " return;\n"; |
| 2254 $code .= " }\n"; | 2254 $code .= " }\n"; |
| 2255 END | 2255 END |
| 2256 } | 2256 } |
| 2257 | 2257 |
| 2258 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, $forMainWorldSuffix); | 2258 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, $forMainWorldSuffix); |
| 2259 $code .= $parameterCheckString; | 2259 $code .= $parameterCheckString; |
| 2260 | 2260 |
| 2261 # Build the function call string. | 2261 # Build the function call string. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 $parameterCheckString .= $multiLine ? " }\n" : "\n"; | 2353 $parameterCheckString .= $multiLine ? " }\n" : "\n"; |
| 2354 } | 2354 } |
| 2355 | 2355 |
| 2356 my $parameterDefaultPolicy = "DefaultIsUndefined"; | 2356 my $parameterDefaultPolicy = "DefaultIsUndefined"; |
| 2357 my $default = defined $parameter->extendedAttributes->{"Default"} ? $par
ameter->extendedAttributes->{"Default"} : ""; | 2357 my $default = defined $parameter->extendedAttributes->{"Default"} ? $par
ameter->extendedAttributes->{"Default"} : ""; |
| 2358 if ($parameter->isOptional and $default eq "NullString") { | 2358 if ($parameter->isOptional and $default eq "NullString") { |
| 2359 $parameterDefaultPolicy = "DefaultIsNullString"; | 2359 $parameterDefaultPolicy = "DefaultIsNullString"; |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 my $parameterName = $parameter->name; | 2362 my $parameterName = $parameter->name; |
| 2363 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2363 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2364 if (IsCallbackInterface($parameter->type)) { | 2364 if (IsCallbackInterface($parameter->type)) { |
| 2365 my $v8ClassName = "V8" . $parameter->type; | 2365 my $v8ClassName = "V8" . $parameter->type; |
| 2366 AddToImplIncludes("$v8ClassName.h"); | 2366 AddToImplIncludes("$v8ClassName.h"); |
| 2367 if ($parameter->isOptional) { | 2367 if ($parameter->isOptional) { |
| 2368 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $
parameterName;\n"; | 2368 $parameterCheckString .= " RefPtr<" . $parameter->type . "> $
parameterName;\n"; |
| 2369 $parameterCheckString .= " if (args.Length() > $paramIndex &&
!args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"; | 2369 $parameterCheckString .= " if (args.Length() > $paramIndex &&
!args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"; |
| 2370 $parameterCheckString .= " if (!args[$paramIndex]->IsFunc
tion()) {\n"; | 2370 $parameterCheckString .= " if (!args[$paramIndex]->IsFunc
tion()) {\n"; |
| 2371 $parameterCheckString .= " throwTypeError(0, args.Get
Isolate());\n"; | 2371 $parameterCheckString .= " throwTypeError(0, args.Get
Isolate());\n"; |
| 2372 $parameterCheckString .= " return;\n"; | 2372 $parameterCheckString .= " return;\n"; |
| 2373 $parameterCheckString .= " }\n"; | 2373 $parameterCheckString .= " }\n"; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2537 $code .= <<END; | 2537 $code .= <<END; |
| 2538 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v
8::Value>& args) | 2538 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v
8::Value>& args) |
| 2539 { | 2539 { |
| 2540 END | 2540 END |
| 2541 | 2541 |
| 2542 if ($function->overloadedIndex == 0) { | 2542 if ($function->overloadedIndex == 0) { |
| 2543 $code .= GenerateArgumentsCountCheck($function, $interface); | 2543 $code .= GenerateArgumentsCountCheck($function, $interface); |
| 2544 } | 2544 } |
| 2545 | 2545 |
| 2546 if ($raisesExceptions) { | 2546 if ($raisesExceptions) { |
| 2547 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2547 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2548 $code .= " ExceptionCode ec = 0;\n"; | 2548 $code .= " ExceptionState es(args.GetIsolate());\n"; |
| 2549 } | 2549 } |
| 2550 | 2550 |
| 2551 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] | 2551 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] |
| 2552 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); | 2552 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); |
| 2553 $code .= $parameterCheckString; | 2553 $code .= $parameterCheckString; |
| 2554 | 2554 |
| 2555 if ($interface->extendedAttributes->{"ConstructorCallWith"} && $interface->e
xtendedAttributes->{"ConstructorCallWith"} eq "ScriptExecutionContext") { | 2555 if ($interface->extendedAttributes->{"ConstructorCallWith"} && $interface->e
xtendedAttributes->{"ConstructorCallWith"} eq "ScriptExecutionContext") { |
| 2556 push(@beforeArgumentList, "context"); | 2556 push(@beforeArgumentList, "context"); |
| 2557 $code .= <<END; | 2557 $code .= <<END; |
| 2558 | 2558 |
| 2559 ScriptExecutionContext* context = getScriptExecutionContext(); | 2559 ScriptExecutionContext* context = getScriptExecutionContext(); |
| 2560 END | 2560 END |
| 2561 } | 2561 } |
| 2562 | 2562 |
| 2563 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2563 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2564 push(@afterArgumentList, "ec"); | 2564 push(@afterArgumentList, "es"); |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 my @argumentList; | 2567 my @argumentList; |
| 2568 my $index = 0; | 2568 my $index = 0; |
| 2569 foreach my $parameter (@{$function->parameters}) { | 2569 foreach my $parameter (@{$function->parameters}) { |
| 2570 last if $index eq $paramIndex; | 2570 last if $index eq $paramIndex; |
| 2571 if ($replacements{$parameter->name}) { | 2571 if ($replacements{$parameter->name}) { |
| 2572 push(@argumentList, $replacements{$parameter->name}); | 2572 push(@argumentList, $replacements{$parameter->name}); |
| 2573 } else { | 2573 } else { |
| 2574 push(@argumentList, $parameter->name); | 2574 push(@argumentList, $parameter->name); |
| 2575 } | 2575 } |
| 2576 $index++; | 2576 $index++; |
| 2577 } | 2577 } |
| 2578 | 2578 |
| 2579 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr
gumentList); | 2579 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr
gumentList); |
| 2580 $code .= "\n"; | 2580 $code .= "\n"; |
| 2581 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::create(${arg
umentString});\n"; | 2581 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::create(${arg
umentString});\n"; |
| 2582 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; | 2582 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; |
| 2583 | 2583 |
| 2584 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2584 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2585 $code .= " if (ec) {\n"; | 2585 $code .= " if (es.throwIfNeeded())\n"; |
| 2586 $code .= " setDOMException(ec, args.GetIsolate());\n"; | |
| 2587 $code .= " return;\n"; | 2586 $code .= " return;\n"; |
| 2588 $code .= " }\n"; | |
| 2589 } | 2587 } |
| 2590 | 2588 |
| 2591 $code .= <<END; | 2589 $code .= <<END; |
| 2592 | 2590 |
| 2593 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in
fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2591 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::in
fo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); |
| 2594 args.GetReturnValue().Set(wrapper); | 2592 args.GetReturnValue().Set(wrapper); |
| 2595 } | 2593 } |
| 2596 | 2594 |
| 2597 END | 2595 END |
| 2598 $implementation{nameSpaceInternal}->add($code); | 2596 $implementation{nameSpaceInternal}->add($code); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 | 2790 |
| 2793 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp
lClassName} instance | 2791 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp
lClassName} instance |
| 2794 // may end up being the only node in the map and get garbage-collected prema
turely. | 2792 // may end up being the only node in the map and get garbage-collected prema
turely. |
| 2795 toV8(document, args.Holder(), args.GetIsolate()); | 2793 toV8(document, args.Holder(), args.GetIsolate()); |
| 2796 | 2794 |
| 2797 END | 2795 END |
| 2798 | 2796 |
| 2799 $code .= GenerateArgumentsCountCheck($function, $interface); | 2797 $code .= GenerateArgumentsCountCheck($function, $interface); |
| 2800 | 2798 |
| 2801 if ($raisesExceptions) { | 2799 if ($raisesExceptions) { |
| 2802 AddToImplIncludes("core/dom/ExceptionCode.h"); | 2800 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2803 $code .= " ExceptionCode ec = 0;\n"; | 2801 $code .= " ExceptionState es(args.GetIsolate());\n"; |
| 2804 } | 2802 } |
| 2805 | 2803 |
| 2806 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); | 2804 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); |
| 2807 $code .= $parameterCheckString; | 2805 $code .= $parameterCheckString; |
| 2808 | 2806 |
| 2809 push(@beforeArgumentList, "document"); | 2807 push(@beforeArgumentList, "document"); |
| 2810 | 2808 |
| 2811 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2809 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2812 push(@afterArgumentList, "ec"); | 2810 push(@afterArgumentList, "es"); |
| 2813 } | 2811 } |
| 2814 | 2812 |
| 2815 my @argumentList; | 2813 my @argumentList; |
| 2816 my $index = 0; | 2814 my $index = 0; |
| 2817 foreach my $parameter (@{$function->parameters}) { | 2815 foreach my $parameter (@{$function->parameters}) { |
| 2818 last if $index eq $paramIndex; | 2816 last if $index eq $paramIndex; |
| 2819 if ($replacements{$parameter->name}) { | 2817 if ($replacements{$parameter->name}) { |
| 2820 push(@argumentList, $replacements{$parameter->name}); | 2818 push(@argumentList, $replacements{$parameter->name}); |
| 2821 } else { | 2819 } else { |
| 2822 push(@argumentList, $parameter->name); | 2820 push(@argumentList, $parameter->name); |
| 2823 } | 2821 } |
| 2824 $index++; | 2822 $index++; |
| 2825 } | 2823 } |
| 2826 | 2824 |
| 2827 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr
gumentList); | 2825 my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterAr
gumentList); |
| 2828 $code .= "\n"; | 2826 $code .= "\n"; |
| 2829 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::createForJSC
onstructor(${argumentString});\n"; | 2827 $code .= " RefPtr<${implClassName}> impl = ${implClassName}::createForJSC
onstructor(${argumentString});\n"; |
| 2830 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; | 2828 $code .= " v8::Handle<v8::Object> wrapper = args.Holder();\n"; |
| 2831 | 2829 |
| 2832 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { | 2830 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { |
| 2833 $code .= " if (ec) {\n"; | 2831 $code .= " if (es.throwIfNeeded())\n"; |
| 2834 $code .= " setDOMException(ec, args.GetIsolate());\n"; | |
| 2835 $code .= " return;\n"; | 2832 $code .= " return;\n"; |
| 2836 $code .= " }\n"; | |
| 2837 } | 2833 } |
| 2838 | 2834 |
| 2839 $code .= <<END; | 2835 $code .= <<END; |
| 2840 | 2836 |
| 2841 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons
tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); | 2837 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Cons
tructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); |
| 2842 args.GetReturnValue().Set(wrapper); | 2838 args.GetReturnValue().Set(wrapper); |
| 2843 } | 2839 } |
| 2844 | 2840 |
| 2845 END | 2841 END |
| 2846 $implementation{nameSpaceWebCore}->add($code); | 2842 $implementation{nameSpaceWebCore}->add($code); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3240 my $v8ClassName = GetV8ClassName($interface); | 3236 my $v8ClassName = GetV8ClassName($interface); |
| 3241 my $methodName = GetImplName($indexedGetterFunction); | 3237 my $methodName = GetImplName($indexedGetterFunction); |
| 3242 | 3238 |
| 3243 my $returnType = $indexedGetterFunction->type; | 3239 my $returnType = $indexedGetterFunction->type; |
| 3244 my $nativeType = GetNativeType($returnType); | 3240 my $nativeType = GetNativeType($returnType); |
| 3245 my $nativeValue = "element"; | 3241 my $nativeValue = "element"; |
| 3246 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3242 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3247 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3243 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3248 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()",
"info.GetIsolate()", "info", "collection", "", "", "return"); | 3244 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()",
"info.GetIsolate()", "info", "collection", "", "", "return"); |
| 3249 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3245 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3250 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); | 3246 my $methodCallCode = GenerateMethodCallForPropertyGetter($returnType, "eleme
nt", "collection->${methodName}", "index", $raisesExceptions); |
| 3251 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3247 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3252 $getterCode .= "{\n"; | 3248 $getterCode .= "{\n"; |
| 3253 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; | 3249 $getterCode .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"
; |
| 3254 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; | 3250 $getterCode .= " ${implClassName}* collection = ${v8ClassName}::toNative(
info.Holder());\n"; |
| 3255 if ($raisesExceptions) { | 3251 if ($raisesExceptions) { |
| 3256 $getterCode .= " ExceptionCode ec = 0;\n"; | 3252 $getterCode .= " ExceptionState es(info.GetIsolate());\n"; |
| 3257 } | 3253 } |
| 3258 $getterCode .= $methodCallCode . "\n"; | 3254 $getterCode .= $methodCallCode . "\n"; |
| 3259 if ($raisesExceptions) { | 3255 if ($raisesExceptions) { |
| 3260 $getterCode .= " if (ec) {\n"; | 3256 $getterCode .= " if (es.throwIfNeeded())\n"; |
| 3261 $getterCode .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3262 $getterCode .= " return;\n"; | 3257 $getterCode .= " return;\n"; |
| 3263 $getterCode .= " }\n"; | |
| 3264 } | 3258 } |
| 3265 if (IsUnionType($returnType)) { | 3259 if (IsUnionType($returnType)) { |
| 3266 $getterCode .= "${returnJSValueCode}\n"; | 3260 $getterCode .= "${returnJSValueCode}\n"; |
| 3267 $getterCode .= " return;\n"; | 3261 $getterCode .= " return;\n"; |
| 3268 } else { | 3262 } else { |
| 3269 $getterCode .= " if (${isNull})\n"; | 3263 $getterCode .= " if (${isNull})\n"; |
| 3270 $getterCode .= " return;\n"; | 3264 $getterCode .= " return;\n"; |
| 3271 $getterCode .= $returnJSValueCode . "\n"; | 3265 $getterCode .= $returnJSValueCode . "\n"; |
| 3272 } | 3266 } |
| 3273 $getterCode .= "}\n\n"; | 3267 $getterCode .= "}\n\n"; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3340 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3334 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3341 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; | 3335 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; |
| 3342 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; | 3336 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; |
| 3343 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3337 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3344 $code .= "{\n"; | 3338 $code .= "{\n"; |
| 3345 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3339 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3346 $code .= GenerateNativeValueDefinition($indexedSetterFunction, $indexedSette
rFunction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); | 3340 $code .= GenerateNativeValueDefinition($indexedSetterFunction, $indexedSette
rFunction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); |
| 3347 | 3341 |
| 3348 my $extraArguments = ""; | 3342 my $extraArguments = ""; |
| 3349 if ($raisesExceptions) { | 3343 if ($raisesExceptions) { |
| 3350 $code .= " ExceptionCode ec = 0;\n"; | 3344 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 3351 $extraArguments = ", ec"; | 3345 $extraArguments = ", es"; |
| 3352 } | 3346 } |
| 3353 my $passNativeValue = "propertyValue"; | 3347 my $passNativeValue = "propertyValue"; |
| 3354 $passNativeValue .= ".release()" if (IsRefPtrType($type)); | 3348 $passNativeValue .= ".release()" if (IsRefPtrType($type)); |
| 3355 | 3349 |
| 3356 my @conditions = (); | 3350 my @conditions = (); |
| 3357 my @statements = (); | 3351 my @statements = (); |
| 3358 if ($treatNullAs && $treatNullAs ne "NullString") { | 3352 if ($treatNullAs && $treatNullAs ne "NullString") { |
| 3359 push @conditions, "value->IsNull()"; | 3353 push @conditions, "value->IsNull()"; |
| 3360 push @statements, "collection->${treatNullAs}(index$extraArguments);"; | 3354 push @statements, "collection->${treatNullAs}(index$extraArguments);"; |
| 3361 } | 3355 } |
| 3362 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | 3356 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { |
| 3363 push @conditions, "value->IsUndefined()"; | 3357 push @conditions, "value->IsUndefined()"; |
| 3364 push @statements, "collection->${treatUndefinedAs}(index$extraArguments)
;"; | 3358 push @statements, "collection->${treatUndefinedAs}(index$extraArguments)
;"; |
| 3365 } | 3359 } |
| 3366 push @conditions, ""; | 3360 push @conditions, ""; |
| 3367 push @statements, "collection->${methodName}(index, $passNativeValue$extraAr
guments);"; | 3361 push @statements, "collection->${methodName}(index, $passNativeValue$extraAr
guments);"; |
| 3368 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); | 3362 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); |
| 3369 | 3363 |
| 3370 $code .= " if (!result)\n"; | 3364 $code .= " if (!result)\n"; |
| 3371 $code .= " return;\n"; | 3365 $code .= " return;\n"; |
| 3372 if ($raisesExceptions) { | 3366 if ($raisesExceptions) { |
| 3373 $code .= " if (ec) {\n"; | 3367 $code .= " if (es.throwIfNeeded())\n"; |
| 3374 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3375 $code .= " return;\n"; | 3368 $code .= " return;\n"; |
| 3376 $code .= " }\n"; | |
| 3377 } | 3369 } |
| 3378 $code .= " v8SetReturnValue(info, value);\n"; | 3370 $code .= " v8SetReturnValue(info, value);\n"; |
| 3379 $code .= "}\n\n"; | 3371 $code .= "}\n\n"; |
| 3380 $implementation{nameSpaceInternal}->add($code); | 3372 $implementation{nameSpaceInternal}->add($code); |
| 3381 } | 3373 } |
| 3382 | 3374 |
| 3383 sub GenerateImplementationNamedPropertyAccessors | 3375 sub GenerateImplementationNamedPropertyAccessors |
| 3384 { | 3376 { |
| 3385 my $interface = shift; | 3377 my $interface = shift; |
| 3386 | 3378 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3533 $code .= "{\n"; | 3525 $code .= "{\n"; |
| 3534 if ($hasCustom) { | 3526 if ($hasCustom) { |
| 3535 $code .= " ${v8ClassName}::namedPropertyQueryCustom(name, info);\n"; | 3527 $code .= " ${v8ClassName}::namedPropertyQueryCustom(name, info);\n"; |
| 3536 } else { | 3528 } else { |
| 3537 $code .= " ${implClassName}V8Internal::namedPropertyQuery(name, info)
;\n"; | 3529 $code .= " ${implClassName}V8Internal::namedPropertyQuery(name, info)
;\n"; |
| 3538 } | 3530 } |
| 3539 $code .= "}\n\n"; | 3531 $code .= "}\n\n"; |
| 3540 $implementation{nameSpaceInternal}->add($code); | 3532 $implementation{nameSpaceInternal}->add($code); |
| 3541 } | 3533 } |
| 3542 | 3534 |
| 3543 sub GenerateMethodCall | 3535 sub GenerateMethodCallForPropertyGetter |
| 3544 { | 3536 { |
| 3545 my $returnType = shift; # string or UnionType | 3537 my $returnType = shift; # string or UnionType |
| 3546 my $returnName = shift; | 3538 my $returnName = shift; |
| 3547 my $functionExpression = shift; | 3539 my $functionExpression = shift; |
| 3548 my $firstArgument = shift; | 3540 my $firstArgument = shift; |
| 3549 my $raisesExceptions = shift; | 3541 my $raisesExceptions = shift; |
| 3550 | 3542 |
| 3551 my @arguments = (); | 3543 my @arguments = (); |
| 3552 push @arguments, $firstArgument; | 3544 push @arguments, $firstArgument; |
| 3553 if ($raisesExceptions) { | 3545 if ($raisesExceptions) { |
| 3554 push @arguments, "ec"; | 3546 push @arguments, "es"; |
| 3555 } | 3547 } |
| 3556 | 3548 |
| 3557 if (IsUnionType($returnType)) { | 3549 if (IsUnionType($returnType)) { |
| 3558 my $code = ""; | 3550 my $code = ""; |
| 3559 my @extraArguments = (); | 3551 my @extraArguments = (); |
| 3560 for my $i (0..scalar(@{$returnType->unionMemberTypes})-1) { | 3552 for my $i (0..scalar(@{$returnType->unionMemberTypes})-1) { |
| 3561 my $unionMemberType = $returnType->unionMemberTypes->[$i]; | 3553 my $unionMemberType = $returnType->unionMemberTypes->[$i]; |
| 3562 my $nativeType = GetNativeType($unionMemberType); | 3554 my $nativeType = GetNativeType($unionMemberType); |
| 3563 my $unionMemberVariable = $returnName . $i; | 3555 my $unionMemberVariable = $returnName . $i; |
| 3564 my $unionMemberEnabledVariable = $returnName . $i . "Enabled"; | 3556 my $unionMemberEnabledVariable = $returnName . $i . "Enabled"; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3583 my $implClassName = GetImplName($interface); | 3575 my $implClassName = GetImplName($interface); |
| 3584 my $v8ClassName = GetV8ClassName($interface); | 3576 my $v8ClassName = GetV8ClassName($interface); |
| 3585 my $methodName = GetImplName($namedGetterFunction); | 3577 my $methodName = GetImplName($namedGetterFunction); |
| 3586 | 3578 |
| 3587 my $returnType = $namedGetterFunction->type; | 3579 my $returnType = $namedGetterFunction->type; |
| 3588 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3580 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3589 my $nativeValue = "element"; | 3581 my $nativeValue = "element"; |
| 3590 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3582 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3591 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()", "in
fo.GetIsolate()", "info", "collection", "", "", "return"); | 3583 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()", "in
fo.GetIsolate()", "info", "collection", "", "", "return"); |
| 3592 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 3584 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
| 3593 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); | 3585 my $methodCallCode = GenerateMethodCallForPropertyGetter($returnType, "eleme
nt", "collection->${methodName}", "propertyName", $raisesExceptions); |
| 3594 | 3586 |
| 3595 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3587 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3596 $code .= "{\n"; | 3588 $code .= "{\n"; |
| 3597 if (!$namedGetterFunction->extendedAttributes->{"OverrideBuiltins"}) { | 3589 if (!$namedGetterFunction->extendedAttributes->{"OverrideBuiltins"}) { |
| 3598 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 3590 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
| 3599 $code .= " return;\n"; | 3591 $code .= " return;\n"; |
| 3600 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3592 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
| 3601 $code .= " return;\n"; | 3593 $code .= " return;\n"; |
| 3602 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 3594 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
| 3603 $code .= " return;\n"; | 3595 $code .= " return;\n"; |
| 3604 } | 3596 } |
| 3605 $code .= "\n"; | 3597 $code .= "\n"; |
| 3606 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"; | 3598 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"; |
| 3607 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3599 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3608 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; | 3600 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; |
| 3609 if ($raisesExceptions) { | 3601 if ($raisesExceptions) { |
| 3610 $code .= " ExceptionCode ec = 0;\n"; | 3602 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 3611 } | 3603 } |
| 3612 $code .= $methodCallCode . "\n"; | 3604 $code .= $methodCallCode . "\n"; |
| 3613 if ($raisesExceptions) { | 3605 if ($raisesExceptions) { |
| 3614 $code .= " if (ec) {\n"; | 3606 $code .= " if (es.throwIfNeeded())\n"; |
| 3615 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3616 $code .= " return;\n"; | 3607 $code .= " return;\n"; |
| 3617 $code .= " }\n"; | |
| 3618 } | 3608 } |
| 3619 if (IsUnionType($returnType)) { | 3609 if (IsUnionType($returnType)) { |
| 3620 $code .= "${returnJSValueCode}\n"; | 3610 $code .= "${returnJSValueCode}\n"; |
| 3621 $code .= " return;\n"; | 3611 $code .= " return;\n"; |
| 3622 } else { | 3612 } else { |
| 3623 $code .= " if (${isNull})\n"; | 3613 $code .= " if (${isNull})\n"; |
| 3624 $code .= " return;\n"; | 3614 $code .= " return;\n"; |
| 3625 $code .= $returnJSValueCode . "\n"; | 3615 $code .= $returnJSValueCode . "\n"; |
| 3626 } | 3616 } |
| 3627 $code .= "}\n\n"; | 3617 $code .= "}\n\n"; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3676 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3666 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
| 3677 $code .= " return;\n"; | 3667 $code .= " return;\n"; |
| 3678 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; | 3668 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; |
| 3679 $code .= " return;\n"; | 3669 $code .= " return;\n"; |
| 3680 } | 3670 } |
| 3681 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3671 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3682 $code .= GenerateNativeValueDefinition($namedSetterFunction, $namedSetterFun
ction->parameters->[0], "name", "propertyName", "info.GetIsolate()"); | 3672 $code .= GenerateNativeValueDefinition($namedSetterFunction, $namedSetterFun
ction->parameters->[0], "name", "propertyName", "info.GetIsolate()"); |
| 3683 $code .= GenerateNativeValueDefinition($namedSetterFunction, $namedSetterFun
ction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); | 3673 $code .= GenerateNativeValueDefinition($namedSetterFunction, $namedSetterFun
ction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); |
| 3684 my $extraArguments = ""; | 3674 my $extraArguments = ""; |
| 3685 if ($raisesExceptions) { | 3675 if ($raisesExceptions) { |
| 3686 $code .= " ExceptionCode ec = 0;\n"; | 3676 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 3687 $extraArguments = ", ec"; | 3677 $extraArguments = ", es"; |
| 3688 } | 3678 } |
| 3689 | 3679 |
| 3690 my @conditions = (); | 3680 my @conditions = (); |
| 3691 my @statements = (); | 3681 my @statements = (); |
| 3692 if ($treatNullAs && $treatNullAs ne "NullString") { | 3682 if ($treatNullAs && $treatNullAs ne "NullString") { |
| 3693 push @conditions, "value->IsNull()"; | 3683 push @conditions, "value->IsNull()"; |
| 3694 push @statements, "collection->${treatNullAs}(propertyName$extraArgument
s);"; | 3684 push @statements, "collection->${treatNullAs}(propertyName$extraArgument
s);"; |
| 3695 } | 3685 } |
| 3696 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | 3686 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { |
| 3697 push @conditions, "value->IsUndefined()"; | 3687 push @conditions, "value->IsUndefined()"; |
| 3698 push @statements, "collection->${treatUndefinedAs}(propertyName$extraArg
uments);"; | 3688 push @statements, "collection->${treatUndefinedAs}(propertyName$extraArg
uments);"; |
| 3699 } | 3689 } |
| 3700 push @conditions, ""; | 3690 push @conditions, ""; |
| 3701 push @statements, "collection->${methodName}(propertyName, propertyValue$ext
raArguments);"; | 3691 push @statements, "collection->${methodName}(propertyName, propertyValue$ext
raArguments);"; |
| 3702 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); | 3692 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); |
| 3703 | 3693 |
| 3704 $code .= " if (!result)\n"; | 3694 $code .= " if (!result)\n"; |
| 3705 $code .= " return;\n"; | 3695 $code .= " return;\n"; |
| 3706 if ($raisesExceptions) { | 3696 if ($raisesExceptions) { |
| 3707 $code .= " if (ec) {\n"; | 3697 $code .= " if (es.throwIfNeeded())\n"; |
| 3708 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3709 $code .= " return;\n"; | 3698 $code .= " return;\n"; |
| 3710 $code .= " }\n"; | |
| 3711 } | 3699 } |
| 3712 $code .= " v8SetReturnValue(info, value);\n"; | 3700 $code .= " v8SetReturnValue(info, value);\n"; |
| 3713 $code .= "}\n\n"; | 3701 $code .= "}\n\n"; |
| 3714 $implementation{nameSpaceInternal}->add($code); | 3702 $implementation{nameSpaceInternal}->add($code); |
| 3715 } | 3703 } |
| 3716 | 3704 |
| 3717 sub GenerateImplementationIndexedPropertyDeleter | 3705 sub GenerateImplementationIndexedPropertyDeleter |
| 3718 { | 3706 { |
| 3719 my $interface = shift; | 3707 my $interface = shift; |
| 3720 my $indexedDeleterFunction = shift; | 3708 my $indexedDeleterFunction = shift; |
| 3721 my $implClassName = GetImplName($interface); | 3709 my $implClassName = GetImplName($interface); |
| 3722 my $v8ClassName = GetV8ClassName($interface); | 3710 my $v8ClassName = GetV8ClassName($interface); |
| 3723 my $methodName = GetImplName($indexedDeleterFunction); | 3711 my $methodName = GetImplName($indexedDeleterFunction); |
| 3724 | 3712 |
| 3725 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; | 3713 my $raisesExceptions = $indexedDeleterFunction->extendedAttributes->{"Raises
Exception"}; |
| 3726 | 3714 |
| 3727 my $code = "static void indexedPropertyDeleter(unsigned index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; | 3715 my $code = "static void indexedPropertyDeleter(unsigned index, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info)\n"; |
| 3728 $code .= "{\n"; | 3716 $code .= "{\n"; |
| 3729 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3717 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3730 my $extraArguments = ""; | 3718 my $extraArguments = ""; |
| 3731 if ($raisesExceptions) { | 3719 if ($raisesExceptions) { |
| 3732 $code .= " ExceptionCode ec = 0;\n"; | 3720 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 3733 $extraArguments = ", ec"; | 3721 $extraArguments = ", es"; |
| 3734 } | 3722 } |
| 3735 $code .= " bool result = collection->${methodName}(index$extraArguments);
\n"; | 3723 $code .= " bool result = collection->${methodName}(index$extraArguments);
\n"; |
| 3736 if ($raisesExceptions) { | 3724 if ($raisesExceptions) { |
| 3737 $code .= " if (ec) {\n"; | 3725 $code .= " if (es.throwIfNeeded())\n"; |
| 3738 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3739 $code .= " return;\n"; | 3726 $code .= " return;\n"; |
| 3740 $code .= " }\n"; | |
| 3741 } | 3727 } |
| 3742 $code .= " return v8SetReturnValueBool(info, result);\n"; | 3728 $code .= " return v8SetReturnValueBool(info, result);\n"; |
| 3743 $code .= "}\n\n"; | 3729 $code .= "}\n\n"; |
| 3744 $implementation{nameSpaceInternal}->add($code); | 3730 $implementation{nameSpaceInternal}->add($code); |
| 3745 } | 3731 } |
| 3746 | 3732 |
| 3747 sub GenerateImplementationNamedPropertyDeleter | 3733 sub GenerateImplementationNamedPropertyDeleter |
| 3748 { | 3734 { |
| 3749 my $interface = shift; | 3735 my $interface = shift; |
| 3750 my $namedDeleterFunction = shift; | 3736 my $namedDeleterFunction = shift; |
| 3751 my $implClassName = GetImplName($interface); | 3737 my $implClassName = GetImplName($interface); |
| 3752 my $v8ClassName = GetV8ClassName($interface); | 3738 my $v8ClassName = GetV8ClassName($interface); |
| 3753 my $methodName = GetImplName($namedDeleterFunction); | 3739 my $methodName = GetImplName($namedDeleterFunction); |
| 3754 | 3740 |
| 3755 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; | 3741 my $raisesExceptions = $namedDeleterFunction->extendedAttributes->{"RaisesEx
ception"}; |
| 3756 | 3742 |
| 3757 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; | 3743 my $code = "static void namedPropertyDeleter(v8::Local<v8::String> name, con
st v8::PropertyCallbackInfo<v8::Boolean>& info)\n"; |
| 3758 $code .= "{\n"; | 3744 $code .= "{\n"; |
| 3759 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3745 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3760 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; | 3746 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; |
| 3761 my $extraArguments = ""; | 3747 my $extraArguments = ""; |
| 3762 if ($raisesExceptions) { | 3748 if ($raisesExceptions) { |
| 3763 $code .= " ExceptionCode ec = 0;\n"; | 3749 $code .= " ExceptionState es(info.GetIsolate());\n"; |
| 3764 $extraArguments = ", ec"; | 3750 $extraArguments = ", es"; |
| 3765 } | 3751 } |
| 3766 $code .= " bool result = collection->${methodName}(propertyName$extraArgu
ments);\n"; | 3752 $code .= " bool result = collection->${methodName}(propertyName$extraArgu
ments);\n"; |
| 3767 if ($raisesExceptions) { | 3753 if ($raisesExceptions) { |
| 3768 $code .= " if (ec) {\n"; | 3754 $code .= " if (es.throwIfNeeded())\n"; |
| 3769 $code .= " setDOMException(ec, info.GetIsolate());\n"; | |
| 3770 $code .= " return;\n"; | 3755 $code .= " return;\n"; |
| 3771 $code .= " }\n"; | |
| 3772 } | 3756 } |
| 3773 $code .= " return v8SetReturnValueBool(info, result);\n"; | 3757 $code .= " return v8SetReturnValueBool(info, result);\n"; |
| 3774 $code .= "}\n\n"; | 3758 $code .= "}\n\n"; |
| 3775 $implementation{nameSpaceInternal}->add($code); | 3759 $implementation{nameSpaceInternal}->add($code); |
| 3776 } | 3760 } |
| 3777 | 3761 |
| 3778 sub GenerateImplementationNamedPropertyEnumerator | 3762 sub GenerateImplementationNamedPropertyEnumerator |
| 3779 { | 3763 { |
| 3780 my $interface = shift; | 3764 my $interface = shift; |
| 3781 my $implClassName = GetImplName($interface); | 3765 my $implClassName = GetImplName($interface); |
| 3782 my $v8ClassName = GetV8ClassName($interface); | 3766 my $v8ClassName = GetV8ClassName($interface); |
| 3783 | 3767 |
| 3784 $implementation{nameSpaceInternal}->add(<<END); | 3768 $implementation{nameSpaceInternal}->add(<<END); |
| 3785 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 3769 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 3786 { | 3770 { |
| 3787 ExceptionCode ec = 0; | 3771 ExceptionState es(info.GetIsolate()); |
| 3788 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 3772 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); |
| 3789 Vector<String> names; | 3773 Vector<String> names; |
| 3790 collection->namedPropertyEnumerator(names, ec); | 3774 collection->namedPropertyEnumerator(names, es); |
| 3791 if (ec) { | 3775 if (es.throwIfNeeded()) |
| 3792 setDOMException(ec, info.GetIsolate()); | |
| 3793 return; | 3776 return; |
| 3794 } | |
| 3795 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); | 3777 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); |
| 3796 for (size_t i = 0; i < names.size(); ++i) | 3778 for (size_t i = 0; i < names.size(); ++i) |
| 3797 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i],
info.GetIsolate())); | 3779 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i],
info.GetIsolate())); |
| 3798 v8SetReturnValue(info, v8names); | 3780 v8SetReturnValue(info, v8names); |
| 3799 } | 3781 } |
| 3800 | 3782 |
| 3801 END | 3783 END |
| 3802 } | 3784 } |
| 3803 | 3785 |
| 3804 sub GenerateImplementationNamedPropertyQuery | 3786 sub GenerateImplementationNamedPropertyQuery |
| 3805 { | 3787 { |
| 3806 my $interface = shift; | 3788 my $interface = shift; |
| 3807 my $implClassName = GetImplName($interface); | 3789 my $implClassName = GetImplName($interface); |
| 3808 my $v8ClassName = GetV8ClassName($interface); | 3790 my $v8ClassName = GetV8ClassName($interface); |
| 3809 | 3791 |
| 3810 $implementation{nameSpaceInternal}->add(<<END); | 3792 $implementation{nameSpaceInternal}->add(<<END); |
| 3811 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 3793 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 3812 { | 3794 { |
| 3813 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); | 3795 ${implClassName}* collection = ${v8ClassName}::toNative(info.Holder()); |
| 3814 AtomicString propertyName = toWebCoreAtomicString(name); | 3796 AtomicString propertyName = toWebCoreAtomicString(name); |
| 3815 ExceptionCode ec = 0; | 3797 ExceptionState es(info.GetIsolate()); |
| 3816 bool result = collection->namedPropertyQuery(propertyName, ec); | 3798 bool result = collection->namedPropertyQuery(propertyName, es); |
| 3817 if (ec) { | 3799 if (es.throwIfNeeded()) |
| 3818 setDOMException(ec, info.GetIsolate()); | |
| 3819 return; | 3800 return; |
| 3820 } | |
| 3821 if (!result) | 3801 if (!result) |
| 3822 return; | 3802 return; |
| 3823 v8SetReturnValueInt(info, v8::None); | 3803 v8SetReturnValueInt(info, v8::None); |
| 3824 } | 3804 } |
| 3825 | 3805 |
| 3826 END | 3806 END |
| 3827 } | 3807 } |
| 3828 | 3808 |
| 3829 sub GenerateImplementationLegacyCall | 3809 sub GenerateImplementationLegacyCall |
| 3830 { | 3810 { |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4901 $code .= $indent . "}\n"; | 4881 $code .= $indent . "}\n"; |
| 4902 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { | 4882 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { |
| 4903 push @arguments, "$paramName.get()"; | 4883 push @arguments, "$paramName.get()"; |
| 4904 } else { | 4884 } else { |
| 4905 push @arguments, $paramName; | 4885 push @arguments, $paramName; |
| 4906 } | 4886 } |
| 4907 $index++; | 4887 $index++; |
| 4908 } | 4888 } |
| 4909 | 4889 |
| 4910 if ($function->extendedAttributes->{"RaisesException"}) { | 4890 if ($function->extendedAttributes->{"RaisesException"}) { |
| 4911 push @arguments, "ec"; | 4891 push @arguments, "es"; |
| 4912 } | 4892 } |
| 4913 | 4893 |
| 4914 my $functionString = "$functionName(" . join(", ", @arguments) . ")"; | 4894 my $functionString = "$functionName(" . join(", ", @arguments) . ")"; |
| 4915 | 4895 |
| 4916 my $return = "result"; | 4896 my $return = "result"; |
| 4917 my $returnIsRef = IsRefPtrType($returnType); | 4897 my $returnIsRef = IsRefPtrType($returnType); |
| 4918 | 4898 |
| 4919 if ($returnType eq "void") { | 4899 if ($returnType eq "void") { |
| 4920 $code .= $indent . "$functionString;\n"; | 4900 $code .= $indent . "$functionString;\n"; |
| 4921 } elsif (ExtendedAttributeContains($callWith, "ScriptState") or $function->e
xtendedAttributes->{"RaisesException"}) { | 4901 } elsif (ExtendedAttributeContains($callWith, "ScriptState") or $function->e
xtendedAttributes->{"RaisesException"}) { |
| 4922 $code .= $indent . $nativeReturnType . " result = $functionString;\n"; | 4902 $code .= $indent . $nativeReturnType . " result = $functionString;\n"; |
| 4923 } else { | 4903 } else { |
| 4924 # Can inline the function call into the return statement to avoid overhe
ad of using a Ref<> temporary | 4904 # Can inline the function call into the return statement to avoid overhe
ad of using a Ref<> temporary |
| 4925 $return = $functionString; | 4905 $return = $functionString; |
| 4926 $returnIsRef = 0; | 4906 $returnIsRef = 0; |
| 4927 | 4907 |
| 4928 if ($interfaceName eq "SVGTransformList" and IsRefPtrType($returnType))
{ | 4908 if ($interfaceName eq "SVGTransformList" and IsRefPtrType($returnType))
{ |
| 4929 $return = "WTF::getPtr(" . $return . ")"; | 4909 $return = "WTF::getPtr(" . $return . ")"; |
| 4930 } | 4910 } |
| 4931 } | 4911 } |
| 4932 | 4912 |
| 4933 if ($function->extendedAttributes->{"RaisesException"}) { | 4913 if ($function->extendedAttributes->{"RaisesException"}) { |
| 4934 $code .= $indent . "if (UNLIKELY(ec)) {\n"; | 4914 $code .= $indent . "if (es.throwIfNeeded())\n"; |
| 4935 $code .= $indent . " setDOMException(ec, args.GetIsolate());\n"; | |
| 4936 $code .= $indent . " return;\n"; | 4915 $code .= $indent . " return;\n"; |
| 4937 $code .= $indent . "}\n"; | |
| 4938 } | 4916 } |
| 4939 | 4917 |
| 4940 if (ExtendedAttributeContains($callWith, "ScriptState")) { | 4918 if (ExtendedAttributeContains($callWith, "ScriptState")) { |
| 4941 $code .= $indent . "if (state.hadException()) {\n"; | 4919 $code .= $indent . "if (state.hadException()) {\n"; |
| 4942 $code .= $indent . " v8::Local<v8::Value> exception = state.exception
();\n"; | 4920 $code .= $indent . " v8::Local<v8::Value> exception = state.exception
();\n"; |
| 4943 $code .= $indent . " state.clearException();\n"; | 4921 $code .= $indent . " state.clearException();\n"; |
| 4944 $code .= $indent . " throwError(exception, args.GetIsolate());\n"; | 4922 $code .= $indent . " throwError(exception, args.GetIsolate());\n"; |
| 4945 $code .= $indent . " return;\n"; | 4923 $code .= $indent . " return;\n"; |
| 4946 $code .= $indent . "}\n"; | 4924 $code .= $indent . "}\n"; |
| 4947 } | 4925 } |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6054 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 6032 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 6055 $found = 1; | 6033 $found = 1; |
| 6056 } | 6034 } |
| 6057 return 1 if $found; | 6035 return 1 if $found; |
| 6058 }, 0); | 6036 }, 0); |
| 6059 | 6037 |
| 6060 return $found; | 6038 return $found; |
| 6061 } | 6039 } |
| 6062 | 6040 |
| 6063 1; | 6041 1; |
| OLD | NEW |