Changeset 145473 in webkit
- Timestamp:
- Mar 11, 2013 9:22:44 PM (11 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r145464 r145473 1 2013-03-11 James Robinson <jamesr@chromium.org> 2 3 [chromium] Fix flaky timeouts in platform/chromium/events/fast/events/intercept-postmessage.html 4 https://bugs.webkit.org/show_bug.cgi?id=112089 5 6 Reviewed by Adam Barth. 7 8 This test had a few problems. The most serious is it raced a window.postMessage() from an inline <script> in the 9 <head> with the HTML parser processing the rest of the testcase. If the HTML parser yielded before parsing out 10 the <pre id="console">, function recvMsg1 would generate an error accessing the undefined pre. The test also 11 set up a setTimeout with a timeout of 50ms to run after a postMessage handler. There's no need to wait after 12 yielding for a timeout, these events are processed in order. 13 14 * platform/chromium/fast/events/intercept-postmessage.html: 15 1 16 2013-03-11 Adam Barth <abarth@webkit.org> 2 17 -
trunk/LayoutTests/platform/chromium/fast/events/intercept-postmessage.html
r120792 r145473 1 <!DOCTYPE html> 1 2 <html> 2 < head>3 4 5 6 7 8 3 <body><pre id="console"></pre></body> 4 <script> 5 function write(str) { 6 pre = document.getElementById('console'); 7 text = document.createTextNode(str + '\n'); 8 pre.appendChild(text); 9 } 9 10 10 11 12 11 function recvMsg1(e) { 12 write("RECV1"); 13 window.removeEventListener("message", recvMsg1, false); 13 14 14 15 15 if (window.testRunner) 16 testRunner.interceptPostMessage = true; 16 17 17 window.addEventListener("message", recvMsg2, false); 18 window.postMessage("Message 2", "*"); 19 20 // Ensure that we're intercepting postMessages before the origin check 21 window.postMessage("Message 3", "http://example.org"); 18 window.addEventListener("message", recvMsg2, false); 19 window.postMessage("Message 2", "*"); 22 20 23 // We need to call setTimeout here because we intercept the next event. 24 // If this test becomes flaky, you may need to increase this timeout. 25 window.setTimeout("done()", 50); 26 } 27 28 function recvMsg2(e) { 29 write("RECV2"); 30 } 31 32 function done() { 33 if (window.testRunner) 34 window.testRunner.notifyDone(); 35 } 36 37 window.addEventListener("message", recvMsg1, false); 21 // Ensure that we're intercepting postMessages before the origin check 22 window.postMessage("Message 3", "http://example.org"); 38 23 39 24 if (window.testRunner) { 40 window.testRunner.dumpAsText();41 window. testRunner.waitUntilDone();25 // We need to call setTimeout here because we intercept the next event. 26 window.setTimeout(function() { testRunner.notifyDone(); }); 42 27 } 28 } 43 29 44 window.postMessage("Message 1", "*"); 45 </script> 46 </head> 47 <body><pre id="console"></pre></body> 30 function recvMsg2(e) { 31 write("RECV2"); 32 } 33 34 window.addEventListener("message", recvMsg1, false); 35 36 if (window.testRunner) { 37 window.testRunner.dumpAsText(); 38 window.testRunner.waitUntilDone(); 39 } 40 41 window.postMessage("Message 1", "*"); 42 </script> 48 43 </html> 49 44
Note: See TracChangeset
for help on using the changeset viewer.