diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /netwerk/test/mochitests/test_1396395.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/mochitests/test_1396395.html')
-rw-r--r-- | netwerk/test/mochitests/test_1396395.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/netwerk/test/mochitests/test_1396395.html b/netwerk/test/mochitests/test_1396395.html new file mode 100644 index 0000000000..dcfb952b3a --- /dev/null +++ b/netwerk/test/mochitests/test_1396395.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<!-- vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: --> +<html> + <!-- Any copyright is dedicated to the Public Domain. + - http://creativecommons.org/publicdomain/zero/1.0/ --> +<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, topic, data) { + let channel = subject.QueryInterface(Ci.nsIHttpChannel); + if (!channel.URI.spec.startsWith("http://example.org")) { + 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(); + } + + iframe.src = 'http://example.org'; +}); + </script> +</body> +</html> |