New issue
Advanced search Search tips

Issue 771118 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 6
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocking:
issue 715640



Sign in to add a comment

S13nServiceWorker: MIME type sniffing algorithm is not applied to the response from SW.

Project Member Reported by horo@chromium.org, Oct 3 2017

Issue description

When NetworkService is not enabled, the MIME sniffing logic is executed by MimeSniffingResourceHandler. So the response from the SW is sniffed by it.

When NetworkService is enabled, the MIME sniffing logic is executed by URLLoaderImpl. This is in the net layer, and the response from the SW is not sniffed by it.


 
(A little more context: we're not fully convinced if we need MIME sniffing for SW responses yet, so putting this off a bit later)
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 3 2017

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

commit 8e66ad255c0fd51ef0c7bdc713efdd9378c1d921
Author: Tsuyoshi Horo <horo@chromium.org>
Date: Tue Oct 03 11:01:30 2017

Add MIME sniffing for SW test and make redirect tests not to rely on MIME sniffing

Bug:  771118 ,  764224 
Change-Id: Ia7a942644736c21412535a9d01bb183794c202cb
Reviewed-on: https://chromium-review.googlesource.com/697484
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506004}
[modify] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
[add] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/mime-sniffing.https.html
[add] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/mime-sniffing-worker.js
[modify] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-out-scope.py
[modify] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-scope1.py
[modify] https://crrev.com/8e66ad255c0fd51ef0c7bdc713efdd9378c1d921/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/navigation-redirect-scope2.py

Blocking: 715640
Setting to block S13nSW so we don't lose track of this, even if the ultimate decision might be to WontFix.
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 11 2017

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

commit f45d5c38068ce3aa28a032ba241046dfc0e9ff55
Author: Tsuyoshi Horo <horo@chromium.org>
Date: Wed Oct 11 05:19:00 2017

Make navigation-preload/redirect.https.html not to rely on MIME sniffing

Bug:  771118 ,  764224 
Change-Id: I11aca4ce5675a633cbc722f0c362c0dc4df0b2da
Reviewed-on: https://chromium-review.googlesource.com/711555
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507900}
[modify] https://crrev.com/f45d5c38068ce3aa28a032ba241046dfc0e9ff55/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
[modify] https://crrev.com/f45d5c38068ce3aa28a032ba241046dfc0e9ff55/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resources/redirect-scope.py

Comment 5 by laforge@google.com, Nov 7 2017

Components: Internals>Network>Service

Comment 6 by laforge@google.com, Nov 7 2017

Components: -Internals>Network>Service Internals>Services>Network
Apologies, applied the wrong component in bulk.

Comment 7 by bashi@chromium.org, Apr 16 2018

Labels: -Pri-3 Pri-2
Owner: bashi@chromium.org
Status: Assigned (was: Available)
I'll own this. Do we need a spec discussion on this topic? If implementing MIME sniffing isn't so hard, we may want to consider implementing it to preserve the current behavior anyway?

Comment 8 by falken@chromium.org, Apr 16 2018

kinuko, horo: do you recall why we weren't sure this is needed as in comment #1?

Comment 9 by dxie@chromium.org, May 17 2018

Labels: -Pri-2 Proj-Servicification-Canary OS-All Pri-1

Comment 10 by dxie@chromium.org, May 18 2018

Labels: -OS-All OS-Windows OS-Linux OS-Mac OS-Chrome OS-Android
Project Member

Comment 11 by bugdroid1@chromium.org, May 22 2018

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

commit 8dc3f5ecc928cdfd98b04b3216286c04dda078ae
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Tue May 22 01:34:35 2018

S13nSW: Set Content-Type for synthesized responses in content_browsertests

Some of content_browsertests are timing out because we haven't supported
mime-sniffing in S13nSW code path yet ( issue 771118 ). These tests wait
for <title> being updated but it doesn't happen when a synthesized
response doesn't have 'Content-Type: text/html'. Probably a right fix
would be to support mime-sniffing but it's better to make these tests
independent from mime-sniffing as these tests do nothing with
mime-sniffing. This CL changes results of following tests:

- ServiceWorkerBrowserTest.FetchPageWithSaveData -> PASS
- ServiceWorkerBrowserTest.ResponseFromHTTPSServiceWorkerIsMarkedAsSecure -> CRASH
- ServiceWorkerBrowserTest.ResponseFromHTTPServiceWorkerIsNotMarkedAsSecure -> PASS

Following tests are still timing out because of unexpected behavior:

- ServiceWorkerBrowserTest.ImportsBustMemcache
- ServiceWorkerBrowserTest.Reload

