|
Improve handling of CORS redirects for some resource loads.
To align with what CORS requires for redirects, have CORS-enabled
resource loading perform access control checks on redirects.
The ResourceLoader delegates the access control check to its host's
canAccessRedirect() implementation:
bool ResourceLoaderHost::canAccessRedirect(Resource*, ResourceRequest&, const ResourceResponse&, ResourceLoaderOptions&);
which is passed the redirect request + response along with other
arguments needed to make a yes/no decision on following the redirect.
To correctly handle redirects to another origin, the
canAccessRedirect() predicate is also responsible for updating the
'source origin' as the redirect is followed. This and other redirect
steps are taken care of by the helper method
CrossOriginAccessControl::handleRedirect()
The included tests cover redirects over <img> and <script>, for the
various redirect responses possible (wrt CORS.) Rely on existing
redirect tests for HTML imports.
Notice that the redirect handling added here does not apply to
resource types and loaders that implement their special (and extended)
handling of CORS + redirects -- e.g., XMLHttpRequest fetches.
R=abarth@chromium.org
BUG= 274843
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=166508
Total comments: 4
Total comments: 11
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+841 lines, -60 lines) |
Patch |
|
M |
LayoutTests/http/tests/htmlimports/redirect.html
|
View
|
1
|
2 chunks |
+1 line, -28 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin.html
|
View
|
1
2
|
1 chunk |
+40 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross.html
|
View
|
1
2
|
1 chunk |
+28 lines, -0 lines |
0 comments
|
Download
|
|
A + |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross-expected.txt
|
View
|
1
2
|
1 chunk |
+2 lines, -4 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross-same.html
|
View
|
1
2
|
1 chunk |
+29 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross-same-2.html
|
View
|
1
2
|
1 chunk |
+29 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross-same-2-expected.txt
|
View
|
1
2
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-cross-same-expected.txt
|
View
|
1
2
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/htmlimports/redirect-cross-origin-expected.txt
|
View
|
1
2
|
1 chunk |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
LayoutTests/http/tests/htmlimports/redirect-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-anonymous.html
|
View
|
1
2
|
1 chunk |
+70 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-anonymous-expected.txt
|
View
|
1
2
|
1 chunk |
+18 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-credentials.html
|
View
|
1
2
|
1 chunk |
+86 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-credentials-expected.txt
|
View
|
1
2
|
1 chunk |
+22 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-no-cors.html
|
View
|
1
2
|
1 chunk |
+68 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/img-crossorigin-redirect-no-cors-expected.txt
|
View
|
1
2
|
1 chunk |
+19 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/resources/cors-redirect.php
|
View
|
|
1 chunk |
+10 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/resources/script-allow-credentials.php
|
View
|
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/resources/script-allow-star.php
|
View
|
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-anonymous.html
|
View
|
1
2
|
1 chunk |
+70 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-anonymous-expected.txt
|
View
|
1
2
|
1 chunk |
+18 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-credentials.html
|
View
|
1
2
|
1 chunk |
+86 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-credentials-expected.txt
|
View
|
1
2
|
1 chunk |
+22 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-no-cors.html
|
View
|
1
2
|
1 chunk |
+68 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/http/tests/security/script-crossorigin-redirect-no-cors-expected.txt
|
View
|
1
2
|
1 chunk |
+16 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/CrossOriginAccessControl.h
|
View
|
1
2
3
|
2 chunks |
+9 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/CrossOriginAccessControl.cpp
|
View
|
1
2
3
4
5
|
2 chunks |
+67 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/ResourceFetcher.h
|
View
|
1
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/ResourceFetcher.cpp
|
View
|
1
2
3
4
5
|
3 chunks |
+20 lines, -4 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/ResourceLoader.cpp
|
View
|
1
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/core/fetch/ResourceLoaderHost.h
|
View
|
1
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/core/loader/DocumentThreadableLoader.h
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
Source/core/loader/DocumentThreadableLoader.cpp
|
View
|
1
2
|
2 chunks |
+3 lines, -16 lines |
0 comments
|
Download
|
Total messages: 14 (0 generated)
|