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

Issue 1487343002: Set credentials mode "same-origin" when crossOrigin=anonymous is set. (Closed)

Created:
5 years ago by horo
Modified:
5 years ago
CC:
chromium-reviews, webcomponents-bugzilla_chromium.org, eae+blinkwatch, fs, eric.carlson_apple.com, apavlov+blink_chromium.org, kinuko+watch, rwlbuis, Yoav Weiss, blink-reviews-css, blink-reviews-html_chromium.org, blink-reviews-dom_chromium.org, dglazkov+blink, gavinp+loader_chromium.org, blink-reviews, nessy, blink-reviews-style_chromium.org, sof, loading-reviews_chromium.org, darktears, loading-reviews+fetch_chromium.org, Nate Chapin, vcarbune.chromium, philipj_slow, tyoshino+watch_chromium.org, gavinp+prerender_chromium.org, tfarina, gasubic
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Set credentials mode "same-origin" when crossOrigin=anonymous is set. According to the HTML spec, the fetch credentials mode for resources which crossOrigin is "anonymous" must be "same-origin". https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attributes So the request which is sent to the server for "<img src='./test.png' crossOrigin='anonymous'>" must contain cookies, because it is a same origin request. And if a Service Worker intercept the request, the fetchevent.request.credentials must be "same-origin". But Chrome doesn't send cookies for <img src="./test.png" crossOrigin="anonymous">. And fetchevent.request.credentials is "omit". This CL fix this problem. (https://codereview.chromium.org/1267023004 introduced a workaround only for WebFonts.) https://codereview.chromium.org/1135203002 introduced CrossOriginAttributeValue enum. But String value and ResourceLoaderOptions are still used only for passing the crossOrigin value. So this CL change those code to use the enum value. - CrossOriginAttributeNotSet: corsEnabled: NO - CrossOriginAttributeAnonymous: corsEnabled: YES allowCredentials: YES if the request URL origin is same as the document's origin. Otherwise NO. credentialsRequested: NO - CrossOriginAttributeUseCredentials: corsEnabled: YES allowCredentials: YES credentialsRequested: YES BUG=486689, 563328 Committed: https://crrev.com/92358044fff21ee6cf6d89842b801c072145c432 Cr-Commit-Position: refs/heads/master@{#364641}

Patch Set 1 : #

Patch Set 2 : rebase and use default value in CSSImageValue.h #

Patch Set 3 : call testRunner.setAlwaysAcceptCookies to set remote origin cookie. #

Total comments: 2

Patch Set 4 : move #include "core/fetch/ResourceFetcher.h" to CSSImageValue.cpp #

Total comments: 2

Patch Set 5 : set credentials mode in DocumentThreadableLoader::makeCrossOriginAccessRequest() #

Total comments: 6

Patch Set 6 : incorporated tyoshino's comment #

