blob: 80e940ab2960baa6db80aae352ade926335b80ea (
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
34
35
36
37
38
39
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check that adding progress listeners to a browser doesn't break things
* when switching the remoteness of that browser.
*/
add_task(async function test_remoteness_switch_listeners() {
await BrowserTestUtils.withNewTab("about:support", async function (browser) {
let wpl;
let navigated = new Promise(resolve => {
wpl = {
onLocationChange() {
is(browser.currentURI.spec, "https://example.com/");
if (browser.currentURI?.spec == "https://example.com/") {
resolve();
}
},
QueryInterface: ChromeUtils.generateQI([
Ci.nsISupportsWeakReference,
Ci.nsIWebProgressListener2,
Ci.nsIWebProgressListener,
]),
};
browser.addProgressListener(wpl);
});
let loaded = BrowserTestUtils.browserLoaded(
browser,
null,
"https://example.com/"
);
BrowserTestUtils.loadURIString(browser, "https://example.com/");
await Promise.all([loaded, navigated]);
browser.removeProgressListener(wpl);
});
});
|