Changeset 201324 in webkit
- Timestamp:
- May 24, 2016 12:35:09 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 22 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201323 r201324 1 2016-05-24 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Implement Fetch redirect mode 4 https://bugs.webkit.org/show_bug.cgi?id=157837 5 6 Reviewed by Alex Christensen. 7 8 * http/tests/fetch/caching-with-different-options-expected.txt: Added. 9 * http/tests/fetch/caching-with-different-options.html: Added. 10 * http/tests/fetch/resources/redirect-with-cache.php: Added. 11 * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: 12 * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: 13 1 14 2016-05-23 Yoav Weiss <yoav@yoav.ws> 2 15 -
trunk/LayoutTests/imported/w3c/ChangeLog
r201073 r201324 1 2016-05-24 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Implement Fetch redirect mode 4 https://bugs.webkit.org/show_bug.cgi?id=157837 5 6 Reviewed by Alex Christensen. 7 8 * web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: 9 * web-platform-tests/fetch/api/redirect/redirect-location.js: 10 * web-platform-tests/fetch/api/redirect/redirect-method.js: 11 * web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: 12 * web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt: 13 1 14 2016-05-18 Antti Koivisto <antti@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt
r200195 r201324 5 5 PASS Redirect 301 in "manual" mode with invalid location 6 6 PASS Redirect 301 in "follow" mode with data location 7 FAIL Redirect 301 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 7 PASS Redirect 301 in "manual" mode with data location 8 8 PASS Redirect 302 in "follow" mode without location 9 9 PASS Redirect 302 in "manual" mode without location … … 11 11 PASS Redirect 302 in "manual" mode with invalid location 12 12 PASS Redirect 302 in "follow" mode with data location 13 FAIL Redirect 302 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 13 PASS Redirect 302 in "manual" mode with data location 14 14 PASS Redirect 303 in "follow" mode without location 15 15 PASS Redirect 303 in "manual" mode without location … … 17 17 PASS Redirect 303 in "manual" mode with invalid location 18 18 PASS Redirect 303 in "follow" mode with data location 19 FAIL Redirect 303 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 19 PASS Redirect 303 in "manual" mode with data location 20 20 PASS Redirect 307 in "follow" mode without location 21 21 PASS Redirect 307 in "manual" mode without location … … 23 23 PASS Redirect 307 in "manual" mode with invalid location 24 24 PASS Redirect 307 in "follow" mode with data location 25 FAIL Redirect 307 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 25 PASS Redirect 307 in "manual" mode with data location 26 26 PASS Redirect 308 in "follow" mode without location 27 27 PASS Redirect 308 in "manual" mode without location … … 29 29 PASS Redirect 308 in "manual" mode with invalid location 30 30 PASS Redirect 308 in "follow" mode with data location 31 FAIL Redirect 308 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 31 PASS Redirect 308 in "manual" mode with data location 32 32 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js
r200195 r201324 42 42 43 43 redirectLocation("Redirect " + statusCode + " in \"follow\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "follow", false); 44 redirectLocation("Redirect " + statusCode + " in \"manual\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "manual", false);44 redirectLocation("Redirect " + statusCode + " in \"manual\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "manual", true); 45 45 46 46 redirectLocation("Redirect " + statusCode + " in \"follow\" mode with data location", redirUrl, dataLocationUrl, statusCode, "follow", false); -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt
r200195 r201324 1 1 2 PASS Response.redirected should be false on not-redirected responses 2 3 PASS Redirect 301 with GET 3 4 PASS Redirect 301 with POST -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js
r200195 r201324 18 18 assert_equals(resp.type, "basic", "Response's type basic"); 19 19 assert_equals(resp.headers.get("x-request-method"), expectedMethod, "Request method after redirection is " + expectedMethod); 20 assert_true(resp.redirected); 20 21 return resp.text().then(function(text) { 21 22 assert_equals(text, expectedMethod == "POST" ? requestInit.body : ""); … … 24 25 }, desc); 25 26 } 27 28 promise_test(function(test) { 29 assert_false(new Response().redirected); 30 return fetch(RESOURCES_DIR + "method.py").then(function(resp) { 31 assert_equals(resp.status, 200, "Response's status is 200"); 32 assert_false(resp.redirected); 33 }); 34 }, "Response.redirected should be false on not-redirected responses"); 26 35 27 36 var redirUrl = RESOURCES_DIR + "redirect.py"; -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt
r200195 r201324 1 1 2 FAIL Redirect 301 in "error" mode assert_unreached: Should have rejected. Reached unreachable code 2 PASS Redirect 301 in "error" mode 3 3 PASS Redirect 301 in "follow" mode 4 FAIL Redirect 301 in "manual" mode assert_equals: Response's status is 0 expected 0 but got 200 5 FAIL Redirect 302 in "error" mode assert_unreached: Should have rejected. Reached unreachable code 4 PASS Redirect 301 in "manual" mode 5 PASS Redirect 302 in "error" mode 6 6 PASS Redirect 302 in "follow" mode 7 FAIL Redirect 302 in "manual" mode assert_equals: Response's status is 0 expected 0 but got 200 8 FAIL Redirect 303 in "error" mode assert_unreached: Should have rejected. Reached unreachable code 7 PASS Redirect 302 in "manual" mode 8 PASS Redirect 303 in "error" mode 9 9 PASS Redirect 303 in "follow" mode 10 FAIL Redirect 303 in "manual" mode assert_equals: Response's status is 0 expected 0 but got 200 11 FAIL Redirect 307 in "error" mode assert_unreached: Should have rejected. Reached unreachable code 10 PASS Redirect 303 in "manual" mode 11 PASS Redirect 307 in "error" mode 12 12 PASS Redirect 307 in "follow" mode 13 FAIL Redirect 307 in "manual" mode assert_equals: Response's status is 0 expected 0 but got 200 14 FAIL Redirect 308 in "error" mode assert_unreached: Should have rejected. Reached unreachable code 13 PASS Redirect 307 in "manual" mode 14 PASS Redirect 308 in "error" mode 15 15 PASS Redirect 308 in "follow" mode 16 FAIL Redirect 308 in "manual" mode assert_equals: Response's status is 0 expected 0 but got 200 16 PASS Redirect 308 in "manual" mode 17 17 -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt
r200195 r201324 7 7 PASS Redirect 301 in "manual" mode with invalid location 8 8 PASS Redirect 301 in "follow" mode with data location 9 FAIL Redirect 301 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 9 PASS Redirect 301 in "manual" mode with data location 10 10 PASS Redirect 302 in "follow" mode without location 11 11 PASS Redirect 302 in "manual" mode without location … … 13 13 PASS Redirect 302 in "manual" mode with invalid location 14 14 PASS Redirect 302 in "follow" mode with data location 15 FAIL Redirect 302 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Type error" 15 PASS Redirect 302 in "manual" mode with data location 16 16 PASS Redirect 303 in "follow" mode without location 17 17 PASS Redirect 303 in "manual" mode without location 18 18 PASS Redirect 303 in "follow" mode with invalid location 19 TIMEOUT Redirect 303 in "manual" mode with invalid location Test timed out 20 TIMEOUT Redirect 303 in "follow" mode with data location Test timed out 21 TIMEOUT Redirect 303 in "manual" mode with data location Test timed out 22 TIMEOUT Redirect 307 in "follow" mode without location Test timed out 23 TIMEOUT Redirect 307 in "manual" mode without location Test timed out 24 TIMEOUT Redirect 307 in "follow" mode with invalid location Test timed out 25 TIMEOUT Redirect 307 in "manual" mode with invalid location Test timed out 26 TIMEOUT Redirect 307 in "follow" mode with data location Test timed out 27 TIMEOUT Redirect 307 in "manual" mode with data location Test timed out 28 TIMEOUT Redirect 308 in "follow" mode without location Test timed out 29 TIMEOUT Redirect 308 in "manual" mode without location Test timed out 19 PASS Redirect 303 in "manual" mode with invalid location 20 PASS Redirect 303 in "follow" mode with data location 21 PASS Redirect 303 in "manual" mode with data location 22 PASS Redirect 307 in "follow" mode without location 23 PASS Redirect 307 in "manual" mode without location 24 PASS Redirect 307 in "follow" mode with invalid location 25 PASS Redirect 307 in "manual" mode with invalid location 26 PASS Redirect 307 in "follow" mode with data location 27 PASS Redirect 307 in "manual" mode with data location 28 PASS Redirect 308 in "follow" mode without location 29 PASS Redirect 308 in "manual" mode without location 30 30 TIMEOUT Redirect 308 in "follow" mode with invalid location Test timed out 31 31 TIMEOUT Redirect 308 in "manual" mode with invalid location Test timed out -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt
r200195 r201324 1 1 2 PASS Response.redirected should be false on not-redirected responses 2 3 PASS Redirect 301 with GET 3 4 PASS Redirect 301 with POST -
trunk/Source/WebCore/ChangeLog
r201322 r201324 1 2016-05-24 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Fetch API] Implement Fetch redirect mode 4 https://bugs.webkit.org/show_bug.cgi?id=157837 5 6 Reviewed by Alex Christensen. 7 8 Implementing step 5 of https://fetch.spec.whatwg.org/#http-fetch. 9 Making ResourceLoaderOptions include FetchOptions. 10 This allows SubresourceLoader to follow or not redirections based on that option. 11 CachedResource is made responsible to handle the type of the response (opaqueredirect, opaque, cors, basic...). 12 If redirection is not to be followed, either an error is returned or an empty response is returned. 13 14 Moved Response type and redirected flag from FetchResponse to ResourceResponse. 15 This allows CachedResource to easily communicate that information to FetchResponse. 16 17 Made some clean-up refactoring in ThreadableLoaderOptions. 18 19 http/tests/fetch/caching-with-different-options.html ensures that 20 caching at CachedResourceLoader will not have bad effects on fetch. 21 Covered by updated and rebased tests. 22 23 * Modules/fetch/FetchLoader.cpp: 24 (WebCore::FetchLoader::start): 25 * Modules/fetch/FetchResponse.cpp: 26 (WebCore::FetchResponse::error): 27 (WebCore::FetchResponse::redirect): 28 (WebCore::FetchResponse::FetchResponse): 29 (WebCore::FetchResponse::clone): 30 (WebCore::FetchResponse::startFetching): 31 * Modules/fetch/FetchResponse.h: 32 * WebCore.xcodeproj/project.pbxproj: 33 * loader/FetchOptions.h: Moved from Source/WebCore/Modules/fetch/FetchOptions.h. 34 * loader/ResourceLoaderOptions.h: 35 (WebCore::ResourceLoaderOptions::fetchOptions): 36 (WebCore::ResourceLoaderOptions::setFetchOptions): 37 * loader/SubresourceLoader.cpp: 38 (WebCore::SubresourceLoader::willSendRequestInternal): 39 * loader/ThreadableLoader.cpp: 40 * loader/ThreadableLoader.h: 41 * loader/cache/CachedResource.cpp: 42 (WebCore::CachedResource::setResponse): 43 * loader/cache/CachedResource.h: 44 (WebCore::CachedResource::setOpaqueRedirect): 45 * platform/network/ResourceResponseBase.cpp: 46 (WebCore::ResourceResponseBase::adopt): 47 (WebCore::ResourceResponseBase::copyData): 48 * platform/network/ResourceResponseBase.h: 49 (WebCore::ResourceResponseBase::type): 50 (WebCore::ResourceResponseBase::setType): 51 (WebCore::ResourceResponseBase::encode): 52 (WebCore::ResourceResponseBase::decode): 53 1 54 2016-05-23 Yusuke Suzuki <utatane.tea@gmail.com> 2 55 -
trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp
r199641 r201324 69 69 70 70 m_loader = ThreadableLoader::create(&context, this, request, options); 71 m_isStarted = true;71 m_isStarted = m_loader; 72 72 } 73 73 … … 83 83 options.crossOriginRequestPolicy = DenyCrossOriginRequests; 84 84 options.contentSecurityPolicyEnforcement = ContentSecurityPolicyEnforcement::DoNotEnforce; 85 options.setFetchOptions(request.fetchOptions()); 85 86 86 87 m_loader = ThreadableLoader::create(&context, this, request.internalRequest(), options); 87 m_isStarted = true;88 m_isStarted = m_loader; 88 89 } 89 90 … … 97 98 { 98 99 m_data = nullptr; 99 if (m_loader) { 100 RefPtr<ThreadableLoader> loader = WTFMove(m_loader); 101 loader->cancel(); 102 } 100 if (m_loader) 101 m_loader->cancel(); 103 102 } 104 103 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r201013 r201324 52 52 Ref<FetchResponse> FetchResponse::error(ScriptExecutionContext& context) 53 53 { 54 return adoptRef(*new FetchResponse(context, Type::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { })); 54 auto response = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { })); 55 response->m_response.setType(Type::Error); 56 return response; 55 57 } 56 58 … … 67 69 return nullptr; 68 70 } 69 auto redirectResponse = adoptRef(*new FetchResponse(context, Type::Default,{ }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));71 auto redirectResponse = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { })); 70 72 redirectResponse->m_response.setHTTPStatusCode(status); 71 73 redirectResponse->m_headers->fastSet(HTTPHeaderName::Location, requestURL.string()); … … 110 112 } 111 113 112 FetchResponse::FetchResponse(ScriptExecutionContext& context, Type type,FetchBody&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response)114 FetchResponse::FetchResponse(ScriptExecutionContext& context, FetchBody&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response) 113 115 : FetchBodyOwner(context, WTFMove(body)) 114 , m_type(type)115 116 , m_response(WTFMove(response)) 116 117 , m_headers(WTFMove(headers)) … … 124 125 return nullptr; 125 126 } 126 auto cloned = adoptRef(*new FetchResponse(context, m_type, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response))); 127 cloned->m_isRedirected = m_isRedirected; 128 return WTFMove(cloned); 127 return adoptRef(*new FetchResponse(context, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response))); 129 128 } 130 129 131 130 void FetchResponse::startFetching(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise) 132 131 { 133 auto response = adoptRef(*new FetchResponse(context, Type::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));132 auto response = adoptRef(*new FetchResponse(context, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), { })); 134 133 135 134 // Setting pending activity until BodyLoader didFail or didSucceed callback is called. … … 174 173 } 175 174 #endif 176 m_response.m_bodyLoader = Nullopt; 175 if (m_loader->isStarted()) 176 m_response.m_bodyLoader = Nullopt; 177 177 m_response.unsetPendingActivity(&m_response); 178 178 } -
trunk/Source/WebCore/Modules/fetch/FetchResponse.h
r201013 r201324 49 49 class FetchResponse final : public FetchBodyOwner { 50 50 public: 51 enum class Type { Basic, Cors, Default, Error, Opaque, Opaqueredirect };51 using Type = ResourceResponse::Type; 52 52 53 static Ref<FetchResponse> create(ScriptExecutionContext& context) { return adoptRef(*new FetchResponse(context, Type::Default,{ }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }53 static Ref<FetchResponse> create(ScriptExecutionContext& context) { return adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); } 54 54 static Ref<FetchResponse> error(ScriptExecutionContext&); 55 55 static RefPtr<FetchResponse> redirect(ScriptExecutionContext&, const String&, int, ExceptionCode&); … … 61 61 void initializeWith(const Dictionary&, ExceptionCode&); 62 62 63 Type type() const ;63 Type type() const { return m_response.type(); } 64 64 const String& url() const { return m_response.url().string(); } 65 bool redirected() const { return m_ isRedirected; }65 bool redirected() const { return m_response.isRedirected(); } 66 66 int status() const { return m_response.httpStatusCode(); } 67 67 bool ok() const { return status() >= 200 && status() <= 299; } … … 77 77 78 78 private: 79 FetchResponse(ScriptExecutionContext&, Type,FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&);79 FetchResponse(ScriptExecutionContext&, FetchBody&&, Ref<FetchHeaders>&&, ResourceResponse&&); 80 80 81 81 static void startFetching(ScriptExecutionContext&, const FetchRequest&, FetchPromise&&); … … 101 101 void didSucceed() final; 102 102 void didFail() final; 103 void didReceiveResponse(const ResourceResponse&) ;103 void didReceiveResponse(const ResourceResponse&) final; 104 104 void didReceiveData(const char*, size_t) final; 105 105 void didFinishLoadingAsArrayBuffer(RefPtr<ArrayBuffer>&&) final; … … 110 110 }; 111 111 112 Type m_type;113 112 ResourceResponse m_response; 114 113 Ref<FetchHeaders> m_headers; 115 bool m_isRedirected = false;116 114 Optional<BodyLoader> m_bodyLoader; 117 115 }; 118 119 inline auto FetchResponse::type() const -> Type120 {121 return m_type;122 }123 116 124 117 } // namespace WebCore -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r201290 r201324 1572 1572 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; }; 1573 1573 41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */; }; 1574 41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 41AD75391CEF6BCE00A31486 /* FetchOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1574 1575 41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1575 1576 41BF700F0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */; }; … … 9070 9071 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerThread.cpp; sourceTree = "<group>"; }; 9071 9072 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorkerThread.h; sourceTree = "<group>"; }; 9073 41AD75391CEF6BCE00A31486 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = "<group>"; }; 9072 9074 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagePortChannel.h; sourceTree = "<group>"; }; 9073 9075 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformMessagePortChannel.cpp; path = default/PlatformMessagePortChannel.cpp; sourceTree = "<group>"; }; … … 9092 9094 41F54F841C50C4F600338488 /* FetchHeaders.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchHeaders.idl; sourceTree = "<group>"; }; 9093 9095 41F54F851C50C4F600338488 /* FetchHeaders.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchHeaders.js; sourceTree = "<group>"; }; 9094 41F54F861C50C4F600338488 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = "<group>"; };9095 9096 41F54F871C50C4F600338488 /* FetchRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchRequest.cpp; sourceTree = "<group>"; }; 9096 9097 41F54F881C50C4F600338488 /* FetchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchRequest.h; sourceTree = "<group>"; }; … … 16838 16839 4147E2B51C89912600A7E715 /* FetchLoader.h */, 16839 16840 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */, 16840 41F54F861C50C4F600338488 /* FetchOptions.h */,16841 16841 41F54F871C50C4F600338488 /* FetchRequest.cpp */, 16842 16842 41F54F881C50C4F600338488 /* FetchRequest.h */, … … 22727 22727 F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */, 22728 22728 B255990D0D00D8B900BB825C /* EmptyClients.h */, 22729 41AD75391CEF6BCE00A31486 /* FetchOptions.h */, 22729 22730 656D37230ADBA5DE00A4554D /* FormState.cpp */, 22730 22731 656D37220ADBA5DE00A4554D /* FormState.h */, … … 28247 28248 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */, 28248 28249 0813A4EA1284132600992511 /* SVGStaticPropertyTearOff.h in Headers */, 28250 41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */, 28249 28251 B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */, 28250 28252 B2227AAC0D00BF220071B782 /* SVGStringList.h in Headers */, -
trunk/Source/WebCore/loader/FetchOptions.h
r201323 r201324 29 29 #pragma once 30 30 31 #if ENABLE(FETCH_API)32 33 31 namespace WebCore { 34 32 … … 57 55 58 56 } // namespace WebCore 59 60 #endif // ENABLE(FETCH_API) -
trunk/Source/WebCore/loader/ResourceLoaderOptions.h
r195770 r201324 32 32 #define ResourceLoaderOptions_h 33 33 34 #include "FetchOptions.h" 34 35 #include "ResourceHandleTypes.h" 35 36 … … 136 137 CachingPolicy cachingPolicy() const { return m_cachingPolicy; } 137 138 void setCachingPolicy(CachingPolicy cachingPolicy) { m_cachingPolicy = cachingPolicy; } 139 FetchOptions fetchOptions() const { return m_fetchOptions; } 140 void setFetchOptions(FetchOptions fetchOptions) { m_fetchOptions = fetchOptions; } 138 141 139 142 unsigned m_sendLoadCallbacks : 1; … … 149 152 DefersLoadingPolicy m_defersLoadingPolicy { DefersLoadingPolicy::AllowDefersLoading }; 150 153 CachingPolicy m_cachingPolicy { CachingPolicy::AllowCaching }; 154 FetchOptions m_fetchOptions; 151 155 }; 152 156 -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r200895 r201324 176 176 ASSERT(!newRequest.isNull()); 177 177 if (!redirectResponse.isNull()) { 178 if (options().fetchOptions().redirect != FetchOptions::Redirect::Follow) { 179 if (options().fetchOptions().redirect == FetchOptions::Redirect::Error) { 180 cancel(); 181 return; 182 } 183 m_resource->setOpaqueRedirect(); 184 m_resource->responseReceived({ }); 185 didFinishLoading(currentTime()); 186 return; 187 } 188 178 189 // CachedResources are keyed off their original request URL. 179 190 // Requesting the same original URL a second time can redirect to a unique second resource. -
trunk/Source/WebCore/loader/ThreadableLoader.cpp
r197551 r201324 43 43 44 44 ThreadableLoaderOptions::ThreadableLoaderOptions() 45 : preflightPolicy(ConsiderPreflight)46 , crossOriginRequestPolicy(DenyCrossOriginRequests)47 45 { 48 46 } -
trunk/Source/WebCore/loader/ThreadableLoader.h
r197551 r201324 73 73 std::unique_ptr<ThreadableLoaderOptions> isolatedCopy() const; 74 74 75 PreflightPolicy preflightPolicy ; // If AccessControl is used, how to determine if a preflight is needed.76 CrossOriginRequestPolicy crossOriginRequestPolicy ;75 PreflightPolicy preflightPolicy { ConsiderPreflight }; 76 CrossOriginRequestPolicy crossOriginRequestPolicy { DenyCrossOriginRequests }; 77 77 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective }; 78 78 RefPtr<SecurityOrigin> securityOrigin; -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r199650 r201324 412 412 } 413 413 414 void CachedResource::setResponse(const ResourceResponse& response) 415 { 416 m_response = response; 417 m_response.setType(m_responseType); 418 m_response.setRedirected(m_redirectChainCacheStatus.status != RedirectChainCacheStatus::NoRedirection); 419 } 420 414 421 void CachedResource::responseReceived(const ResourceResponse& response) 415 422 { -
trunk/Source/WebCore/loader/cache/CachedResource.h
r199881 r201324 200 200 virtual void responseReceived(const ResourceResponse&); 201 201 virtual bool shouldCacheResponse(const ResourceResponse&) { return true; } 202 void setResponse(const ResourceResponse& response) { m_response = response; } 202 void setResponse(const ResourceResponse&); 203 void setOpaqueRedirect() { m_responseType = ResourceResponseBase::Type::Opaqueredirect; } 203 204 const ResourceResponse& response() const { return m_response; } 204 205 // This is the same as response() except after HTTP redirect to data: URL. … … 282 283 ResourceLoaderOptions m_options; 283 284 ResourceResponse m_response; 285 ResourceResponseBase::Type m_responseType { ResourceResponseBase::Type::Basic }; 284 286 ResourceResponse m_redirectResponseForSameOriginPolicyChecks; 285 287 RefPtr<SharedBuffer> m_data; -
trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp
r199590 r201324 79 79 response->m_httpHeaderFields.adopt(WTFMove(data->m_httpHeaders)); 80 80 response->m_resourceLoadTiming = data->m_resourceLoadTiming; 81 response->m_type = data->m_type; 81 82 response->doPlatformAdopt(WTFMove(data)); 82 83 return response; … … 95 96 data->m_httpHeaders = httpHeaderFields().copyData(); 96 97 data->m_resourceLoadTiming = m_resourceLoadTiming; 98 data->m_type = m_type; 97 99 return asResourceResponse().doPlatformCopyData(WTFMove(data)); 98 100 } -
trunk/Source/WebCore/platform/network/ResourceResponseBase.h
r200909 r201324 129 129 } 130 130 131 enum class Type { Basic, Cors, Default, Error, Opaque, Opaqueredirect }; 132 Type type() const { return m_type; } 133 void setType(Type type) { m_type = type; } 134 bool isRedirected() const { return m_isRedirected; } 135 void setRedirected(bool isRedirected) { m_isRedirected = isRedirected; } 136 131 137 static bool compare(const ResourceResponse&, const ResourceResponse&); 132 138 … … 190 196 191 197 Source m_source { Source::Unknown }; 198 199 Type m_type { Type::Default }; 200 bool m_isRedirected { false }; 192 201 }; 193 202 … … 216 225 encoder << m_certificateInfo; 217 226 encoder.encodeEnum(m_source); 227 encoder.encodeEnum(m_type); 228 encoder << m_isRedirected; 218 229 } 219 230 … … 255 266 } 256 267 if (!decoder.decodeEnum(response.m_source)) 268 return false; 269 if (!decoder.decodeEnum(response.m_type)) 270 return false; 271 if (!decoder.decode(response.m_isRedirected)) 257 272 return false; 258 273 response.m_isNull = false; … … 274 289 std::unique_ptr<CrossThreadHTTPHeaderMapData> m_httpHeaders; 275 290 ResourceLoadTiming m_resourceLoadTiming; 291 ResourceResponseBase::Type m_type; 292 bool m_isRedirected; 276 293 }; 277 294
Note: See TracChangeset
for help on using the changeset viewer.