blob: ad63706195ee8268403d0bc2bf886f7e0901a03d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
add_task(async function test() {
await BrowserTestUtils.withNewTab(
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
{ gBrowser, url: "http://example.com" },
async function(browser) {
let numLocationChanges = 0;
let listener = {
onLocationChange(browser, webProgress, request, uri, flags) {
info("location change: " + (uri && uri.spec));
numLocationChanges++;
},
};
gBrowser.addTabsProgressListener(listener);
await SpecialPowers.spawn(browser, [], function() {
// pushState to a new URL (http://example.com/foo"). This should trigger
// exactly one LocationChange event.
content.history.pushState(null, null, "foo");
});
await Promise.resolve();
gBrowser.removeTabsProgressListener(listener);
is(
numLocationChanges,
1,
"pushState should cause exactly one LocationChange event."
);
}
);
});
|