test_promise_and_timeout_ordering.html (680B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for promise and timeout ordering</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <script> 8 /* global async_test, assert_equals */ 9 var t = async_test("Promise callbacks should run immediately after the setTimeout handler that enqueues them"); 10 var origPostMessage = window.postMessage; 11 window.postMessage = function(msg) { origPostMessage.call(window, msg, "*"); }; 12 window.onmessage = t.step_func_done(function(e) { 13 assert_equals(e.data, "t1start, t1end, promise, t2"); 14 }); 15 </script> 16 <script src="file_promise_and_timeout_ordering.js"></script>