forked from mirrors/gecko-dev
Without the other patches in this series, this test fails with both with and without Fission enabled, for two different reasons. With Fission disabled, the second reload request appears as empty, due to us being unable to rewind the postData nsIInputStream. With Fission enabled, the second reload request causes crashes due to the nsMIMEInputStream's invariant of requiring a seekable stream is invalidated, causing the nsICloneableInputStream implementation to misbehave. Differential Revision: https://phabricator.services.mozilla.com/D101800
61 lines
1.8 KiB
HTML
61 lines
1.8 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
|
|
<form id="form" action="file_reload_large_postdata.sjs" target="_blank" rel="opener" method="POST">
|
|
<input id="input" name="payload" type="hidden" value=""/>
|
|
</form>
|
|
|
|
<pre id="test">
|
|
<script>
|
|
// This is derived from `kTooLargeStream` in `IPCStreamUtils.cpp`.
|
|
const kTooLargeStream = 1024 * 1024;
|
|
|
|
function waitForPopup(expected) {
|
|
return new Promise(resolve => {
|
|
addEventListener("message", evt => {
|
|
info("got message!");
|
|
is(evt.source.opener, window, "the event source's opener should be this window");
|
|
is(evt.data, expected, "got the expected data from the popup");
|
|
resolve(evt.source);
|
|
}, { once: true });
|
|
});
|
|
}
|
|
|
|
add_task(async function() {
|
|
await SpecialPowers.pushPrefEnv({"set": [["dom.confirm_repost.testing.always_accept", true]]});
|
|
let form = document.getElementById("form");
|
|
let input = document.getElementById("input");
|
|
|
|
// Create a very large value to include in the post payload. This should
|
|
// ensure that the value isn't sent directly over IPC, and is instead sent as
|
|
// an async inputstream.
|
|
let payloadSize = kTooLargeStream;
|
|
|
|
let popupReady = waitForPopup(payloadSize);
|
|
input.value = "A".repeat(payloadSize);
|
|
form.submit();
|
|
|
|
let popup = await popupReady;
|
|
try {
|
|
let popupReady2 = waitForPopup(payloadSize);
|
|
info("reloading popup");
|
|
popup.location.reload();
|
|
let popup2 = await popupReady2;
|
|
is(popup, popup2);
|
|
} finally {
|
|
popup.close();
|
|
}
|
|
});
|
|
|
|
// The .sjs server can time out processing the 1mb payload in debug builds.
|
|
SimpleTest.requestLongerTimeout(2);
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|