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

Unified Diff: LayoutTests/fast/events/message-port-start-and-close-different-microtask.html

Issue 720543005: Fix MessagePort race exposed by blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test descriptions which had got mixed up. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/message-port-start-and-close-different-microtask-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/message-port-start-and-close-different-microtask.html
diff --git a/LayoutTests/fast/events/message-port-close.html b/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html
similarity index 50%
copy from LayoutTests/fast/events/message-port-close.html
copy to LayoutTests/fast/events/message-port-start-and-close-different-microtask.html
index 0dabcd830f60b1ba2cd64a5034db250616fb1fd5..ca440fe80c38464ffd3a89f64068ff691651d2f5 100644
--- a/LayoutTests/fast/events/message-port-close.html
+++ b/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html
@@ -1,6 +1,6 @@
<body>
-<p>Test Closed MessagePort Whether Receive Message Or Not.</p>
-<p>Should be a START message, followed with DONE.</p>
+<p>Test whether opening and closing a messageport in different microtasks correctly receives an in-flight message.</p>
+<p>Should be a START message, followed by a HELLO message then DONE.</p>
<pre id=log></pre>
<script>
function log(message)
@@ -16,13 +16,21 @@ if (window.testRunner) {
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");
+channel.port2.postMessage("HELLO");
+openThenPostClose();
done();
+function openThenPostClose() {
+ setTimeout(function() {
+ channel.port1.onmessage = function(evt) {
+ log("PASS. Got Message: " + evt.data + " before close");
+ }
+ setTimeout(function() {
+ channel.port1.close();
+ }, 0);
+ }, 0);
+}
+
function done() {
// Wait a short period of time to ensure no messages come in from previous tests.
setTimeout(function() {
« no previous file with comments | « no previous file | LayoutTests/fast/events/message-port-start-and-close-different-microtask-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698