Patch Set 7 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+248 lines, -157 lines) Patch
A third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html View 1 2 3 4 5 1 chunk +81 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/resources/abe-allow-credentials.php View 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/resources/abe-allow-star.php View 1 chunk +13 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/resources/abe-cookie-check.php View 1 chunk +22 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-html-imports.html View 1 2 3 4 5 6 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-request-resources.html View 1 2 3 4 5 6 1 chunk +13 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp View 2 chunks +2 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSImageSetValue.h View 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSImageSetValue.cpp View 3 chunks +4 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSImageValue.h View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSImageValue.cpp View 1 2 3 2 chunks +6 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/StyleResourceLoader.cpp View 4 chunks +6 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ScriptLoader.cpp View 1 2 3 4 5 6 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/FetchRequest.h View 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/FetchRequest.cpp View 1 chunk +11 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLLinkElement.cpp View 1 2 3 4 5 6 3 chunks +5 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLTrackElement.cpp View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/imports/HTMLImportsController.cpp View 1 chunk +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp View 2 8 chunks +9 lines, -26 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp View 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp View 1 chunk +1 line, -8 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/parser/PreloadRequest.h View 4 chunks +9 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp View 2 2 chunks +4 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp View 1 2 3 4 5 6 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/ImageLoader.cpp View 1 2 3 4 5 6 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/loader/LinkLoader.h View 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/LinkLoader.cpp View 1 2 3 3 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp View 1 2 3 3 chunks +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/loader/TextTrackLoader.h View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/TextTrackLoader.cpp View 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 43 (25 generated)
horo
tyoshino@ Could you please review this?
5 years ago (2015-12-04 04:05:07 UTC) #14
tyoshino (SeeGerritForStatus)
nice clean up https://codereview.chromium.org/1487343002/diff/120001/third_party/WebKit/Source/core/css/CSSImageValue.h File third_party/WebKit/Source/core/css/CSSImageValue.h (right): https://codereview.chromium.org/1487343002/diff/120001/third_party/WebKit/Source/core/css/CSSImageValue.h#newcode25 third_party/WebKit/Source/core/css/CSSImageValue.h:25: #include "core/fetch/ResourceFetcher.h" remove?
5 years ago (2015-12-07 08:49:55 UTC) #15
horo
https://codereview.chromium.org/1487343002/diff/120001/third_party/WebKit/Source/core/css/CSSImageValue.h File third_party/WebKit/Source/core/css/CSSImageValue.h (right): https://codereview.chromium.org/1487343002/diff/120001/third_party/WebKit/Source/core/css/CSSImageValue.h#newcode25 third_party/WebKit/Source/core/css/CSSImageValue.h:25: #include "core/fetch/ResourceFetcher.h" On 2015/12/07 08:49:54, tyoshino wrote: > remove? ...
5 years ago (2015-12-07 09:25:06 UTC) #16
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/1487343002/diff/140001/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp File third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp (left): https://codereview.chromium.org/1487343002/diff/140001/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp#oldcode69 third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp:69: request.setFetchCredentialsMode(allowCredentials == AllowStoredCredentials ? WebURLRequest::FetchCredentialsModeInclude : WebURLRequest::FetchCredentialsModeOmit); This method ...
5 years ago (2015-12-07 10:28:30 UTC) #17
horo
https://codereview.chromium.org/1487343002/diff/140001/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp File third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp (left): https://codereview.chromium.org/1487343002/diff/140001/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp#oldcode69 third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp:69: request.setFetchCredentialsMode(allowCredentials == AllowStoredCredentials ? WebURLRequest::FetchCredentialsModeInclude : WebURLRequest::FetchCredentialsModeOmit); On 2015/12/07 ...
5 years ago (2015-12-08 05:49:28 UTC) #19
tyoshino (SeeGerritForStatus)
lgtm! https://codereview.chromium.org/1487343002/diff/180001/third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html File third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html (right): https://codereview.chromium.org/1487343002/diff/180001/third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html#newcode31 third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html:31: document.cookie="TestCookie=same"; put spaces around the first = https://codereview.chromium.org/1487343002/diff/180001/third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html#newcode37 ...
5 years ago (2015-12-08 11:30:32 UTC) #20
horo
Thank you! https://codereview.chromium.org/1487343002/diff/180001/third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html File third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html (right): https://codereview.chromium.org/1487343002/diff/180001/third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html#newcode31 third_party/WebKit/LayoutTests/http/tests/security/img-crossorigin-cookies.html:31: document.cookie="TestCookie=same"; On 2015/12/08 11:30:31, tyoshino wrote: > ...
5 years ago (2015-12-09 02:29:34 UTC) #21
horo
mkwst@ Could you please review this?
5 years ago (2015-12-09 02:30:09 UTC) #22
horo
mkwst@ Could you please reivew this?
5 years ago (2015-12-09 08:57:51 UTC) #24
Mike West
On 2015/12/09 at 08:57:51, horo wrote: > mkwst@ > Could you please reivew this? I ...
5 years ago (2015-12-09 10:18:54 UTC) #25
horo
On 2015/12/09 10:18:54, Mike West wrote: > On 2015/12/09 at 08:57:51, horo wrote: > > ...
5 years ago (2015-12-10 08:01:42 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1487343002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1487343002/200001
5 years ago (2015-12-10 08:03:31 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/153935)
5 years ago (2015-12-10 08:59:18 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1487343002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1487343002/200001
5 years ago (2015-12-11 02:58:15 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/127941) linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, ...
5 years ago (2015-12-11 03:05:43 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1487343002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1487343002/240001
5 years ago (2015-12-11 03:45:49 UTC) #39
commit-bot: I haz the power
Committed patchset #7 (id:240001)
5 years ago (2015-12-11 07:15:42 UTC) #41
commit-bot: I haz the power
5 years ago (2015-12-11 07:16:25 UTC) #43
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/92358044fff21ee6cf6d89842b801c072145c432
Cr-Commit-Position: refs/heads/master@{#364641}

Powered by Google App Engine
This is Rietveld 408576698