Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Issue 1762893002: Reland of Set the request mode and the credentials mode of FetchEvent in the service worker correct… (Closed)

Created:
4 years, 9 months ago by horo
Modified:
4 years, 9 months ago
CC:
blink-reviews, chromium-reviews, falken, gavinp+loader_chromium.org, horo+watch_chromium.org, Nate Chapin, jsbell+serviceworker_chromium.org, kenjibaheux+watch_chromium.org, kinuko+serviceworker, kinuko+watch, loading-reviews_chromium.org, Marijn Kruisselbrink, michaeln, nhiroki, serviceworker-reviews, tyoshino+watch_chromium.org, tzik
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reland of Set the request mode and the credentials mode of FetchEvent in the service worker correctly. Currently the request mode and the credentials mode of FetchEvent.request are not correctly set. 1. The credentials mode of no-cors resource request must be 'include', but currently 'same-origin'. (https://crbug.com/576534) ex: <img src="img.png"> <script src="test.js"> 2. When fetch() is called in the page, the FetchEvent.request.mode is always 'cors' and the FetchEvent.request.credentials is always 'same-origin' in the service worker. (https://crbug.com/543895) 3. When an audio element fetches a request, the FetchEvent.request.mode is always 'cors' and the FetchEvent.request.credentials is always 'same-origin' in the service worker. Expected: - <audio> mode: no-cors, credentials: include - <audio crossOrigin='anonymous'> mode: cors, credentials: same-origin - <audio crossOrigin='use-credentials'> mode: cors, credentials: include This CL includes many changes in LayoutTests/http/tests/fetch/. It is because the credentials mode for script tag is changed from 'same-origin' to 'include'. And fetch's SW-thorough tests are using script tags. The original change (https://codereview.chromium.org/1665533003/) didn't taint the response correctly. It was possible to read the body of opaque responses. (https://crbug.com/589740) So this change correctly taints the response when the response was returned from the Service Worker. BUG=576534, 543895 Committed: https://crrev.com/aa0375d2076441c85069620d7b8c5a29989cde9f Cr-Commit-Position: refs/heads/master@{#379958}

Patch Set 1 : Copy from https://codereview.chromium.org/1665533003/ #

Patch Set 2 : Taint the response from SW #

Total comments: 11

Patch Set 3 : incorporated tyoshino's comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+517 lines, -193 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors.js View 2 chunks +32 lines, -20 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js View 1 chunk +51 lines, -35 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight2.js View 1 chunk +47 lines, -39 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js View 6 chunks +46 lines, -43 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect-loop.js View 1 chunk +10 lines, -8 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html View 5 chunks +63 lines, -15 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html View 1 2 1 chunk +193 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-resources-iframe.html View 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html View 1 chunk +1 line, -1 line 0 comments Download
A + third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-response-taint-iframe.html View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp View 2 chunks +33 lines, -21 lines 0 comments Download
M third_party/WebKit/Source/core/loader/ImageLoader.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchManager.cpp View 1 2 5 chunks +31 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/network/ResourceRequest.cpp View 1 chunk +1 line, -4 lines 0 comments Download

Messages

Total messages: 19 (10 generated)
horo
tyoshino@ Could you please review this?
4 years, 9 months ago (2016-03-07 02:04:41 UTC) #6
tyoshino (SeeGerritForStatus)
lgtm Sorry for not catching the issue in the last review. Nice coverage! https://codereview.chromium.org/1762893002/diff/60001/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html File ...
4 years, 9 months ago (2016-03-07 14:48:22 UTC) #7
horo
https://codereview.chromium.org/1762893002/diff/60001/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html File third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html (right): https://codereview.chromium.org/1762893002/diff/60001/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html#newcode13 third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-response-taint.html:13: '/serviceworker/resources/fetch-access-control.php?'; On 2016/03/07 14:48:22, tyoshino wrote: > you could ...
4 years, 9 months ago (2016-03-08 03:11:02 UTC) #8
horo
mkwst@ Could you please review this?
4 years, 9 months ago (2016-03-08 03:11:32 UTC) #10
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/1762893002/diff/60001/third_party/WebKit/Source/modules/fetch/FetchManager.cpp File third_party/WebKit/Source/modules/fetch/FetchManager.cpp (right): https://codereview.chromium.org/1762893002/diff/60001/third_party/WebKit/Source/modules/fetch/FetchManager.cpp#newcode270 third_party/WebKit/Source/modules/fetch/FetchManager.cpp:270: switch (response.serviceWorkerResponseType()) { On 2016/03/08 at 03:11:02, horo wrote: ...
4 years, 9 months ago (2016-03-08 05:30:05 UTC) #11
Mike West
Thank you for the clear explanations and tests. LGTM.
4 years, 9 months ago (2016-03-08 20:20:05 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1762893002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1762893002/80001
4 years, 9 months ago (2016-03-08 21:53:09 UTC) #15
commit-bot: I haz the power
Committed patchset #3 (id:80001)
4 years, 9 months ago (2016-03-08 23:08:16 UTC) #17
commit-bot: I haz the power
4 years, 9 months ago (2016-03-08 23:09:24 UTC) #19
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/aa0375d2076441c85069620d7b8c5a29989cde9f
Cr-Commit-Position: refs/heads/master@{#379958}

Powered by Google App Engine
This is Rietveld 408576698