Bug:  715640 ,  771118 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I14819f2b39bfa83edf9eb5fcbf9950d72fa5b292
Reviewed-on: https://chromium-review.googlesource.com/1067220
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560448}
[modify] https://crrev.com/8dc3f5ecc928cdfd98b04b3216286c04dda078ae/content/test/data/service_worker/add_save_data_to_title.js
[modify] https://crrev.com/8dc3f5ecc928cdfd98b04b3216286c04dda078ae/content/test/data/service_worker/fetch_event_blob.js
[modify] https://crrev.com/8dc3f5ecc928cdfd98b04b3216286c04dda078ae/content/test/data/service_worker/fetch_event_reload.js
[modify] https://crrev.com/8dc3f5ecc928cdfd98b04b3216286c04dda078ae/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter

Cc: kinuko@chromium.org
kinuko, bashi: This looks like the last remaining meaningful test failure with SW + NetworkService. Let's chat today about what to do here.

It seems to me MIME sniffing is impl in URLLoader at:
https://cs.chromium.org/chromium/src/services/network/url_loader.cc?l=701&rcl=6357cc72c771e3f40f610bed88db805b67580a00

And we're not going to hit that path when going through SW loaders.

I'm wondering why other URL loaders don't need MIME sniffing.

Comment 13 by bashi@chromium.org, Jun 11 2018

Here is a quick hack to sniff blob response in browser process.
https://chromium-review.googlesource.com/c/chromium/src/+/1094754

I don't think this is reasonable though. This adds additional copies (and IPC rounds I guess?).

Comment 14 by bashi@chromium.org, Jun 11 2018

Labels: -Pri-1 -Proj-Servicification-Canary Pri-3
Discussed offline. This may not be a blocker for S13nServiceWorker. Lowering the priority for now.
Just for my own notes:
* When a service worker does respondWith(new Response(...)) or respondWith(fetch()), MIME sniffing probably does not happen with S13nSW/Network, but it does with the legacy implementation.
* MIME sniffing is implemented in URLLoader, so you might think it would work for respondWith(fetch()). But the Fetch API explicitly disables MIME sniffing.
* We think it might be OK to not do MIME sniffing for SW responses but it's difficult to add meaningful UMA about it. So we'll proceed without the support and adjust if we see problems.
* If ultimately we need to support this, it could potentially be done by changing the URLLoaderClientImpl or in the SW thread at ServiceWorkerContextClient.
* MIME sniffing for NS was implemented in  issue 746144 .
* There is a WPT test mime-sniffing.https.html that maybe shouldn't be a WPT test, if the spec doesn't mandate MIME sniffing. But it could make sense to keep it, if most browsers support it.
Project Member

Comment 16 by bugdroid1@chromium.org, Jun 12 2018

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

commit 6086ea3268b84b5b81bc7f04cf16e39eff9e2685
Author: Matt Falkenhagen <falken@chromium.org>
Date: Tue Jun 12 02:08:59 2018

NetS13nServiceWorker: Disable irrelevant test for MimeSniffingResourceHandler.

The test was written to test an internal quirk of
MimeSniffingResourceHandler, which isn't used with Network Service, and
service worker won't support MIME sniffing for now.

Also the quirk, OnStartLoadingResponseBody() called before OnReceiveResponse(),
seems to violate the contract in url_loader.mojom anyway.

Bug:  715640 ,  771118 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: If9671b3ad0756157064b577693fbea9a520460f6
Reviewed-on: https://chromium-review.googlesource.com/1095061
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566270}
[modify] https://crrev.com/6086ea3268b84b5b81bc7f04cf16e39eff9e2685/content/browser/service_worker/service_worker_browsertest.cc
[modify] https://crrev.com/6086ea3268b84b5b81bc7f04cf16e39eff9e2685/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter

Comment 17 by dxie@chromium.org, Jun 12 2018

Labels: Hotlist-KnownIssue
Cc: bashi@chromium.org
Owner: shimazu@chromium.org
Status: Started (was: Assigned)
I'm now trying to apply mime sniffing by injecting URLLoader at ThrottlingURLLoader at NavigationURLLoaderImpl and ResourceDispatcher.
I'm expecting that issue 858975 will be solved together in that approach.
Status: Fixed (was: Started)
crrev.com/c/1160133 has landed and wpt/service-workers/service-worker/mime-sniffing.https.html is now passing :D
Project Member

Comment 20 by bugdroid1@chromium.org, Aug 13

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

commit a68e7651b3960316853757bb288783c6fe2de64d
Author: John Abd-El-Malek <jam@chromium.org>
Date: Mon Aug 13 18:26:31 2018

Mark external/wpt/service-workers/service-worker/mime-sniffing.https.html as fixed with network service.

This was fixed in r580143

TBR=shimazu@chromium.org

Bug:  771118 
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I4766a79d1ddb3c017b35da0ced75f30e2a8113d6
Reviewed-on: https://chromium-review.googlesource.com/1172936
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582644}
[modify] https://crrev.com/a68e7651b3960316853757bb288783c6fe2de64d/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService

Sign in to add a comment