OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <title>shared worker with multiple documents</title> |
| 3 <script src="/resources/testharness.js"></script> |
| 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <div id=log></div> |
| 6 <script> |
| 7 var i = 0; |
| 8 var load_count = 0; |
| 9 |
| 10 var w1 = new SharedWorker('004-2.js', 'x'); |
| 11 w1.port.onmessage = function(e) { |
| 12 i++; |
| 13 check_result(); |
| 14 }; |
| 15 |
| 16 |
| 17 function iframe_loaded() { |
| 18 load_count++; |
| 19 check_result(); |
| 20 } |
| 21 |
| 22 function check_result() { |
| 23 //timeout to allow for extra, unexpected, messages to arrive |
| 24 if (i == 3 && load_count == 2) { |
| 25 setTimeout(function() { |
| 26 assert_equals(load_count, 2); |
| 27 assert_equals(i, 3); |
| 28 done(); |
| 29 }, 500); |
| 30 } |
| 31 } |
| 32 </script> |
| 33 <iframe src=004-1.html onload="iframe_loaded()"></iframe> |
| 34 <iframe src=004-1.html onload="iframe_loaded()"></iframe> |
OLD | NEW |