New issue
Advanced search Search tips

Issue 699085 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Align XMLHttpRequest's overrideMimeType() with the standard

Project Member Reported by annevank...@gmail.com, Mar 7 2017

Issue description

Labels: Hotlist-Interop
Status: Available (was: Unconfirmed)
Cc: aahlstrom@google.com
Labels: OS-Android OS-Chrome OS-Linux OS-Windows
http://w3c-test.org/XMLHttpRequest/overridemimetype-invalid-mime-type.htm
http://w3c-test.org/XMLHttpRequest/overridemimetype-blob.html

aahlstrom@, can you take a look at this issue?
Owner: aahlstrom@google.com
Status: Assigned (was: Available)
Project Member

Comment 4 by bugdroid1@chromium.org, Jun 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/257d5b52af684edd0840a516519ba340e16ef24d

commit 257d5b52af684edd0840a516519ba340e16ef24d
Author: Austin James Ahlstrom <aahlstrom@google.com>
Date: Fri Jun 30 02:49:41 2017

Changes to XHR overrideMimeType function

This CL changes the functionality of the overrideMimeType() function
to bring it more in line with the XHR specs,
along with general handling of the MIME type and charset.
The final response charset is represented as a method instead of a variable,
to try and reflect the behavior described in the specs.

Before this CL, the browser took any input from overrideMimeType()
and set it as the Content-Type for the XHR response.
There was no process to ensure that the override MIME type was valid.
This is inconsistent with the XHR specs' expected behavior for
the overrideMimeType() method and usage of the override MIME type.
This change minimizes those inconsistencies by
 - validating MIME type input to overrideMimeType()
 - fixing the incorrect behavior of setting the response Content-Type
       as the override MIME type
This should bring Chrome more in line with the overrideMimeType specs.

https://xhr.spec.whatwg.org/#the-overridemimetype()-method
https://xhr.spec.whatwg.org/#response-body

Tests are updated; this change causes some tests to pass that failed before.
The content-type-header test fails now; it seems that failure is expected,
as far as I understand the specs.
I'll work on the overridemimetype-blob test more later.
For now, it's not a regression, just a slight change in output.

Bug: 699085
Change-Id: I9a5d6f6ca4475c23d0c13846f47ca88202f2c2f6
Reviewed-on: https://chromium-review.googlesource.com/547918
Commit-Queue: Austin James Ahlstrom <aahlstrom@google.com>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483603}
[modify] https://crrev.com/257d5b52af684edd0840a516519ba340e16ef24d/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/overridemimetype-blob-expected.txt
[delete] https://crrev.com/b73990b490ec7e22dccb936563deb30af0735142/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis-expected.txt
[delete] https://crrev.com/b73990b490ec7e22dccb936563deb30af0735142/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/overridemimetype-invalid-mime-type-expected.txt
[modify] https://crrev.com/257d5b52af684edd0840a516519ba340e16ef24d/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header-expected.txt
[modify] https://crrev.com/257d5b52af684edd0840a516519ba340e16ef24d/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html
[modify] https://crrev.com/257d5b52af684edd0840a516519ba340e16ef24d/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
[modify] https://crrev.com/257d5b52af684edd0840a516519ba340e16ef24d/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h

Project Member

Comment 5 by bugdroid1@chromium.org, Jul 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4a20bad558e648c8e7208443d0d4a80f68587ba2

commit 4a20bad558e648c8e7208443d0d4a80f68587ba2
Author: Austin James Ahlstrom <aahlstrom@google.com>
Date: Tue Jul 18 08:03:36 2017

Edits to support the overrideMimeType-blob test

These changes are to bring Chrome's XHR implementation
in greater agreement with the XHR specs (see links).
This change makes it so that setting the content type
as defined in the XHR response behavior for blobs
is no longer dependent on a non-blank file path,
which is more consistent with the specs.

https://xhr.spec.whatwg.org/#the-overridemimetype()-method
https://xhr.spec.whatwg.org/#response-body

A change to the overridemimetype-blob test is added
based on communication with a spec editor (see link).
This is due to an inconsistency between two specs:
the MIME-sniffing standard and RFC-2045 (see links).

http://logs.glob.uno/?c=freenode%23whatwg&s=6+Jul+2017&e=6+Jul+2017
(see comments by yhirano, annevk, and GPHemsley)
https://mimesniff.spec.whatwg.org/#parsing-a-mime-type
https://tools.ietf.org/html/rfc2045#page-12

This change fixed four test failures on the WPT test,
but created one test failure (xhr-response-blob.html).
I changed the expectations file related to this test
to accommodate the change.

There are two 'FIXME' comments relevant to this test:
XMLHttpRequest.cpp, lines 1428-1429 and lines 1593-1595.
I don't think that they're necessary, and would consider
removing them, but I don't know best practice for that.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=699085
Change-Id: I77919178b725792e914d6984cc3f5ebde654e5af
Reviewed-on: https://chromium-review.googlesource.com/563139
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Commit-Queue: Austin James Ahlstrom <aahlstrom@google.com>
Cr-Commit-Position: refs/heads/master@{#487412}
[delete] https://crrev.com/c482fb32069aca187783ca0153e5d9bc806b00f3/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/overridemimetype-blob-expected.txt
[modify] https://crrev.com/4a20bad558e648c8e7208443d0d4a80f68587ba2/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/overridemimetype-blob.html
[modify] https://crrev.com/4a20bad558e648c8e7208443d0d4a80f68587ba2/third_party/WebKit/LayoutTests/fast/files/script-tests/xhr-response-blob.js
[modify] https://crrev.com/4a20bad558e648c8e7208443d0d4a80f68587ba2/third_party/WebKit/LayoutTests/fast/files/xhr-response-blob-expected.txt
[modify] https://crrev.com/4a20bad558e648c8e7208443d0d4a80f68587ba2/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Cc: -aahlstrom@google.com yhirano@chromium.org
Status: Started (was: Assigned)
Can we close this?
Project Member

Comment 7 by sheriffbot@chromium.org, Sep 20 2017

Labels: Hotlist-Recharge-BouncingOwner
Owner: ----
Status: Untriaged (was: Started)
The assigned owner "aahlstrom@google.com" is not able to receive e-mails, please re-triage.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Recharge-BouncingOwner
Status: Available (was: Untriaged)

Comment 10 Deleted

Yet more changes: https://github.com/whatwg/xhr/pull/218 -- the change to require that override MIME type be reset when calling open() is being reverted, maybe?

Sign in to add a comment