| Index: Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
|
| diff --git a/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp b/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
|
| index b221b20afdedb32dec2913cc1621ff9485c0e3d5..24d991c8458b9c491ac6ff440b5a3a15803829ec 100644
|
| --- a/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
|
| +++ b/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
|
| @@ -34,6 +34,7 @@
|
| #include "bindings/core/v8/BindingSecurity.h"
|
| #include "bindings/core/v8/V8EventListenerList.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| +#include "core/frame/UseCounter.h"
|
|
|
| namespace blink {
|
|
|
| @@ -46,6 +47,13 @@ static void addEventListenerMethodEpilogue(const v8::FunctionCallbackInfo<v8::Va
|
| void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "addEventListener", "EventTarget", info.Holder(), info.GetIsolate());
|
| + if (UNLIKELY(info.Length() < 2)) {
|
| + // TODO(philipj): Remove the custom bindings when usage allows. The
|
| + // generated bindings would thrown here instead. crbug.com/353484
|
| + UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
|
| + info.Length() == 0 ? UseCounter::AddEventListenerNoArguments : UseCounter::AddEventListenerOneArgument);
|
| + return;
|
| + }
|
| EventTarget* impl = V8EventTarget::toImpl(info.Holder());
|
| if (LocalDOMWindow* window = impl->toDOMWindow()) {
|
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| @@ -59,20 +67,10 @@ void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<
|
| RefPtr<EventListener> listener;
|
| bool capture;
|
| {
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->addEventListener();
|
| - addEventListenerMethodEpilogue(info, impl);
|
| - return;
|
| - }
|
| type = info[0];
|
| if (!type.prepare())
|
| return;
|
| listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOrCreate);
|
| - if (UNLIKELY(info.Length() <= 2)) {
|
| - impl->addEventListener(type, listener);
|
| - addEventListenerMethodEpilogue(info, impl);
|
| - return;
|
| - }
|
| capture = toBoolean(info.GetIsolate(), info[2], exceptionState);
|
| if (exceptionState.throwIfNeeded())
|
| return;
|
| @@ -90,6 +88,13 @@ static void removeEventListenerMethodEpilogue(const v8::FunctionCallbackInfo<v8:
|
| void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeEventListener", "EventTarget", info.Holder(), info.GetIsolate());
|
| + if (UNLIKELY(info.Length() < 2)) {
|
| + // TODO(philipj): Remove the custom bindings when usage allows. The
|
| + // generated bindings would thrown here instead. crbug.com/353484
|
| + UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
|
| + info.Length() == 0 ? UseCounter::RemoveEventListenerNoArguments : UseCounter::RemoveEventListenerOneArgument);
|
| + return;
|
| + }
|
| EventTarget* impl = V8EventTarget::toImpl(info.Holder());
|
| if (LocalDOMWindow* window = impl->toDOMWindow()) {
|
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| @@ -103,20 +108,10 @@ void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackIn
|
| RefPtr<EventListener> listener;
|
| bool capture;
|
| {
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->removeEventListener();
|
| - removeEventListenerMethodEpilogue(info, impl);
|
| - return;
|
| - }
|
| type = info[0];
|
| if (!type.prepare())
|
| return;
|
| listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOnly);
|
| - if (UNLIKELY(info.Length() <= 2)) {
|
| - impl->removeEventListener(type, listener);
|
| - removeEventListenerMethodEpilogue(info, impl);
|
| - return;
|
| - }
|
| capture = toBoolean(info.GetIsolate(), info[2], exceptionState);
|
| if (exceptionState.throwIfNeeded())
|
| return;
|
|
|