diff --git a/docshell/test/navigation/file_reload_large_postdata.sjs b/docshell/test/navigation/file_reload_large_postdata.sjs new file mode 100644 index 000000000000..a2644179081a --- /dev/null +++ b/docshell/test/navigation/file_reload_large_postdata.sjs @@ -0,0 +1,46 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set sts=2 sw=2 et tw=80 ft=javascript: */ +"use strict"; + +const BinaryInputStream = CC( + "@mozilla.org/binaryinputstream;1", + "nsIBinaryInputStream", + "setInputStream" +); + +Cu.importGlobalProperties(["URLSearchParams"]); + +function readStream(inputStream) { + let available = 0; + let result = []; + while ((available = inputStream.available()) > 0) { + result.push(inputStream.readBytes(available)); + } + return result.join(""); +} + +function handleRequest(request, response) { + let rv = (() => { + try { + if (request.method != "POST") { + return "ERROR: not a POST request"; + } + + let body = new URLSearchParams( + readStream(new BinaryInputStream(request.bodyInputStream)) + ); + return body.get("payload").length; + } catch (e) { + return "ERROR: Exception: " + e; + } + })(); + + response.setHeader("Content-Type", "text/html", false); + response.setHeader("Cache-Control", "no-cache", false); + response.write(` + + `); +} diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini index 693121ca10ca..18d6a233a660 100644 --- a/docshell/test/navigation/mochitest.ini +++ b/docshell/test/navigation/mochitest.ini @@ -119,3 +119,6 @@ skip-if = true # This was disabled for a few years now anyway, bug 1677544 [test_triggeringprincipal_iframe_iframe_window_open.html] [test_contentpolicy_block_window.html] [test_rate_limit_location_change.html] +[test_reload_large_postdata.html] +support-files = + file_reload_large_postdata.sjs diff --git a/docshell/test/navigation/test_reload_large_postdata.html b/docshell/test/navigation/test_reload_large_postdata.html new file mode 100644 index 000000000000..767316cd5f6f --- /dev/null +++ b/docshell/test/navigation/test_reload_large_postdata.html @@ -0,0 +1,58 @@ + + + + + + + +

+ +
+ +
+ +
+
+
+ + diff --git a/ipc/glue/IPCStreamUtils.cpp b/ipc/glue/IPCStreamUtils.cpp index fba98891fe2e..6d3e1868168e 100644 --- a/ipc/glue/IPCStreamUtils.cpp +++ b/ipc/glue/IPCStreamUtils.cpp @@ -40,6 +40,8 @@ bool SerializeInputStreamWithFdsChild(nsIIPCSerializableInputStream* aStream, MOZ_RELEASE_ASSERT(aStream); MOZ_ASSERT(aManager); + // If you change this size, please also update the payload size in + // test_reload_large_postdata.html. const uint64_t kTooLargeStream = 1024 * 1024; uint32_t sizeUsed = 0;