Title: [115588] trunk
Revision
115588
Author
[email protected]
Date
2012-04-28 18:14:05 -0700 (Sat, 28 Apr 2012)

Log Message

MessagePort must set m_closed to be true at the end of MessagePort::close function
https://bugs.webkit.org/show_bug.cgi?id=85139

Source/WebCore:

In the function MessagePort::close, the "m_closed = true" must be executed at the end, not at the beginning.
Or, the m_entangledChannel->close() will not be executed.
And it resulted in the failure of MS bench mark messagechannel_close.htm.
http://samples.msdn.microsoft.com/ietestcenter/WebWorkers/messagechannel_close.htm

Patch by Li Yin <[email protected]> on 2012-04-28
Reviewed by Kentaro Hara.

Test: fast/events/message-port-close.html

* dom/MessagePort.cpp:
(WebCore::MessagePort::close):

LayoutTests:

Test MessageChannel.port whether can receive message after it is closed.

Patch by Li Yin <[email protected]> on 2012-04-28
Reviewed by Kentaro Hara.

* fast/events/message-port-close-expected.txt: Added.
* fast/events/message-port-close.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115587 => 115588)


--- trunk/LayoutTests/ChangeLog	2012-04-28 23:53:05 UTC (rev 115587)
+++ trunk/LayoutTests/ChangeLog	2012-04-29 01:14:05 UTC (rev 115588)
@@ -1,3 +1,15 @@
+2012-04-28  Li Yin  <[email protected]>
+
+        MessagePort must set m_closed to be true at the end of MessagePort::close function
+        https://bugs.webkit.org/show_bug.cgi?id=85139
+
+        Test MessageChannel.port whether can receive message after it is closed.
+
+        Reviewed by Kentaro Hara.
+
+        * fast/events/message-port-close-expected.txt: Added.
+        * fast/events/message-port-close.html: Added.
+
 2012-04-28  Sam Weinig  <[email protected]>
 
         Add support for the Blob constructor

Added: trunk/LayoutTests/fast/events/message-port-close-expected.txt (0 => 115588)


--- trunk/LayoutTests/fast/events/message-port-close-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/message-port-close-expected.txt	2012-04-29 01:14:05 UTC (rev 115588)
@@ -0,0 +1,7 @@
+Test Closed MessagePort Whether Receive Message Or Not.
+
+Should be a START message, followed with DONE.
+
+START
+DONE
+

Added: trunk/LayoutTests/fast/events/message-port-close.html (0 => 115588)


--- trunk/LayoutTests/fast/events/message-port-close.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/message-port-close.html	2012-04-29 01:14:05 UTC (rev 115588)
@@ -0,0 +1,36 @@
+<body>
+<p>Test Closed MessagePort Whether Receive Message Or Not.</p>
+<p>Should be a START message, followed with DONE.</p>
+<pre id=log></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerHTML += message + "<br>";
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+log("START");
+
+var channel = new MessageChannel;
+channel.port1._onmessage_ = function(evt) {
+    log("Closed port receiving: FAIL. Got Message: " +  evt.data + " after close");
+}
+channel.port1.close();
+channel.port2.postMessage("This message can't be received");
+done();
+
+function done() {
+    // Wait a short period of time to ensure no messages come in from previous tests.
+    setTimeout(function() {
+        log("DONE");
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }, 100);
+}
+
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (115587 => 115588)


--- trunk/Source/WebCore/ChangeLog	2012-04-28 23:53:05 UTC (rev 115587)
+++ trunk/Source/WebCore/ChangeLog	2012-04-29 01:14:05 UTC (rev 115588)
@@ -1,3 +1,20 @@
+2012-04-28  Li Yin  <[email protected]>
+
+        MessagePort must set m_closed to be true at the end of MessagePort::close function
+        https://bugs.webkit.org/show_bug.cgi?id=85139
+
+        In the function MessagePort::close, the "m_closed = true" must be executed at the end, not at the beginning.
+        Or, the m_entangledChannel->close() will not be executed.
+        And it resulted in the failure of MS bench mark messagechannel_close.htm.
+        http://samples.msdn.microsoft.com/ietestcenter/WebWorkers/messagechannel_close.htm
+
+        Reviewed by Kentaro Hara.
+
+        Test: fast/events/message-port-close.html
+
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::close):
+
 2012-04-28  Sam Weinig  <[email protected]>
 
         And again.

Modified: trunk/Source/WebCore/dom/MessagePort.cpp (115587 => 115588)


--- trunk/Source/WebCore/dom/MessagePort.cpp	2012-04-28 23:53:05 UTC (rev 115587)
+++ trunk/Source/WebCore/dom/MessagePort.cpp	2012-04-29 01:14:05 UTC (rev 115588)
@@ -133,10 +133,10 @@
 
 void MessagePort::close()
 {
-    m_closed = true;
     if (!isEntangled())
         return;
     m_entangledChannel->close();
+    m_closed = true;
 }
 
 void MessagePort::entangle(PassOwnPtr<MessagePortChannel> remote)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to