Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: netwerk/test/mochitests/mochitest.toml
<!DOCTYPE HTML>
<!-- vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: -->
<html>
<!-- Any copyright is dedicated to the Public Domain.
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<iframe id="f" src="about:blank"></iframe>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
var script = SpecialPowers.loadChromeScript(() => {
/* eslint-env mozilla/chrome-script */
Services.obs.addObserver(function onExamResp(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
return;
}
Services.obs.removeObserver(onExamResp, 'http-on-examine-response');
channel.suspend();
Promise.resolve().then(() => {
channel.resume();
});
}, 'http-on-examine-response');
sendAsyncMessage('start-test');
});
script.addMessageListener('start-test', () => {
const iframe = document.getElementById('f');
iframe.contentWindow.onunload = function () {
info('initiate sync XHR during the page loading');
let xhr = new XMLHttpRequest();
xhr.open('GET', window.location, false);
xhr.send(null);
ok(true, 'complete without crash');
script.destroy();
SimpleTest.finish();
}
});
</script>
</body>
</html>