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

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

Issue 2598353002: The second argument of add/removeEventListener should be an object, null, or undefined
Patch Set: Fix tests Created 3 years, 11 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/V8EventListenerHelper.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp b/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp
index 198b07f0769d7698112ac98e8e21f05142080d21..d2f24e3b90bc11fbf8e805a43376c67fe26798ee 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp
@@ -40,7 +40,12 @@ EventListener* V8EventListenerHelper::getEventListener(
ScriptState* scriptState,
v8::Local<v8::Value> value,
bool isAttribute,
- ListenerLookupType lookup) {
+ ListenerLookupType lookup,
+ ExceptionState& exceptionState) {
+ if (!isUndefinedOrNull(value) && !value->IsObject()) {
+ exceptionState.throwTypeError("Cannot convert to EventListener.");
+ return nullptr;
+ }
if (lookup == ListenerFindOnly) {
// Used by EventTarget::removeEventListener, specifically
// EventTargetV8Internal::removeEventListenerMethod

Powered by Google App Engine
This is Rietveld 408576698