OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>Synthetic popstate events</title> |
| 4 <script src="../../../../../../resources/testharness.js"></script> |
| 5 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 6 <div id="log"></div> |
| 7 <script> |
| 8 test(function () { |
| 9 assert_throws('NotSupportedError', function() { |
| 10 document.createEvent('PopStateEvent'); |
| 11 }, 'document.createEvent("PopStateEvent") should not be supported'); |
| 12 }, 'document.createEvent'); |
| 13 |
| 14 test(function () { |
| 15 assert_false('initPopStateEvent' in PopStateEvent.prototype, |
| 16 'There should be no PopStateEvent#initPopStateEvent'); |
| 17 }, 'initPopStateEvent'); |
| 18 |
| 19 test(function () { |
| 20 var state = history.state; |
| 21 var data; |
| 22 window.addEventListener('popstate', function (e) { |
| 23 data = e.state; |
| 24 }); |
| 25 window.dispatchEvent(new PopStateEvent('popstate', { |
| 26 'state': {testdata:true} |
| 27 })); |
| 28 assert_true(data.testdata,'state data was corrupted'); |
| 29 assert_equals(history.state, state, "history.state was NOT set by dispatching
the event"); |
| 30 }, 'Dispatching a synthetic PopStateEvent'); |
| 31 </script> |
OLD | NEW |