[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dimich at chromium.org dimich at chromium.org
Wed Apr 7 22:59:33 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit f558283fa5e6e510a98bbeba3efc764250d315ed
Author: dimich at chromium.org <dimich at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 21 18:32:37 2009 +0000

    Fix the crash when a node not in a document receives dispatchEvent.
    https://bugs.webkit.org/show_bug.cgi?id=30611
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    Test: fast/events/dispatch-event-no-document.html
    
    * dom/EventTarget.cpp: Check for scriptExecutionContext() at the moment of dispatchEvent; do nothing if no context.
    (WebCore::EventTarget::dispatchEvent):
    
    LayoutTests:
    
    * fast/events/dispatch-event-no-document-expected.txt: Added.
    * fast/events/dispatch-event-no-document.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49911 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4e8a9b1..fb2f6dc 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-21  Dmitry Titov  <dimich at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Fix the crash when a node not in a document receives dispatchEvent.
+        https://bugs.webkit.org/show_bug.cgi?id=30611
+
+        * fast/events/dispatch-event-no-document-expected.txt: Added.
+        * fast/events/dispatch-event-no-document.html: Added.
+
 2009-10-21  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/events/dispatch-event-no-document-expected.txt b/LayoutTests/fast/events/dispatch-event-no-document-expected.txt
new file mode 100644
index 0000000..ac6bd7a
--- /dev/null
+++ b/LayoutTests/fast/events/dispatch-event-no-document-expected.txt
@@ -0,0 +1,5 @@
+The test verifies that EventTarget with an event listener but without ScriptExecutionContext (not inserted into Document) does not crash during an attempt to dispatch an event. It should just not call the handler. This is what FF 3.5 is also doing.
+
+Test passes if there is no crash, and event is not dispatched.
+
+PASS
diff --git a/LayoutTests/fast/events/dispatch-event-no-document.html b/LayoutTests/fast/events/dispatch-event-no-document.html
new file mode 100644
index 0000000..d3e8482
--- /dev/null
+++ b/LayoutTests/fast/events/dispatch-event-no-document.html
@@ -0,0 +1,26 @@
+<script>
+function handleEvent(message) {
+    document.getElementById("log").innerHTML = "FAIL: " + message + " handled.<br>";
+}
+
+function test() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+    }
+
+    var doctype = document.implementation.createDocumentType(
+        'html',
+        '-//W3C//DTD XHTML 1.0 Strict//EN',
+        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
+    );
+
+    var evt = document.createEvent("Event");
+    evt.initEvent("generic", true, true);
+    doctype.addEventListener("generic", function () { handleEvent("generic")}, false);
+    doctype.dispatchEvent(evt);
+}
+</script>
+<body onload="test()">
+<p>The test verifies that EventTarget with an event listener but without ScriptExecutionContext (not inserted into Document) does not crash during an attempt to dispatch an event. It should just not call the handler. This is what FF 3.5 is also doing.</p>
+<p>Test passes if there is no crash, and event is not dispatched.</p>
+<div id="log">PASS</div>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 038dd79..21318b3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-21  Dmitry Titov  <dimich at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Fix the crash when a node not in a document receives dispatchEvent.
+        https://bugs.webkit.org/show_bug.cgi?id=30611
+
+        Test: fast/events/dispatch-event-no-document.html
+
+        * dom/EventTarget.cpp: Check for scriptExecutionContext() at the moment of dispatchEvent; do nothing if no context.
+        (WebCore::EventTarget::dispatchEvent):
+
 2009-10-21  Adam Langley  <agl at google.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/dom/EventTarget.cpp b/WebCore/dom/EventTarget.cpp
index ceb5221..6259a0b 100644
--- a/WebCore/dom/EventTarget.cpp
+++ b/WebCore/dom/EventTarget.cpp
@@ -232,6 +232,10 @@ bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
         ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
         return false;
     }
+
+    if (!scriptExecutionContext())
+        return false;
+
     return dispatchEvent(event);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list