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 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 $code .= "{\n"; | 2461 $code .= "{\n"; |
2462 | 2462 |
2463 # We throw exceptions using 'ExceptionState' for a function if: | 2463 # We throw exceptions using 'ExceptionState' for a function if: |
2464 # - it explicitly claims that exceptions may be raised (or should be if ty
pe checks fail.) | 2464 # - it explicitly claims that exceptions may be raised (or should be if ty
pe checks fail.) |
2465 # - event listeners. | 2465 # - event listeners. |
2466 # - security-checking. | 2466 # - security-checking. |
2467 # - weird SVG stuff. | 2467 # - weird SVG stuff. |
2468 # - takes a parameter that might raise an exception on conversion. | 2468 # - takes a parameter that might raise an exception on conversion. |
2469 # | 2469 # |
2470 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi
stener"; | 2470 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi
stener"; |
| 2471 my $isEventDispatcher = $name eq "dispatchEvent"; |
2471 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri
ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}; | 2472 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri
ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}; |
2472 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; | 2473 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; |
2473 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); | 2474 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); |
2474 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/); | 2475 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/); |
2475 | 2476 |
2476 my $hasExceptionState = $raisesExceptions || $isEventListener || $isSecurity
CheckNecessary || $isNonListSVGType || HasExceptionRaisingParameter($function); | 2477 my $hasExceptionState = $raisesExceptions || $isEventListener || $isSecurity
CheckNecessary || $isNonListSVGType || HasExceptionRaisingParameter($function); |
2477 if ($hasExceptionState) { | 2478 if ($hasExceptionState) { |
2478 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon
text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol
ate());\n"; | 2479 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon
text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol
ate());\n"; |
2479 } | 2480 } |
2480 | 2481 |
2481 if ($isEventListener) { | 2482 if ($isEventListener || $isEventDispatcher) { |
2482 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only"; | |
2483 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; | |
2484 my $hiddenValueAction = ($name eq "addEventListener") ? "addHiddenValueT
oArray" : "removeHiddenValueFromArray"; | |
2485 | |
2486 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 2483 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
2487 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 2484 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
2488 AddToImplIncludes("core/frame/DOMWindow.h"); | 2485 AddToImplIncludes("core/frame/DOMWindow.h"); |
2489 $code .= <<END; | 2486 $code .= <<END; |
2490 EventTarget* impl = ${v8ClassName}::toNative(info.Holder()); | 2487 EventTarget* impl = ${v8ClassName}::toNative(info.Holder()); |
2491 if (DOMWindow* window = impl->toDOMWindow()) { | 2488 if (DOMWindow* window = impl->toDOMWindow()) { |
2492 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { | 2489 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { |
2493 exceptionState.throwIfNeeded(); | 2490 exceptionState.throwIfNeeded(); |
2494 return; | 2491 return; |
2495 } | 2492 } |
2496 if (!window->document()) | 2493 if (!window->document()) |
2497 return; | 2494 return; |
2498 } | 2495 } |
| 2496 END |
| 2497 } |
| 2498 if ($isEventListener) { |
| 2499 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only"; |
| 2500 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; |
| 2501 my $hiddenValueAction = ($name eq "addEventListener") ? "addHiddenValueT
oArray" : "removeHiddenValueFromArray"; |
| 2502 |
| 2503 $code .= <<END; |
2499 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFind${lookupType}); | 2504 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFind${lookupType}); |
2500 if (listener) { | 2505 if (listener) { |
2501 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); | 2506 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); |
2502 impl->${implName}(eventName, listener${passRefPtrHandling}, info[2]->Boo
leanValue()); | 2507 impl->${implName}(eventName, listener${passRefPtrHandling}, info[2]->Boo
leanValue()); |
2503 if (!impl->toNode()) | 2508 if (!impl->toNode()) |
2504 ${hiddenValueAction}(info.Holder(), info[1], ${v8ClassName}::eventLi
stenerCacheIndex, info.GetIsolate()); | 2509 ${hiddenValueAction}(info.Holder(), info[1], ${v8ClassName}::eventLi
stenerCacheIndex, info.GetIsolate()); |
2505 } | 2510 } |
2506 } | 2511 } |
2507 END | 2512 END |
2508 $code .= "#endif // ${conditionalString}\n" if $conditionalString; | 2513 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
(...skipping 3970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6479 if ($parameter->type eq "SerializedScriptValue") { | 6484 if ($parameter->type eq "SerializedScriptValue") { |
6480 return 1; | 6485 return 1; |
6481 } elsif (IsIntegerType($parameter->type)) { | 6486 } elsif (IsIntegerType($parameter->type)) { |
6482 return 1; | 6487 return 1; |
6483 } | 6488 } |
6484 } | 6489 } |
6485 return 0; | 6490 return 0; |
6486 } | 6491 } |
6487 | 6492 |
6488 1; | 6493 1; |
OLD | NEW |