Closed Bug 1245043 Opened 8 years ago Closed 8 years ago

Is multipart post parameter changed?

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1255735

People

(Reporter: sugilog, Unassigned)

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36

Steps to reproduce:

Submit empty file input with Ajax using FormData on Firefox45.0b1. POST Parameter changed old firefox (like Firefox 44.0).

example html file is following. (POST URL is just a sample)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <form method="post">
    <input type="file" name="file" />
    <input type="submit" value="submit" />
  </form>
  <script type="text/javascript">
    document.querySelector( "form" ).addEventListener(
      "submit",
      function( event ) {
        var formData = new FormData( document.querySelector( "form" ) ),
            request = new XMLHttpRequest();

        request.open( "POST", "http://moz.example/" );
        request.send( formData );

        event.preventDefault();
      },
      false
    );
  </script>
</body>
</html>


Actual results:

Multipart POST Parameter on Firefox 45.0b1


-----------------------------294551103919857
Content-Disposition: form-data; name="file"


-----------------------------294551103919857--



Expected results:

Multipart POST Parameter on Firefox 44.0


-----------------------------9268226478516697314304396
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream


-----------------------------9268226478516697314304396--
Component: General → Untriaged
Product: Mozilla Developer Network → Core
Hi Takayuki,

I have tested the provided code on latest Firefox release (44.0), latest Nightly (47.0a1) build and Firefox Beta (45.0ab3). After I have uploaded a empty file and pressed the "submit" button nothing happened. I checked in console from "Web Developer" but it was empty. I'm not sure how can I verify this issue, maybe I’m doing something wrong.
Can you please be more specific? 

Thanks,
Cosmin.
Flags: needinfo?(sugilog)
Hi Cosmin, Thank you.

My description is bit wrong. Sorry.
"Submit empty file input" is not "Submit input with empty file", but "Submit file input with no selected files".
So, please select files nothing, and press "submit" button.
Flags: needinfo?(sugilog)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/

Hi Takayuki,

I have tested again on Windows 7 (x64) and Mac OS (10.11) using the latest Nightly (47.0a1 - Build ID: 20160215030213) build and latest Beta (45.0b2 -20160211221018) build. I have pressed the "submit" button without selected any files. The console displayed the following message: "POST XHR http://moz.example/" (see attachment). This message appears even if I select a file and press "submit" button.  

I have tested this on Chrome and the console displayed the following error: "POST XHR http://moz.example/ net::ERR_NOT_RESOLVED" (see attachment). This error appears even if I select a file and press "submit" button. Internet Explorer restricted this webpage from running scripts or ActiveX controls. And in Safari another message occurred: "Failed to load source..." .

I am not sure if I understand the expected results. Please provide more details about what this script is supposed to do. Also, can you please provide a screenshot or a screen recording that shows how to reproduce this issue?

Thanks,
Cosmin.
Flags: needinfo?(sugilog)
Attached image chrome.48.0.png
Flags: needinfo?(sugilog)
Attached image firefox.44.0.png
Attached image firefox.45.0.png
Hi, Cosmin, thank you for checking.
I found another condition for testing. URL to submit should be exist (like bugzilla.mozilla.org), so my example is wrong.

It is just a test.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <form method="post">
    <input type="file" name="file" />
    <input type="submit" value="submit" />
  </form>
  <script type="text/javascript">
    document.querySelector( "form" ).addEventListener(
      "submit",
      function( event ) {
        var formData = new FormData( document.querySelector( "form" ) ),
            request = new XMLHttpRequest();

        request.open( "POST", "http://bugzilla.mozilla.org/" );
        request.send( formData );

        event.preventDefault();
      },
      false
    );
  </script>
</body>
</html>

I attached 3 captured images, chrome, firefox44, firefox45.
Please check post parameter on request (filename and content-type are different.

Actual results:

Multipart POST Parameter on Firefox 45.0


-----------------------------294551103919857
Content-Disposition: form-data; name="file"


-----------------------------294551103919857--



Expected results:

Multipart POST Parameter on Firefox 44.0, Chrome 48.0


-----------------------------9268226478516697314304396
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream


-----------------------------9268226478516697314304396--
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101

Hi Takayuki,

I have tested again this issue and these are the results:

Firefox 44.0.2 (Build ID: 20160210153822) - not reproducible
Firefox 45.0 (Build ID: 20160303134406) - reproducible
Beta 45.0b9 (Build ID: 20160223142613) - reproducible
Niglty 48.a01 (Build ID: 20160309030419) - not reproducible
Aurora 46.0a2 (Build ID: 20160209004008) - not reproducible

I have tried to make a regression window but I did not find a bad Nightly build yet. I will give it another try tomorrow and get back with the results. 

Thabks,
Cosmin.
Hi,

I have tried again to perform a regression but I still have not found a bad Nightly build. I will assign a component to it, maybe someone with more experience on this could share an opinion. 

Thanks,
Cosmin.
Component: Untriaged → Networking: File
Fairly certain this belongs in docshell...
Component: Networking: File → Document Navigation
Component: Document Navigation → DOM
Flags: needinfo?(amarchesini)
This has been fix in bug 1255735.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Flags: needinfo?(amarchesini)
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: