[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

dimich at chromium.org dimich at chromium.org
Thu Oct 29 20:44:07 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 6bf78f8a7f1ae33c89f62604343674fc4345faa1
Author: dimich at chromium.org <dimich at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 14 01:15:53 2009 +0000

    https://bugs.webkit.org/show_bug.cgi?id=30318
    ScriptExecutionContext is not anymore needed to create an EventListener - remove old code.
    It's a followup to r48884. It removed the need to pass the ScritpExecutionContext
    into EventListener constructor but did not remove the code pulling ScriptExecutionContext.
    
    Reviewed by Alexey Proskuryakov.
    
    WebCore:
    
    Tests:
    Test adds event listener to a DocumentType Node which is created without a document
    and then dispatches the event after attaching a node to the tree. Event
    should fire when node is attached to the tree.
    
    * fast/events/add-event-without-document-expected.txt: Added.
    * fast/events/add-event-without-document.html: Added.
    
    All changes in files below are the same - remove the code that calls
    EventTarget::scriptExecutionContext and checks it for NULL.
    
    * bindings/js/JSAbstractWorkerCustom.cpp:
    (WebCore::JSAbstractWorker::addEventListener):
    (WebCore::JSAbstractWorker::removeEventListener):
    * bindings/js/JSDOMApplicationCacheCustom.cpp:
    (WebCore::JSDOMApplicationCache::addEventListener):
    (WebCore::JSDOMApplicationCache::removeEventListener):
    * bindings/js/JSDesktopNotificationsCustom.cpp:
    (WebCore::JSNotification::addEventListener):
    (WebCore::):
    * bindings/js/JSEventSourceCustom.cpp:
    (WebCore::JSEventSource::addEventListener):
    (WebCore::JSEventSource::removeEventListener):
    * bindings/js/JSMessagePortCustom.cpp:
    (WebCore::JSMessagePort::addEventListener):
    (WebCore::JSMessagePort::removeEventListener):
    * bindings/js/JSNodeCustom.cpp:
    (WebCore::JSNode::addEventListener):
    (WebCore::JSNode::removeEventListener):
    * bindings/js/JSSVGElementInstanceCustom.cpp:
    (WebCore::JSSVGElementInstance::addEventListener):
    (WebCore::JSSVGElementInstance::removeEventListener):
    * bindings/js/JSXMLHttpRequestCustom.cpp:
    (WebCore::JSXMLHttpRequest::addEventListener):
    (WebCore::JSXMLHttpRequest::removeEventListener):
    * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
    (WebCore::JSXMLHttpRequestUpload::addEventListener):
    (WebCore::JSXMLHttpRequestUpload::removeEventListener):
    * bindings/js/JSWebSocketCustom.cpp:
    (WebCore::JSWebSocket::addEventListener):
    (WebCore::JSWebSocket::removeEventListener):
    
    LayoutTests:
    
    Test adds event listener to a DocumentType Node which is created without a document
    and then dispatches the event after attaching a node to the tree. Event
    should fire when node is attached to the tree.
    
    * fast/events/add-event-without-document-expected.txt: Added.
    * fast/events/add-event-without-document.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49539 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7d93a11..8449a98 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-13  Dmitry Titov  <dimich at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30318
+        ScriptExecutionContext is not anymore needed to create an EventListener - remove old code.
+        It's a followup to r48884. It removed the need to pass the ScritpExecutionContext
+        into EventListener constructor but did not remove the code pulling ScriptExecutionContext.
+
+        Test adds event listener to a DocumentType Node which is created without a document
+        and then dispatches the event after attaching a node to the tree. Event
+        should fire when node is attached to the tree.
+
+        * fast/events/add-event-without-document-expected.txt: Added.
+        * fast/events/add-event-without-document.html: Added.
+
 2009-10-13  Brian Weinstein  <bweinstein at apple.com>
 
         Rubber-stamped by Jon Honeycutt.
diff --git a/LayoutTests/fast/events/add-event-without-document-expected.txt b/LayoutTests/fast/events/add-event-without-document-expected.txt
new file mode 100644
index 0000000..9670405
--- /dev/null
+++ b/LayoutTests/fast/events/add-event-without-document-expected.txt
@@ -0,0 +1,9 @@
+The test verifies that addEventListener works on EventTargets that do not have ScriptExecutionContext at the moment of call. The event listener should be added, and later invoked when the Context is established. This matches behavior of FF 3.5
+
+The only way to simulate this is to use createDocumentType() which creates a Node with NULL Document. Then we insert it into the tree so it gains a pointer to Document and dispatch the event which should fire.
+
+We use manually-constructed event instead just watching for DOM mutation event on insert since DOM mutation events are not dispatched on doctype element.
+
+Test passes if there is 'PASS' text below.
+
+PASS
diff --git a/LayoutTests/fast/events/add-event-without-document.html b/LayoutTests/fast/events/add-event-without-document.html
new file mode 100644
index 0000000..b96e91d
--- /dev/null
+++ b/LayoutTests/fast/events/add-event-without-document.html
@@ -0,0 +1,36 @@
+<script>
+function onClick() {
+    document.getElementById("log").innerHTML = "PASS";
+    if (window.layoutTestController) {
+        layoutTestController.notifyDone();
+    }
+}
+
+function test() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    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("HTMLEvents");
+    evt.initEvent("click", false, false);
+
+    doctype.addEventListener('click', onClick, false);
+
+    // Doctype node can only be inserted before <html>. 
+    document.insertBefore(doctype, document.getElementsByTagName("html")[0]);
+    doctype.dispatchEvent(evt);
+}
+</script>
+<body onload="test()">
+<p>The test verifies that addEventListener works on EventTargets that do not have ScriptExecutionContext at the moment of call. The event listener should be added, and later invoked when the Context is established. This matches behavior of FF 3.5</p>
+<p>The only way to simulate this is to use createDocumentType() which creates a Node with NULL Document. Then we insert it into the tree so it gains a pointer to Document and dispatch the event which should fire.</p>
+<p>We use manually-constructed event instead just watching for DOM mutation event on insert since DOM mutation events are not dispatched on doctype element.</p>
+<p>Test passes if there is 'PASS' text below.</p>
+<div id="log">FAIL</div>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index baf8e0a..32d56ec 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,54 @@
+2009-10-13  Dmitry Titov  <dimich at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30318
+        ScriptExecutionContext is not anymore needed to create an EventListener - remove old code.
+        It's a followup to r48884. It removed the need to pass the ScritpExecutionContext
+        into EventListener constructor but did not remove the code pulling ScriptExecutionContext.
+
+        Tests:
+        Test adds event listener to a DocumentType Node which is created without a document
+        and then dispatches the event after attaching a node to the tree. Event
+        should fire when node is attached to the tree.
+
+        * fast/events/add-event-without-document-expected.txt: Added.
+        * fast/events/add-event-without-document.html: Added.
+
+        All changes in files below are the same - remove the code that calls
+        EventTarget::scriptExecutionContext and checks it for NULL.
+
+        * bindings/js/JSAbstractWorkerCustom.cpp:
+        (WebCore::JSAbstractWorker::addEventListener):
+        (WebCore::JSAbstractWorker::removeEventListener):
+        * bindings/js/JSDOMApplicationCacheCustom.cpp:
+        (WebCore::JSDOMApplicationCache::addEventListener):
+        (WebCore::JSDOMApplicationCache::removeEventListener):
+        * bindings/js/JSDesktopNotificationsCustom.cpp:
+        (WebCore::JSNotification::addEventListener):
+        (WebCore::):
+        * bindings/js/JSEventSourceCustom.cpp:
+        (WebCore::JSEventSource::addEventListener):
+        (WebCore::JSEventSource::removeEventListener):
+        * bindings/js/JSMessagePortCustom.cpp:
+        (WebCore::JSMessagePort::addEventListener):
+        (WebCore::JSMessagePort::removeEventListener):
+        * bindings/js/JSNodeCustom.cpp:
+        (WebCore::JSNode::addEventListener):
+        (WebCore::JSNode::removeEventListener):
+        * bindings/js/JSSVGElementInstanceCustom.cpp:
+        (WebCore::JSSVGElementInstance::addEventListener):
+        (WebCore::JSSVGElementInstance::removeEventListener):
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::addEventListener):
+        (WebCore::JSXMLHttpRequest::removeEventListener):
+        * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
+        (WebCore::JSXMLHttpRequestUpload::addEventListener):
+        (WebCore::JSXMLHttpRequestUpload::removeEventListener):
+        * bindings/js/JSWebSocketCustom.cpp:
+        (WebCore::JSWebSocket::addEventListener):
+        (WebCore::JSWebSocket::removeEventListener):
+
 2009-10-13  Drew Wilson  <atwilson at atwilson-macpro.local>
 
         Reviewed by David Levin.
