Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp

Issue 1956733002: Remove EventListenerOptions runtime enable setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_add_event_listener_options
Patch Set: Amend unit tests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
index 4b20d29d37f0eefaf89a5594407c74b220254557..58c4eda0d27edc83ff765145abf9e92d9d900b41 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
@@ -36,9 +36,8 @@
#include "core/frame/UseCounter.h"
namespace blink {
-namespace {
-void addEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
+void V8EventTarget::addEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
{
if (info.Length() >= 3 && info[2]->IsObject()) {
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()),
@@ -51,13 +50,13 @@ void addEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Val
}
}
-void addEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
+void V8EventTarget::addEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
{
if (info.Length() >= 2 && info[1]->IsObject() && !impl->toNode())
addHiddenValueToArray(info.GetIsolate(), info.Holder(), info[1], V8EventTarget::eventListenerCacheIndex);
}
-void removeEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
+void V8EventTarget::removeEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
{
if (info.Length() >= 3 && info[2]->IsObject()) {
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()),
@@ -70,82 +69,10 @@ void removeEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::
}
}
-void removeEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
+void V8EventTarget::removeEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
{
if (info.Length() >= 2 && info[1]->IsObject() && !impl->toNode())
removeHiddenValueFromArray(info.GetIsolate(), info.Holder(), info[1], V8EventTarget::eventListenerCacheIndex);
}
-} // namespace
-
-void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- ExceptionState exceptionState(ExceptionState::ExecutionContext, "addEventListener", "EventTarget", info.Holder(), info.GetIsolate());
- if (UNLIKELY(info.Length() < 2)) {
- setMinimumArityTypeError(exceptionState, 2, info.Length());
- exceptionState.throwIfNeeded();
- return;
- }
- EventTarget* impl = V8EventTarget::toImpl(info.Holder());
- if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
- exceptionState.throwIfNeeded();
- return;
- }
- V8StringResource<> type = info[0];
- if (!type.prepare())
- return;
- EventListener* listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOrCreate);
- AddEventListenerOptionsOrBoolean options;
- // TODO(dtapuska): This custom binding code can be eliminated once
- // EventListenerOptions runtime enabled feature is removed.
- // http://crbug.com/545163
- if (UNLIKELY(info.Length() <= 2) || isUndefinedOrNull(info[2])) {
- addEventListenerMethodPrologueCustom(info, impl);
- impl->addEventListener(type, listener);
- addEventListenerMethodEpilogueCustom(info, impl);
- return;
- }
- V8AddEventListenerOptionsOrBoolean::toImpl(info.GetIsolate(), info[2], options, UnionTypeConversionMode::NotNullable, exceptionState);
- if (exceptionState.throwIfNeeded())
- return;
- addEventListenerMethodPrologueCustom(info, impl);
- impl->addEventListener(type, listener, options);
- addEventListenerMethodEpilogueCustom(info, impl);
-}
-
-void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeEventListener", "EventTarget", info.Holder(), info.GetIsolate());
- if (UNLIKELY(info.Length() < 2)) {
- setMinimumArityTypeError(exceptionState, 2, info.Length());
- exceptionState.throwIfNeeded();
- return;
- }
- EventTarget* impl = V8EventTarget::toImpl(info.Holder());
- if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
- exceptionState.throwIfNeeded();
- return;
- }
- V8StringResource<> type = info[0];
- if (!type.prepare())
- return;
- EventListener* listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOnly);
- EventListenerOptionsOrBoolean options;
- // TODO(dtapuska): This custom binding code can be eliminated once
- // EventListenerOptions runtime enabled feature is removed.
- // http://crbug.com/545163
- if (UNLIKELY(info.Length() <= 2) || isUndefinedOrNull(info[2])) {
- removeEventListenerMethodPrologueCustom(info, impl);
- impl->removeEventListener(type, listener);
- removeEventListenerMethodEpilogueCustom(info, impl);
- return;
- }
- V8EventListenerOptionsOrBoolean::toImpl(info.GetIsolate(), info[2], options, UnionTypeConversionMode::NotNullable, exceptionState);
- if (exceptionState.throwIfNeeded())
- return;
- removeEventListenerMethodPrologueCustom(info, impl);
- impl->removeEventListener(type, listener, options);
- removeEventListenerMethodEpilogueCustom(info, impl);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698