Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test gets skipped with pattern: os == 'mac' && os_version == '10.15' && processor == 'x86_64' && debug OR os == 'mac' && os_version == '11.20' && arch == 'aarch64' && opt OR os == 'mac' && os_version == '15.30' && arch == 'aarch64' && opt OR os == 'win' && os_version == '11.26100' && opt
- This test failed 14 times in the preceding 30 days. quicksearch this test
- Manifest: netwerk/test/browser/browser.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
"use strict";
Services.prefs.setBoolPref("network.early-hints.enabled", true);
add_task(async function test_103_cancel_parent_connect() {
await SpecialPowers.pushPrefEnv({
set: [["network.early-hints.parent-connect-timeout", 1]],
});
let callback;
let promise = new Promise(resolve => {
callback = resolve;
});
let observed_cancel_reason = "";
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic) {
aSubject = aSubject.QueryInterface(Ci.nsIRequest);
if (
aTopic == "http-on-stop-request" &&
aSubject.name ==
) {
observed_cancel_reason = aSubject.canceledReason;
Services.obs.removeObserver(observer, "http-on-stop-request");
callback();
}
},
};
Services.obs.addObserver(observer, "http-on-stop-request");
// test that no crash or memory leak happens when cancelling before
await BrowserTestUtils.withNewTab(
{
gBrowser,
waitForLoad: true,
},
async function () {}
);
await promise;
Assert.equal(observed_cancel_reason, "parent-connect-timeout");
Services.prefs.clearUserPref("network.early-hints.parent-connect-timeout");
});