diff --git a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
index 9411ad8..a6cbd91 100644
--- a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
+++ b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
@@ -46,10 +46,6 @@ namespace WebCore {
 
 JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -60,10 +56,6 @@ JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
index 49ef5e3..8634589 100644
--- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
@@ -87,10 +87,6 @@ JSValue JSDOMApplicationCache::remove(ExecState* exec, const ArgList& args)
 
 JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -101,10 +97,6 @@ JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList&
 
 JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
index 493d7bd..9bff637 100644
--- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
+++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
@@ -63,29 +63,21 @@ JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList&
 
 JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
 
-    impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener)), globalObject, false), args.at(2).toBoolean(exec));
+    impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener)), false), args.at(2).toBoolean(exec));
     return jsUndefined();
 }
 
 JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
 
-    impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+    impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
     return jsUndefined();
 }
 
diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp
index 404bf11..00dfe12 100644
--- a/WebCore/bindings/js/JSEventSourceCustom.cpp
+++ b/WebCore/bindings/js/JSEventSourceCustom.cpp
@@ -45,10 +45,6 @@ namespace WebCore {
 
 JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -59,10 +55,6 @@ JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp
index 210c93e..a0a92be 100644
--- a/WebCore/bindings/js/JSMessagePortCustom.cpp
+++ b/WebCore/bindings/js/JSMessagePortCustom.cpp
@@ -57,10 +57,6 @@ void JSMessagePort::markChildren(MarkStack& markStack)
 
 JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -71,10 +67,6 @@ JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp
index 52f21e7..4e7d622 100644
--- a/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/WebCore/bindings/js/JSNodeCustom.cpp
@@ -110,14 +110,6 @@ JSValue JSNode::appendChild(ExecState* exec, const ArgList& args)
 
 JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
 {
-    Document* document = impl()->document();
-    if (!document)
-        return jsUndefined();
-        
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(document);
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -128,14 +120,6 @@ JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    Document* document = impl()->document();
-    if (!document)
-        return jsUndefined();
-
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(document);
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
index 571e302..fd3742d 100644
--- a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
@@ -50,10 +50,6 @@ void JSSVGElementInstance::markChildren(MarkStack& markStack)
 
 JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -64,10 +60,6 @@ JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& a
 
 JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp
index e434cb0..bea3563 100644
--- a/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -62,10 +62,6 @@ JSValue JSWebSocket::send(ExecState* exec, const ArgList& args)
 
 JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -76,10 +72,6 @@ JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSWebSocket::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 4b44db2..7d3f8af 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -152,10 +152,6 @@ JSValue JSXMLHttpRequest::overrideMimeType(ExecState* exec, const ArgList& args)
 
 JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -166,10 +162,6 @@ JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args)
 
 JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
diff --git a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
index dab0a3e..275d1fb 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
@@ -56,10 +56,6 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack)
 
 JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();
@@ -70,10 +66,6 @@ JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList&
 
 JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgList& args)
 {
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
-    if (!globalObject)
-        return jsUndefined();
-
     JSValue listener = args.at(1);
     if (!listener.isObject())
         return jsUndefined();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list