OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Set-and-clear Timeout-and-Interval</title> |
| 5 <script src="../../../resources/testharness.js"></script> |
| 6 <script src="../../../resources/testharnessreport.js"></script> |
| 7 <link rel="stylesheet" href="../../../resources/testharness.css"> |
| 8 </head> |
| 9 <body> |
| 10 <p>Actions registered with setTimeout should not be cleared with clearInterval (
and vice versa).</p> |
| 11 <script> |
| 12 var setTimeoutAndClearIntervalTest = async_test('Actions created with setTimeout
should not be cleared by clearInterval.'); |
| 13 |
| 14 setTimeoutAndClearIntervalTest.step(function () |
| 15 { |
| 16 function action() |
| 17 { |
| 18 setTimeoutAndClearIntervalTest.done(); |
| 19 } |
| 20 |
| 21 var timeoutID = window.setTimeout(setTimeoutAndClearIntervalTest.step_func(a
ction), 0); |
| 22 |
| 23 window.clearInterval(timeoutID); // Should not clear the action. |
| 24 }); |
| 25 |
| 26 var setIntervalAndClearTimeoutTest = async_test('Actions created with setInterva
l should not be cleared by clearTimeout.'); |
| 27 |
| 28 setIntervalAndClearTimeoutTest.step(function () |
| 29 { |
| 30 var intervalID; |
| 31 |
| 32 function action() |
| 33 { |
| 34 window.clearInterval(intervalID); |
| 35 setIntervalAndClearTimeoutTest.done(); |
| 36 } |
| 37 |
| 38 intervalID = window.setInterval(setIntervalAndClearTimeoutTest.step_func(act
ion), 0); |
| 39 |
| 40 window.clearTimeout(intervalID); // Should not clear the action. |
| 41 }); |
| 42 </script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |