CachedResourceRequest should store a SecurityOrigin
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 08:57:12 +0000 (08:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 08:57:12 +0000 (08:57 +0000)
commit29205ab7d2038f7f2de9fc3e89bb27ee70f5f850
tree8c778c82de9fc58d5e7469a3de9ed6db0d325c74
parent69d639d1277967b018c8a4001414f6742ac0d6fa
CachedResourceRequest should store a SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=162258

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-22
Reviewed by Sam Weinig.

Source/WebCore:

Test: http/tests/local/script-crossorigin-loads-file-scheme.html

Passing SecurityOrigin from loader clients to CachedResource through CachedResourceRequest.
This ensures that specific origin properties like universal access are well preserved.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest): Set origin to the request.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource): Setting origin from the request.
Computing CORS state based on that origin.
(WebCore::CachedResource::load): Removing origin computation.
(WebCore::CachedResource::loadFrom): Ditto.
(WebCore::CachedResource::computeOrigin): Deleted.
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
(WebCore::CachedResourceLoader::prepareFetch): Introduced to implement step 1 to 7 of https://fetch.spec.whatwg.org/#fetching.
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceLoader.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): Storing origin.
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::setOrigin):
(WebCore::CachedResourceRequest::releaseOrigin):
(WebCore::CachedResourceRequest::origin):

LayoutTests:

Updated test to expect load even though CORS checks should fail as the document origin has universal access.

* http/tests/local/script-crossorigin-loads-fail-origin-expected.txt: Removed.
* http/tests/local/script-crossorigin-loads-file-scheme-expected.txt: Added.
* http/tests/local/script-crossorigin-loads-file-scheme.html: Renamed from LayoutTests/http/tests/local/script-crossorigin-loads-fail-origin.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206255 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/local/script-crossorigin-loads-fail-origin-expected.txt [deleted file]
LayoutTests/http/tests/local/script-crossorigin-loads-file-scheme-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/local/script-crossorigin-loads-file-scheme.html [moved from LayoutTests/http/tests/local/script-crossorigin-loads-fail-origin.html with 60% similarity]
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h