Bug 1704660, add a null check for a CreateStringBlob caller, r=edgar

The form isn't submitted to the server because
https://searchfox.org/mozilla-central/rev/3de2db87f3c9001ae478318d47a2ca3427574382/docshell/base/nsDocShell.cpp#12834
returns early.

Differential Revision: https://phabricator.services.mozilla.com/D111852
This commit is contained in:
Olli Pettay 2021-04-13 19:41:51 +00:00
parent 7c91c2efa6
commit 20de573529
3 changed files with 19 additions and 0 deletions

View File

@ -5682,6 +5682,7 @@ HTMLInputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) {
GetFilesOrDirectoriesInternal();
if (files.IsEmpty()) {
NS_ENSURE_STATE(GetOwnerGlobal());
ErrorResult rv;
RefPtr<Blob> blob = Blob::CreateStringBlob(
GetOwnerGlobal(), ""_ns, u"application/octet-stream"_ns);

View File

@ -0,0 +1,17 @@
<html>
<head>
<script>
function test() {
var ifr = document.getElementsByTagName("iframe")[0];
var form = ifr.contentDocument.getElementsByTagName("form")[0];
form.onsubmit = function() {
ifr.remove()
}
form.lastChild.click();
}
</script>
</head>
<body onload="test()">
<iframe srcdoc="<form><input name=f type=file><button></button></form>"></iframe>
</body>
</html>

View File

@ -90,3 +90,4 @@ load 1550881-1.html
load 1550881-2.html
skip-if(Android) pref(dom.disable_open_during_load,false) load 1667493.html
load 1680418.html
load 1704660.html