Commit 2984d4f5 authored by ggaren@apple.com's avatar ggaren@apple.com

WebCore: Removed some vestigial and potentially crashy code that makes consolidating

event listeners hard.

Patch by Geoffrey Garen <ggaren@apple.com> on 2009-09-16
Reviewed by Sam Weinig and Anders Carlsson.

* dom/Node.cpp:
(WebCore::Node::addEventListener): No need to limit when event listeners
can be added. Other EventTargets don't do this.
        
Also, check for null when accessing document(). Technically, the JS bindings
do this check for us, but let's not rely on that.

LayoutTests: Added a test for a potential crash when adding an event listener to a
doctype node.

Patch by Geoffrey Garen <ggaren@apple.com> on 2009-09-16
Reviewed by Sam Weinig.

* fast/dom/doctype-event-listener-crash-expected.txt: Added.
* fast/dom/doctype-event-listener-crash.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f62d0642
2009-09-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Added a test for a potential crash when adding an event listener to a
doctype node.
* fast/dom/doctype-event-listener-crash-expected.txt: Added.
* fast/dom/doctype-event-listener-crash.html: Added.
2009-09-16 Beth Dakin <bdakin@apple.com>
Reviewed by Darin Adler.
......
This page tests for a crash when adding an event listener to a doctype node.
If the test passes, you'll see a PASS message below.
PASS: You didn't crash.
<p>This page tests for a crash when adding an event listener to a doctype node.</p>
<p>If the test passes, you'll see a PASS message below.</p>
<pre>PASS: You didn't crash.</pre>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var doctype = document.implementation.createDocumentType("html", 0, 0);
doctype.addEventListener("click", function () { }, false);
</script>
2009-09-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig and Anders Carlsson.
Removed some vestigial and potentially crashy code that makes consolidating
event listeners hard.
* dom/Node.cpp:
(WebCore::Node::addEventListener): No need to limit when event listeners
can be added. Other EventTargets don't do this.
Also, check for null when accessing document(). Technically, the JS bindings
do this check for us, but let's not rely on that.
2009-09-16 Anders Carlsson <andersca@apple.com>
Reviewed by Adam Roben.
......@@ -2401,11 +2401,8 @@ static inline void updateSVGElementInstancesAfterEventListenerChange(Node* refer
void Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
{
Document* document = this->document();
if (!document->attached())
return;
document->addListenerTypeIfNeeded(eventType);
if (Document* document = this->document())
document->addListenerTypeIfNeeded(eventType);
RegisteredEventListenerVector& listeners = ensureRareData()->ensureListeners();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment