Bug 1757847 [wpt PR 33036] - Update wpt metadata, a=testonly
[gecko.git] / testing / web-platform / tests / app-history / per-entry-events / dispose-same-document-replaceState.html
bloba6197260a28b8137a142453fd669fbeb82b12680
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script>
5 test(t => {
6 const entriesBefore = navigation.entries();
7 const currentBefore = navigation.currentEntry;
9 let disposeCalled = false;
10 navigation.currentEntry.ondispose = t.step_func(e => {
11 disposeCalled = true;
13 assert_equals(e.constructor, Event);
14 assert_equals(e.bubbles, false);
15 assert_equals(e.cancelable, false);
16 assert_equals(e.composed, false);
18 assert_not_equals(navigation.currentEntry, currentBefore);
19 assert_array_equals(navigation.entries(), [navigation.currentEntry]);
20 assert_equals((new URL(navigation.currentEntry.url)).search, "?replacement");
21 assert_equals(navigation.transition, null);
22 assert_equals(location.search, "?replacement");
23 });
25 history.replaceState(null, "", "?replacement");
26 assert_true(disposeCalled);
27 }, "dispose events when doing a same-document replace using history.replaceState()");
28 </script>