|
Include the Origin header for XHR and Fetch API even if the request is same-origin
FrameFetchContext::addAdditionalRequestHeaders() which is used by the
ResourceFetcher to initialize a ResourceRequest uses
ResourceRequest::addHTTPOriginIfNeeded() to add the Origin header. But
this method omits the Origin header if the method is GET or HEAD.
This logic was originally for addressing privacy concerns. But for
cross-origin requests initiated by XHR and Fetch API, we're already
sending the Origin header regardless of the method in use to use the
CORS protocol. Even for same-origin requests, the XHR and Fetch
Standard requires the Origin to be included. Sending the Origin header
for same origin requests never reveals any privacy as the requester
script and the destination server are the same origin. So, add an
option to ThreadableLoaderOptions to add the Origin header for
same-origin requests as well as the cross-origin case where
CrossOriginAccessControl::updateRequestForAccessControl() is called and
it adds the Origin header, and turn on the option for XHR and Fetch API.
See also the spec discussion at https://github.com/whatwg/fetch/issues/91
BUG= 641620, 557621
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+47 lines, -23 lines) |
Patch |
|
M |
third_party/WebKit/LayoutTests/http/tests/cache/resources/xhr-vary-header-response.php
|
View
|
1
|
1 chunk |
+3 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/cache/resources/xhr-vary-header-subframe.html
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/cache/xhr-vary-header.html
|
View
|
1
|
2 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/cache/xhr-vary-header-expected.txt
|
View
|
1
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/origin-header-same-origin-get-async-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/origin-header-same-origin-get-sync-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/xhr-to-blob-in-isolated-world.html
|
View
|
1
2
|
1 chunk |
+10 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-allowed-with-disabled-web-security-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
|
View
|
|
3 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/loader/ThreadableLoader.h
|
View
|
|
2 chunks |
+10 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
View
|
1
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
Total messages: 8 (8 generated)
|