Changeset 220751 in webkit
- Timestamp:
- Aug 15, 2017 12:35:11 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r220750 r220751 1 2017-08-15 Chris Dumez <cdumez@apple.com> 2 3 Implement quota limitation for keepalive Fetch requests 4 https://bugs.webkit.org/show_bug.cgi?id=175482 5 6 Reviewed by Sam Weinig and Youenn Fablet. 7 8 * fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt: 9 * http/tests/contentextensions/async-xhr-onerror-expected.txt: 10 * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt: 11 * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt: 12 * http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt: 13 Rebaseline a few tests now that we provide a more helpful error message when an XHR is failing synchronously. 14 15 * http/wpt/beacon/beacon-quota-expected.txt: Added. 16 * http/wpt/beacon/beacon-quota.html: Added. 17 Add layout test coverage for keepalive Fetch requests quota in the context of sendBeacon(). 18 The second part of the test is still failing because WebCore does not currently know when 19 ping loads (e.g. beacon loads) complete. This will be addressed via Bug 175443. 20 1 21 2017-08-15 Darin Adler <darin@apple.com> 2 22 -
trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt
r220707 r220751 1 1 CONSOLE MESSAGE: line 64: Not allowed to load local resource: nonexistent.html 2 CONSOLE MESSAGE: line 64: XMLHttpRequest cannot load nonexistent.html due to access control checks.2 CONSOLE MESSAGE: line 64: XMLHttpRequest cannot load nonexistent.html. Not allowed to request resource 3 3 4 4 Bug 22475: REGRESSION: Async XMLHttpRequest never finishes on nonexistent files anymore -
trunk/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt
r220707 r220751 1 1 CONSOLE MESSAGE: line 30: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/async-xhr-onerror.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js 2 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks.2 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js. Resource blocked by content blocker 3 3 CONSOLE MESSAGE: line 30: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/async-xhr-onerror.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js 4 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks.4 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js. Resource blocked by content blocker 5 5 Asynchronous onreadystatechange status: 0, readyState:1, responseText: 6 6 Finished runTest. Waiting for callbacks -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt
r220707 r220751 3 3 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame 4 4 CONSOLE MESSAGE: Blocked mixed content http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi because 'block-all-mixed-content' appears in the Content Security Policy. 5 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi due to access control checks.5 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi. Not allowed to request resource 6 6 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame 7 7 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt
r220707 r220751 5 5 main frame - didCommitLoadForFrame 6 6 CONSOLE MESSAGE: Blocked mixed content http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi because 'block-all-mixed-content' appears in the Content Security Policy. 7 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi due to access control checks.7 CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-basic-allow-star.cgi. Not allowed to request resource 8 8 main frame - didFinishDocumentLoadForFrame 9 9 main frame - didHandleOnloadEventsForFrame -
trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt
r220707 r220751 1 1 CONSOLE MESSAGE: line 28: [blocked] The page at https://127.0.0.1:8443/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html was not allowed to display insecure content from http://127.0.0.1:8000/. 2 2 3 CONSOLE MESSAGE: line 28: XMLHttpRequest cannot load http://127.0.0.1:8000/ due to access control checks.3 CONSOLE MESSAGE: line 28: XMLHttpRequest cannot load http://127.0.0.1:8000/. Not allowed to request resource 4 4 This test opens a HTTPS window that loads insecure data via XHR. We should trigger a mixed content callback because the main frame in the window is HTTPS but now has insecure data. -
trunk/LayoutTests/imported/w3c/ChangeLog
r220733 r220751 1 2017-08-15 Chris Dumez <cdumez@apple.com> 2 3 Implement quota limitation for keepalive Fetch requests 4 https://bugs.webkit.org/show_bug.cgi?id=175482 5 6 Reviewed by Sam Weinig and Youenn Fablet. 7 8 * web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt: 9 * web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt: 10 * web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt: 11 * web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt: 12 * web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt: 13 * web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt: 14 * web-platform-tests/fetch/http-cache/cc-request-expected.txt: 15 Rebaseline tests now that we provide a more helpful error message when rejecting 16 the fetch() promise. 17 18 * web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt: 19 Rebaseline test for keepalive Fetch requests quota which is now passing. 20 1 21 2017-08-14 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt
r220707 r220751 6 6 CONSOLE MESSAGE: line 27: Fetch API cannot load about:unicorn. Cross origin requests are only supported for HTTP. 7 7 8 FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"9 FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"8 FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." 9 FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful" 10 FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." 11 11 PASS Fetching about:invalid.com is KO 12 12 PASS Fetching about:config is KO -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt
r220707 r220751 1 1 2 FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"3 FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"4 FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error"2 FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." 3 FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful" 4 FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." 5 5 PASS Fetching about:invalid.com is KO 6 6 PASS Fetching about:config is KO -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt
r220707 r220751 12 12 CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/preflight.py?origin=%2C%20http%3A%2F%2Fexample.com%2C%20https%3A%2F%2Fexample2.com. Access-Control-Allow-Origin cannot contain more than one origin. 13 13 14 FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"15 FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error"16 FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"17 FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error"18 FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"14 FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 15 FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 16 FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 17 FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 18 FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 19 19 PASS 3 origins allowed, no match 20 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt
r220707 r220751 6 6 CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin. 7 7 8 FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"9 FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"11 FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error"12 FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error"8 FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 9 FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 10 FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 11 FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 12 FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." 13 13 PASS 3 origins allowed, no match 14 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt
r220707 r220751 8 8 9 9 PASS CORS that succeeds with credentials: false; method: GET (allowed: get); header: X-Test,1 (allowed: x-test) 10 FAIL CORS that succeeds with credentials: false; method: SUPER (allowed: *); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Type error"11 FAIL CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL CORS that succeeds with credentials: false; method: SUPER (allowed: *); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Method SUPER is not allowed by Access-Control-Allow-Methods." 11 FAIL CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Method OK is not allowed by Access-Control-Allow-Methods." 12 12 PASS CORS that fails with credentials: true; method: OK (allowed: *); header: X-Test,1 (allowed: *) 13 13 PASS CORS that fails with credentials: true; method: PUT (allowed: *); header: undefined (allowed: ) -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt
r220707 r220751 1 1 2 2 PASS CORS that succeeds with credentials: false; method: GET (allowed: get); header: X-Test,1 (allowed: x-test) 3 FAIL CORS that succeeds with credentials: false; method: SUPER (allowed: *); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Type error"4 FAIL CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Type error"3 FAIL CORS that succeeds with credentials: false; method: SUPER (allowed: *); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Method SUPER is not allowed by Access-Control-Allow-Methods." 4 FAIL CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Method OK is not allowed by Access-Control-Allow-Methods." 5 5 PASS CORS that fails with credentials: true; method: OK (allowed: *); header: X-Test,1 (allowed: *) 6 6 PASS CORS that fails with credentials: true; method: PUT (allowed: *); header: undefined (allowed: ) -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-expected.txt
r220707 r220751 1 1 2 FAIL Redirect 301 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"2 FAIL Redirect 301 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 3 3 PASS Redirect 301 21 times 4 FAIL Redirect 302 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"4 FAIL Redirect 302 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 5 5 PASS Redirect 302 21 times 6 FAIL Redirect 303 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"6 FAIL Redirect 303 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 7 7 PASS Redirect 303 21 times 8 FAIL Redirect 307 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"8 FAIL Redirect 307 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 9 9 PASS Redirect 307 21 times 10 FAIL Redirect 308 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL Redirect 308 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 11 11 PASS Redirect 308 21 times 12 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker-expected.txt
r220707 r220751 1 1 2 FAIL Redirect 301 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"2 FAIL Redirect 301 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 3 3 PASS Redirect 301 21 times 4 FAIL Redirect 302 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"4 FAIL Redirect 302 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 5 5 PASS Redirect 302 21 times 6 FAIL Redirect 303 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"6 FAIL Redirect 303 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 7 7 PASS Redirect 303 21 times 8 FAIL Redirect 307 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"8 FAIL Redirect 307 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 9 9 PASS Redirect 307 21 times 10 FAIL Redirect 308 20 times promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL Redirect 308 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" 11 11 PASS Redirect 308 21 times 12 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt
r220707 r220751 1 CONSOLE MESSAGE: line 44: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0. Reached maximum amount of queued data of 64Kb for keepalive requests 2 CONSOLE MESSAGE: line 71: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0. Reached maximum amount of queued data of 64Kb for keepalive requests 3 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Reached maximum amount of queued data of 64Kb for keepalive requests 4 CONSOLE MESSAGE: line 88: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0. Reached maximum amount of queued data of 64Kb for keepalive requests 5 6 Harness Error (FAIL), message = Reached maximum amount of queued data of 64Kb for keepalive requests 1 7 2 8 PASS A Keep-Alive fetch() with a small body should succeed. 3 9 PASS A Keep-Alive fetch() with a body at the Quota Limit should succeed. 4 FAIL A Keep-Alive fetch() with a body over the Quota Limit should reject. assert_unreached: Should have rejected: undefined Reached unreachable code 10 PASS A Keep-Alive fetch() with a body over the Quota Limit should reject. 5 11 PASS A Keep-Alive fetch() should return it's allocated Quota upon promise resolution. 6 12 PASS A Keep-Alive fetch() should return only it's allocated Quota upon promise resolution. 7 FAIL A Keep-Alive fetch() should not be allowed if the Quota is used up. assert_unreached: Should have rejected: undefined Reached unreachable code 13 PASS A Keep-Alive fetch() should not be allowed if the Quota is used up. 8 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt
r220707 r220751 11 11 PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache. 12 12 FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store. assert_equals: Response used expected 2 but got 1 13 FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: Type error"13 FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: can’t load from network" 14 14 -
trunk/LayoutTests/inspector/worker/resources-in-worker-expected.txt
r220707 r220751 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: T ype error1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: The requested URL was not found on this server. 2 2 Test for Resources in a Worker. 3 3 -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt
r220707 r220751 6 6 PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Etag and fresh response 7 7 PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Last-Modified and fresh response 8 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"9 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and fresh response promise_test: Unhandled rejection with value: object "TypeError: Type error"10 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"11 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and stale response promise_test: Unhandled rejection with value: object "TypeError: Type error"8 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response promise_test: Unhandled rejection with value: object "TypeError: resource unavailable" 9 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and fresh response promise_test: Unhandled rejection with value: object "TypeError: resource unavailable" 10 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response promise_test: Unhandled rejection with value: object "TypeError: resource unavailable" 11 FAIL RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and stale response promise_test: Unhandled rejection with value: object "TypeError: resource unavailable" 12 12 PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and fresh response 13 13 PASS RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Last-Modified and fresh response -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt
r220707 r220751 11 11 PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache. 12 12 PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store. 13 FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: Type error"13 FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: can’t load from network" 14 14 -
trunk/Source/WebCore/CMakeLists.txt
r220734 r220751 2071 2071 loader/cache/CachedScript.cpp 2072 2072 loader/cache/CachedXSLStyleSheet.cpp 2073 loader/cache/KeepaliveRequestTracker.cpp 2073 2074 loader/cache/MemoryCache.cpp 2074 2075 -
trunk/Source/WebCore/ChangeLog
r220750 r220751 1 2017-08-15 Chris Dumez <cdumez@apple.com> 2 3 Implement quota limitation for keepalive Fetch requests 4 https://bugs.webkit.org/show_bug.cgi?id=175482 5 6 Reviewed by Sam Weinig and Youenn Fablet. 7 8 Implement quota limitation for keepalive Fetch requests as per: 9 - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9) 10 11 This partly works for Beacon as well, meaning that no Beacon with a body 12 over 64Kb can be sent. However, we don't keep track about wether or not 13 beacon loads are inflight or not. 14 15 Also update CachedResourceLoader::requestResource() so that the caller 16 can get a ResourceError when it returns null. This is useful for both 17 Fetch and Beacon to return better error messages. 18 19 Test: http/wpt/beacon/beacon-quota.html 20 21 * CMakeLists.txt: 22 * Modules/beacon/NavigatorBeacon.cpp: 23 (WebCore::NavigatorBeacon::sendBeacon): 24 * Modules/fetch/FetchBodyOwner.cpp: 25 (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse): 26 (WebCore::FetchBodyOwner::BlobLoader::didFail): 27 * Modules/fetch/FetchBodyOwner.h: 28 * Modules/fetch/FetchLoader.cpp: 29 (WebCore::FetchLoader::start): 30 (WebCore::FetchLoader::didFail): 31 * Modules/fetch/FetchLoaderClient.h: 32 * Modules/fetch/FetchResponse.cpp: 33 (WebCore::FetchResponse::BodyLoader::didFail): 34 * Modules/fetch/FetchResponse.h: 35 * WebCore.xcodeproj/project.pbxproj: 36 * loader/DocumentThreadableLoader.cpp: 37 (WebCore::DocumentThreadableLoader::loadRequest): 38 * loader/cache/CachedResource.cpp: 39 (WebCore::CachedResource::load): 40 * loader/cache/CachedResource.h: 41 (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const): 42 * loader/cache/CachedResourceLoader.cpp: 43 (WebCore::createResource): 44 (WebCore::CachedResourceLoader::requestImage): 45 (WebCore::CachedResourceLoader::requestFont): 46 (WebCore::CachedResourceLoader::requestTextTrack): 47 (WebCore::CachedResourceLoader::requestCSSStyleSheet): 48 (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): 49 (WebCore::CachedResourceLoader::requestScript): 50 (WebCore::CachedResourceLoader::requestXSLStyleSheet): 51 (WebCore::CachedResourceLoader::requestSVGDocument): 52 (WebCore::CachedResourceLoader::requestLinkResource): 53 (WebCore::CachedResourceLoader::requestMedia): 54 (WebCore::CachedResourceLoader::requestIcon): 55 (WebCore::CachedResourceLoader::requestRawResource): 56 (WebCore::CachedResourceLoader::requestBeaconResource): 57 (WebCore::CachedResourceLoader::requestMainResource): 58 (WebCore::CachedResourceLoader::requestResource): 59 (WebCore::CachedResourceLoader::preload): 60 * loader/cache/CachedResourceLoader.h: 61 * loader/cache/KeepaliveRequestTracker.cpp: Added. 62 (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker): 63 (WebCore::KeepaliveRequestTracker::canLoadRequest): 64 (WebCore::KeepaliveRequestTracker::registerRequest): 65 (WebCore::KeepaliveRequestTracker::responseReceived): 66 (WebCore::KeepaliveRequestTracker::notifyFinished): 67 (WebCore::KeepaliveRequestTracker::unregisterRequest): 68 * loader/cache/KeepaliveRequestTracker.h: Added. 69 * platform/network/FormData.cpp: 70 (WebCore::FormDataElement::lengthInBytes const): 71 (WebCore::FormData::lengthInBytes const): 72 * platform/network/FormData.h: 73 1 74 2017-08-15 Darin Adler <darin@apple.com> 2 75 -
trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp
r220707 r220751 74 74 } 75 75 } 76 document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }); 76 ResourceError error; 77 if (!document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }, &error)) { 78 if (!error.isNull()) 79 document.addConsoleMessage(MessageSource::Network, MessageLevel::Error, error.localizedDescription()); 80 return false; 81 } 77 82 return true; 78 83 } -
trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
r220707 r220751 33 33 #include "HTTPParsers.h" 34 34 #include "JSBlob.h" 35 #include "ResourceError.h" 35 36 #include "ResourceResponse.h" 36 37 … … 278 279 { 279 280 if (response.httpStatusCode() != 200) 280 didFail( );281 } 282 283 void FetchBodyOwner::BlobLoader::didFail( )281 didFail({ }); 282 } 283 284 void FetchBodyOwner::BlobLoader::didFail(const ResourceError&) 284 285 { 285 286 // didFail might be called within FetchLoader::start call. -
trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h
r220707 r220751 89 89 void didReceiveResponse(const ResourceResponse&) final; 90 90 void didReceiveData(const char* data, size_t size) final { owner.blobChunk(data, size); } 91 void didFail( ) final;91 void didFail(const ResourceError&) final; 92 92 void didSucceed() final { owner.blobLoadingSucceeded(); } 93 93 -
trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp
r220707 r220751 36 36 #include "FetchLoaderClient.h" 37 37 #include "FetchRequest.h" 38 #include "ResourceError.h" 38 39 #include "ResourceRequest.h" 39 40 #include "ScriptExecutionContext.h" … … 49 50 auto urlForReading = BlobURL::createPublicURL(context.securityOrigin()); 50 51 if (urlForReading.isEmpty()) { 51 m_client.didFail( );52 m_client.didFail({ errorDomainWebKitInternal, 0, URL(), ASCIILiteral("Could not create URL for Blob") }); 52 53 return; 53 54 } … … 89 90 90 91 if (!context.shouldBypassMainWorldContentSecurityPolicy() && !contentSecurityPolicy.allowConnectToSource(fetchRequest.url())) { 91 m_client.didFail( );92 m_client.didFail({ errorDomainWebKitInternal, 0, fetchRequest.url(), ASCIILiteral("Not allowed by ContentSecurityPolicy"), ResourceError::Type::AccessControl }); 92 93 return; 93 94 } … … 145 146 } 146 147 147 void FetchLoader::didFail(const ResourceError& )148 void FetchLoader::didFail(const ResourceError& error) 148 149 { 149 m_client.didFail( );150 m_client.didFail(error); 150 151 } 151 152 -
trunk/Source/WebCore/Modules/fetch/FetchLoaderClient.h
r220707 r220751 33 33 namespace WebCore { 34 34 35 class ResourceError; 35 36 class ResourceResponse; 36 37 … … 44 45 45 46 virtual void didSucceed() = 0; 46 virtual void didFail( ) = 0;47 virtual void didFail(const ResourceError&) = 0; 47 48 }; 48 49 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r220707 r220751 34 34 #include "JSBlob.h" 35 35 #include "JSFetchResponse.h" 36 #include "ResourceError.h" 36 37 #include "ScriptExecutionContext.h" 37 38 … … 139 140 } 140 141 141 void FetchResponse::BodyLoader::didFail( )142 void FetchResponse::BodyLoader::didFail(const ResourceError& error) 142 143 { 143 144 ASSERT(m_response.hasPendingActivity()); 144 145 if (m_promise) 145 std::exchange(m_promise, std::nullopt)->reject( TypeError);146 std::exchange(m_promise, std::nullopt)->reject(Exception { TypeError, String(error.localizedDescription()) }); 146 147 147 148 #if ENABLE(STREAMS_API) -
trunk/Source/WebCore/Modules/fetch/FetchResponse.h
r220707 r220751 119 119 // FetchLoaderClient API 120 120 void didSucceed() final; 121 void didFail( ) final;121 void didFail(const ResourceError&) final; 122 122 void didReceiveResponse(const ResourceResponse&) final; 123 123 void didReceiveData(const char*, size_t) final; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r220732 r220751 3473 3473 83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; }; 3474 3474 83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3475 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */; }; 3476 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3475 3477 83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; }; 3476 3478 83BB5C881D5D6F45005A71F4 /* AllDescendantsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */; }; … … 11598 11600 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; }; 11599 11601 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; }; 11602 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeepaliveRequestTracker.cpp; sourceTree = "<group>"; }; 11603 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeepaliveRequestTracker.h; sourceTree = "<group>"; }; 11600 11604 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; }; 11601 11605 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDescendantsCollection.h; sourceTree = "<group>"; }; … … 22384 22388 BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */, 22385 22389 F587864902DE3A9A01EA4122 /* CachePolicy.h */, 22390 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */, 22391 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */, 22386 22392 BCB16BFE0979C3BD00467741 /* MemoryCache.cpp */, 22387 22393 BCB16BFF0979C3BD00467741 /* MemoryCache.h */, … … 28585 28591 1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */, 28586 28592 BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */, 28593 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */, 28587 28594 85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */, 28588 28595 1AE00D59182DAC8D00087DD7 /* KeyedCoding.h in Headers */, … … 32626 32633 A1C7FAA2133A5D3500D6732D /* JSXPathResultCustom.cpp in Sources */, 32627 32634 BCEFE1EA0DCA5F6400739219 /* JSXSLTProcessor.cpp in Sources */, 32635 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */, 32628 32636 85031B430A44EFC700F992E0 /* KeyboardEvent.cpp in Sources */, 32629 32637 517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */, -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r220707 r220751 452 452 // We create an URL here as the request will be moved in requestRawResource 453 453 URL requestUrl = newRequest.resourceRequest().url(); 454 m_resource = m_document.cachedResourceLoader().requestRawResource(WTFMove(newRequest)); 454 ResourceError error; 455 m_resource = m_document.cachedResourceLoader().requestRawResource(WTFMove(newRequest), &error); 455 456 if (m_resource) 456 457 m_resource->addClient(*this); 457 458 else { 458 // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error. 459 logErrorAndFail(ResourceError(String(), 0, requestUrl, String(), ResourceError::Type::AccessControl)); 459 if (error.isNull()) { 460 // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error. 461 logErrorAndFail(ResourceError(String(), 0, requestUrl, String(), ResourceError::Type::AccessControl)); 462 } else 463 logErrorAndFail(error); 460 464 } 461 465 return; -
trunk/Source/WebCore/loader/cache/CachedRawResource.cpp
r220707 r220751 94 94 95 95 #if USE(QUICK_LOOK) 96 m_allowEncodedDataReplacement = !m_loader->isQuickLookResource();96 m_allowEncodedDataReplacement = m_loader && !m_loader->isQuickLookResource(); 97 97 #endif 98 98 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r220707 r220751 261 261 } 262 262 263 // FIXME: We should not special-case Beacon here. 264 if (m_options.keepAlive && type() == CachedResource::Beacon) { 263 if (m_options.keepAlive) { 264 if (!cachedResourceLoader.keepaliveRequestTracker().tryRegisterRequest(*this)) { 265 setResourceError({ errorDomainWebKitInternal, 0, request.url(), ASCIILiteral("Reached maximum amount of queued data of 64Kb for keepalive requests") }); 266 failBeforeStarting(); 267 return; 268 } 269 // FIXME: We should not special-case Beacon here. 270 if (type() == CachedResource::Beacon) { 265 271 ASSERT(m_origin); 266 // Beacon is not exposed to workers so it is safe to rely on the document here. 267 auto* document = cachedResourceLoader.document(); 268 auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; 269 platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); 270 return; 272 // Beacon is not exposed to workers so it is safe to rely on the document here. 273 auto* document = cachedResourceLoader.document(); 274 auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; 275 platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); 276 // FIXME: We currently do not get notified when ping loads finish so we treat them as finishing right away. 277 finishLoading(nullptr); 278 return; 279 } 271 280 } 272 281 -
trunk/Source/WebCore/loader/cache/CachedResource.h
r220707 r220751 163 163 bool isImage() const { return type() == ImageResource; } 164 164 // FIXME: CachedRawResource could be a main resource, an audio/video resource, or a raw XHR/icon resource. 165 bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource ; }165 bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource || type() == Beacon; } 166 166 167 167 // Whether this request should impact request counting and delay window.onload. -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r220707 r220751 104 104 case CachedResource::FontResource: 105 105 return new CachedFont(WTFMove(request), sessionID); 106 case CachedResource::Beacon: 106 107 case CachedResource::MediaResource: 107 108 case CachedResource::RawResource: … … 109 110 case CachedResource::MainResource: 110 111 return new CachedRawResource(WTFMove(request), type, sessionID); 111 case CachedResource::Beacon:112 return new CachedResource(WTFMove(request), CachedResource::Beacon, sessionID);113 112 #if ENABLE(XSLT) 114 113 case CachedResource::XSLStyleSheet: … … 183 182 } 184 183 185 CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest&& request )184 CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest&& request, ResourceError* error) 186 185 { 187 186 if (Frame* frame = this->frame()) { … … 197 196 198 197 auto defer = clientDefersImage(request.resourceRequest().url()) ? DeferOption::DeferredByClient : DeferOption::NoDefer; 199 return downcast<CachedImage>(requestResource(CachedResource::ImageResource, WTFMove(request), ForPreload::No, defer).get());200 } 201 202 CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG )198 return downcast<CachedImage>(requestResource(CachedResource::ImageResource, WTFMove(request), error, ForPreload::No, defer).get()); 199 } 200 201 CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG, ResourceError* error) 203 202 { 204 203 #if ENABLE(SVG_FONTS) 205 204 if (isSVG) 206 return downcast<CachedSVGFont>(requestResource(CachedResource::SVGFontResource, WTFMove(request) ).get());205 return downcast<CachedSVGFont>(requestResource(CachedResource::SVGFontResource, WTFMove(request), error).get()); 207 206 #else 208 207 UNUSED_PARAM(isSVG); 209 208 #endif 210 return downcast<CachedFont>(requestResource(CachedResource::FontResource, WTFMove(request) ).get());209 return downcast<CachedFont>(requestResource(CachedResource::FontResource, WTFMove(request), error).get()); 211 210 } 212 211 213 212 #if ENABLE(VIDEO_TRACK) 214 CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request )215 { 216 return downcast<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request) ).get());217 } 218 #endif 219 220 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request )221 { 222 return downcast<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request) ).get());223 } 224 225 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request )213 CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request, ResourceError* error) 214 { 215 return downcast<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request), error).get()); 216 } 217 #endif 218 219 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request, ResourceError* error) 220 { 221 return downcast<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request), error).get()); 222 } 223 224 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request, ResourceError*) 226 225 { 227 226 ASSERT(document()); … … 249 248 } 250 249 251 CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(CachedResourceRequest&& request )252 { 253 return downcast<CachedScript>(requestResource(CachedResource::Script, WTFMove(request) ).get());250 CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(CachedResourceRequest&& request, ResourceError* error) 251 { 252 return downcast<CachedScript>(requestResource(CachedResource::Script, WTFMove(request), error).get()); 254 253 } 255 254 256 255 #if ENABLE(XSLT) 257 CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request )258 { 259 return downcast<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request) ).get());260 } 261 #endif 262 263 CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(CachedResourceRequest&& request )264 { 265 return downcast<CachedSVGDocument>(requestResource(CachedResource::SVGDocumentResource, WTFMove(request) ).get());256 CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request, ResourceError* error) 257 { 258 return downcast<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request), error).get()); 259 } 260 #endif 261 262 CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(CachedResourceRequest&& request, ResourceError* error) 263 { 264 return downcast<CachedSVGDocument>(requestResource(CachedResource::SVGDocumentResource, WTFMove(request), error).get()); 266 265 } 267 266 268 267 #if ENABLE(LINK_PREFETCH) 269 CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, CachedResourceRequest&& request )268 CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, CachedResourceRequest&& request, ResourceError* error) 270 269 { 271 270 ASSERT(frame()); 272 271 ASSERT(type == CachedResource::LinkPrefetch || type == CachedResource::LinkSubresource); 273 return requestResource(type, WTFMove(request) );274 } 275 #endif 276 277 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMedia(CachedResourceRequest&& request )278 { 279 return downcast<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request) ).get());280 } 281 282 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestIcon(CachedResourceRequest&& request )283 { 284 return downcast<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request) ).get());285 } 286 287 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request )288 { 289 return downcast<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request) ).get());290 } 291 292 CachedResourceHandle<CachedResource> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request )293 { 294 return requestResource(CachedResource::Beacon, WTFMove(request) ).get();295 } 296 297 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request )298 { 299 return downcast<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request) ).get());272 return requestResource(type, WTFMove(request), error); 273 } 274 #endif 275 276 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMedia(CachedResourceRequest&& request, ResourceError* error) 277 { 278 return downcast<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request), error).get()); 279 } 280 281 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestIcon(CachedResourceRequest&& request, ResourceError* error) 282 { 283 return downcast<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request), error).get()); 284 } 285 286 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request, ResourceError* error) 287 { 288 return downcast<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request), error).get()); 289 } 290 291 CachedResourceHandle<CachedResource> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request, ResourceError* error) 292 { 293 return requestResource(CachedResource::Beacon, WTFMove(request), error).get(); 294 } 295 296 CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request, ResourceError* error) 297 { 298 return downcast<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request), error).get()); 300 299 } 301 300 … … 690 689 } 691 690 692 CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ForPreload forPreload, DeferOption defer)691 CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ResourceError* error, ForPreload forPreload, DeferOption defer) 693 692 { 694 693 if (Document* document = this->document()) … … 701 700 if (!url.isValid()) { 702 701 RELEASE_LOG_IF_ALLOWED("requestResource: URL is invalid (frame = %p)", frame()); 702 if (error) 703 *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("URL is invalid") }; 703 704 return nullptr; 704 705 } … … 709 710 if (!canRequest(type, url, request, forPreload)) { 710 711 RELEASE_LOG_IF_ALLOWED("requestResource: Not allowed to request resource (frame = %p)", frame()); 712 if (error) 713 *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("Not allowed to request resource"), ResourceError::Type::AccessControl }; 711 714 return nullptr; 712 715 } … … 726 729 return resource; 727 730 } 731 if (error) 732 *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("Resource blocked by content blocker"), ResourceError::Type::AccessControl }; 728 733 return nullptr; 729 734 } … … 830 835 if (resource->allowsCaching() && resource->inCache()) 831 836 memoryCache.remove(*resource); 837 if (error) { 838 auto resourceError = resource->resourceError(); 839 // Synchronous cancellations are likely due to access control. 840 *error = !resourceError.isNull() && !resourceError.isCancellation() ? resourceError : ResourceError(String(), 0, url, String(), ResourceError::Type::AccessControl); 841 } 832 842 return nullptr; 833 843 } … … 1246 1256 request.setCharset(m_document->charset()); 1247 1257 1248 CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), ForPreload::Yes);1258 CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), nullptr, ForPreload::Yes); 1249 1259 if (resource && (!m_preloads || !m_preloads->contains(resource.get()))) { 1250 1260 // Fonts need special treatment since just creating the resource doesn't trigger a load. -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.h
r220707 r220751 31 31 #include "CachedResourceRequest.h" 32 32 #include "ContentSecurityPolicy.h" 33 #include "KeepaliveRequestTracker.h" 33 34 #include "ResourceTimingInformation.h" 34 35 #include "Timer.h" … … 72 73 ~CachedResourceLoader(); 73 74 74 CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&& );75 CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&& );76 CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&& );77 CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&& );78 CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&&, bool isSVG );79 CachedResourceHandle<CachedRawResource> requestMedia(CachedResourceRequest&& );80 CachedResourceHandle<CachedRawResource> requestIcon(CachedResourceRequest&& );81 CachedResourceHandle<CachedResource> requestBeaconResource(CachedResourceRequest&& );82 CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&& );83 CachedResourceHandle<CachedRawResource> requestMainResource(CachedResourceRequest&& );84 CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&& );75 CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&&, ResourceError* = nullptr); 76 CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); 77 CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); 78 CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&&, ResourceError* = nullptr); 79 CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&&, bool isSVG, ResourceError* = nullptr); 80 CachedResourceHandle<CachedRawResource> requestMedia(CachedResourceRequest&&, ResourceError* = nullptr); 81 CachedResourceHandle<CachedRawResource> requestIcon(CachedResourceRequest&&, ResourceError* = nullptr); 82 CachedResourceHandle<CachedResource> requestBeaconResource(CachedResourceRequest&&, ResourceError* = nullptr); 83 CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&&, ResourceError* = nullptr); 84 CachedResourceHandle<CachedRawResource> requestMainResource(CachedResourceRequest&&, ResourceError* = nullptr); 85 CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&&, ResourceError* = nullptr); 85 86 #if ENABLE(XSLT) 86 CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(CachedResourceRequest&& );87 CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); 87 88 #endif 88 89 #if ENABLE(LINK_PREFETCH) 89 CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, CachedResourceRequest&& );90 CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, CachedResourceRequest&&, ResourceError* = nullptr); 90 91 #endif 91 92 #if ENABLE(VIDEO_TRACK) 92 CachedResourceHandle<CachedTextTrack> requestTextTrack(CachedResourceRequest&& );93 CachedResourceHandle<CachedTextTrack> requestTextTrack(CachedResourceRequest&&, ResourceError* = nullptr); 93 94 #endif 94 95 … … 147 148 bool isAlwaysOnLoggingAllowed() const; 148 149 150 KeepaliveRequestTracker& keepaliveRequestTracker() { return m_keepaliveRequestTracker; } 151 149 152 private: 150 153 explicit CachedResourceLoader(DocumentLoader*); … … 153 156 enum class DeferOption { NoDefer, DeferredByClient }; 154 157 155 CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&&, ForPreload = ForPreload::No, DeferOption = DeferOption::NoDefer);158 CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&&, ResourceError* = nullptr, ForPreload = ForPreload::No, DeferOption = DeferOption::NoDefer); 156 159 CachedResourceHandle<CachedResource> revalidateResource(CachedResourceRequest&&, CachedResource&); 157 160 CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, CachedResourceRequest&&); … … 194 197 195 198 ResourceTimingInformation m_resourceTimingInfo; 199 KeepaliveRequestTracker m_keepaliveRequestTracker; 196 200 197 201 // 29 bits left -
trunk/Source/WebCore/platform/network/FormData.cpp
r220707 r220751 34 34 #include "Page.h" 35 35 #include "TextEncoding.h" 36 #include "ThreadableBlobRegistry.h" 36 37 37 38 namespace WebCore { … … 125 126 } 126 127 128 uint64_t FormDataElement::lengthInBytes() const 129 { 130 switch (m_type) { 131 case Type::Data: 132 return m_data.size(); 133 case Type::EncodedFile: { 134 if (m_fileLength != BlobDataItem::toEndOfFile) 135 return m_fileLength; 136 long long fileSize; 137 if (getFileSize(m_shouldGenerateFile ? m_generatedFilename : m_filename, fileSize)) 138 return fileSize; 139 return 0; 140 } 141 case Type::EncodedBlob: 142 return blobRegistry().blobSize(m_url); 143 } 144 ASSERT_NOT_REACHED(); 145 return 0; 146 } 147 127 148 FormDataElement FormDataElement::isolatedCopy() const 128 149 { … … 147 168 { 148 169 m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, invalidFileTime(), shouldGenerateFile)); 170 m_lengthInBytes = std::nullopt; 149 171 } 150 172 … … 152 174 { 153 175 m_elements.append(FormDataElement(filename, start, length, expectedModificationTime, shouldGenerateFile)); 176 m_lengthInBytes = std::nullopt; 154 177 } 155 178 … … 157 180 { 158 181 m_elements.append(FormDataElement(blobURL)); 182 m_lengthInBytes = std::nullopt; 159 183 } 160 184 … … 245 269 char* FormData::expandDataStore(size_t size) 246 270 { 271 m_lengthInBytes = std::nullopt; 247 272 if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::Type::Data) 248 273 m_elements.append(FormDataElement()); … … 387 412 } 388 413 414 uint64_t FormData::lengthInBytes() const 415 { 416 if (!m_lengthInBytes) { 417 uint64_t length = 0; 418 for (auto& element : m_elements) 419 length += element.lengthInBytes(); 420 m_lengthInBytes = length; 421 } 422 return *m_lengthInBytes; 423 } 424 389 425 } // namespace WebCore -
trunk/Source/WebCore/platform/network/FormData.h
r220707 r220751 70 70 } 71 71 72 uint64_t lengthInBytes() const; 73 72 74 FormDataElement isolatedCopy() const; 73 75 … … 255 257 } 256 258 259 uint64_t lengthInBytes() const; 260 257 261 private: 258 262 FormData(); … … 270 274 Vector<char> m_boundary; 271 275 bool m_containsPasswordData { false }; 276 mutable std::optional<uint64_t> m_lengthInBytes; 272 277 }; 273 278
Note: See TracChangeset
for help on using the changeset viewer.