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

Side by Side Diff: Source/core/events/EventTarget.h

Issue 329053002: Throw TypeError when addEventListener or removeEventListener are called without enough arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void deref() { derefEventTarget(); } 79 void deref() { derefEventTarget(); }
80 #endif 80 #endif
81 81
82 virtual const AtomicString& interfaceName() const = 0; 82 virtual const AtomicString& interfaceName() const = 0;
83 virtual ExecutionContext* executionContext() const = 0; 83 virtual ExecutionContext* executionContext() const = 0;
84 84
85 virtual Node* toNode(); 85 virtual Node* toNode();
86 virtual DOMWindow* toDOMWindow(); 86 virtual DOMWindow* toDOMWindow();
87 virtual MessagePort* toMessagePort(); 87 virtual MessagePort* toMessagePort();
88 88
89 // FIXME: first 2 args to addEventListener and removeEventListener should 89 // FIXME: default values should be specified in IDL, not C++
90 // be required (per spec), but throwing TypeError breaks legacy content. 90 // http://crbug.com/258153
91 // http://crbug.com/353484
92 bool addEventListener() { return false; }
93 bool addEventListener(const AtomicString& eventType) { return false; }
94 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false); 91 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false);
95 bool removeEventListener() { return false; }
96 bool removeEventListener(const AtomicString& eventType) { return false; }
97 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false); 92 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false);
98 virtual void removeAllEventListeners(); 93 virtual void removeAllEventListeners();
99 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>); 94 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
100 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>, ExceptionState&); // DOM A PI 95 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>, ExceptionState&); // DOM A PI
101 virtual void uncaughtExceptionInEventHandler(); 96 virtual void uncaughtExceptionInEventHandler();
102 97
103 // Used for legacy "onEvent" attribute APIs. 98 // Used for legacy "onEvent" attribute APIs.
104 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); 99 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
105 EventListener* getAttributeEventListener(const AtomicString& eventType); 100 EventListener* getAttributeEventListener(const AtomicString& eventType);
106 101
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro 231 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
237 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_ TARGET_REFCOUNTING(baseClass) 232 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_ TARGET_REFCOUNTING(baseClass)
238 #endif 233 #endif
239 234
240 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted. 235 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted.
241 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly. 236 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly.
242 // Both of these macros are meant to be placed just before the "public:" section of the class declaration. 237 // Both of these macros are meant to be placed just before the "public:" section of the class declaration.
243 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo untedWillBeRefCountedGarbageCollected<className>) 238 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo untedWillBeRefCountedGarbageCollected<className>)
244 239
245 #endif // EventTarget_h 240 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/node-legacy-event-listener-expected.txt ('k') | Source/core/events/EventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698