Backed out changeset 4888b2f651bc (bug 1921972) for causing multiple failures. CLOSED...
[gecko.git] / docshell / test / browser / browser_bug554155.js
blob748d5056e79765aaa507c6ebd7d9290179f57a9e
1 add_task(async function test() {
2   await BrowserTestUtils.withNewTab(
3     // eslint-disable-next-line @microsoft/sdl/no-insecure-url
4     { gBrowser, url: "http://example.com" },
5     async function (browser) {
6       let numLocationChanges = 0;
8       let listener = {
9         onLocationChange(browser, webProgress, request, uri) {
10           info("location change: " + (uri && uri.spec));
11           numLocationChanges++;
12         },
13       };
15       gBrowser.addTabsProgressListener(listener);
17       await SpecialPowers.spawn(browser, [], function () {
18         // pushState to a new URL (http://example.com/foo").  This should trigger
19         // exactly one LocationChange event.
20         content.history.pushState(null, null, "foo");
21       });
23       await Promise.resolve();
25       gBrowser.removeTabsProgressListener(listener);
26       is(
27         numLocationChanges,
28         1,
29         "pushState should cause exactly one LocationChange event."
30       );
31     }
32   );
33 });