Changeset 220622 in webkit
- Timestamp:
- Aug 11, 2017 7:51:13 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r220617 r220622 1 2017-08-11 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-11 Ryan Haddad <ryanhaddad@apple.com> 2 22 -
trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt
r210610 r220622 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
r204163 r220622 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
r209577 r220622 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
r209577 r220622 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
r204163 r220622 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
r220494 r220622 1 2017-08-11 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-09 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt
r220050 r220622 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
r215515 r220622 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
r217069 r220622 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
r217069 r220622 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
r215515 r220622 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
r215515 r220622 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
r215540 r220622 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
r215540 r220622 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
r213882 r220622 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
r215164 r220622 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
r215916 r220622 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
r215515 r220622 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
r215164 r220622 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
r220619 r220622 2075 2075 loader/cache/CachedScript.cpp 2076 2076 loader/cache/CachedXSLStyleSheet.cpp 2077 loader/cache/KeepaliveRequestTracker.cpp 2077 2078 loader/cache/MemoryCache.cpp 2078 2079 -
trunk/Source/WebCore/ChangeLog
r220621 r220622 1 2017-08-11 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-11 Don Olmstead <don.olmstead@sony.com> 2 75 -
trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp
r220366 r220622 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
r220320 r220622 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
r220320 r220622 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
r220320 r220622 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
r220241 r220622 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
r220320 r220622 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
r220320 r220622 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
r220621 r220622 3476 3476 83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; }; 3477 3477 83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3478 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */; }; 3479 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3478 3480 83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; }; 3479 3481 83BB5C881D5D6F45005A71F4 /* AllDescendantsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */; }; … … 11600 11602 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; }; 11601 11603 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; }; 11604 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeepaliveRequestTracker.cpp; sourceTree = "<group>"; }; 11605 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeepaliveRequestTracker.h; sourceTree = "<group>"; }; 11602 11606 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; }; 11603 11607 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDescendantsCollection.h; sourceTree = "<group>"; }; … … 22366 22370 BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */, 22367 22371 F587864902DE3A9A01EA4122 /* CachePolicy.h */, 22372 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */, 22373 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */, 22368 22374 BCB16BFE0979C3BD00467741 /* MemoryCache.cpp */, 22369 22375 BCB16BFF0979C3BD00467741 /* MemoryCache.h */, … … 26819 26825 A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */, 26820 26826 6550B6A2099DF0270090D781 /* Comment.h in Headers */, 26821 511CA67E1F3905A60019E074 /* ServiceWorkerJob.h in Headers */,26822 26827 57E664FC1E73703300765536 /* CommonCryptoDERUtilities.h in Headers */, 26823 26828 E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */, … … 27542 27547 977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */, 27543 27548 93F198E608245E59001E9ABC /* HTMLElement.h in Headers */, 27544 51BEB6391F3B94B0005029B9 /* ServiceWorkerRegistrationOptions.h in Headers */,27545 27549 A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */, 27546 27550 977B37241228721700B81FF8 /* HTMLElementStack.h in Headers */, … … 28571 28575 1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */, 28572 28576 BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */, 28577 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */, 28573 28578 85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */, 28574 28579 1AE00D59182DAC8D00087DD7 /* KeyedCoding.h in Headers */, … … 28801 28806 07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */, 28802 28807 CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */, 28803 511CA6801F39331F0019E074 /* ServiceWorkerJobClient.h in Headers */,28804 28808 CDF2B0191820540700F2B424 /* MockTracks.h in Headers */, 28805 28809 C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, … … 29114 29118 41103AAC1E39791000769F03 /* RealtimeOutgoingAudioSource.h in Headers */, 29115 29119 BC4368E80C226E32005EFB5F /* Rect.h in Headers */, 29116 511CA6841F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.h in Headers */,29117 29120 FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */, 29118 29121 9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */, … … 29459 29462 5182C2411F313A090059BA7C /* ServiceWorkerContainer.h in Headers */, 29460 29463 5182C2431F313A090059BA7C /* ServiceWorkerGlobalScope.h in Headers */, 29464 511CA67E1F3905A60019E074 /* ServiceWorkerJob.h in Headers */, 29465 511CA6801F39331F0019E074 /* ServiceWorkerJobClient.h in Headers */, 29466 511CA67A1F3904B10019E074 /* ServiceWorkerProvider.h in Headers */, 29461 29467 5182C2451F313A090059BA7C /* ServiceWorkerRegistration.h in Headers */, 29462 29468 51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */, … … 29793 29799 B2227A780D00BF220071B782 /* SVGPathSegLinetoHorizontal.h in Headers */, 29794 29800 83C1D430178D5AB500141E68 /* SVGPathSegLinetoHorizontalAbs.h in Headers */, 29795 511CA67A1F3904B10019E074 /* ServiceWorkerProvider.h in Headers */,29796 29801 83C1D431178D5AB500141E68 /* SVGPathSegLinetoHorizontalRel.h in Headers */, 29797 29802 83C1D432178D5AB500141E68 /* SVGPathSegLinetoRel.h in Headers */, … … 31510 31515 5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */, 31511 31516 4969B0F213D0B33F00DF3521 /* HitTestingTransformState.cpp in Sources */, 31512 511CA6831F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.cpp in Sources */,31513 31517 2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */, 31514 31518 9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */, … … 32579 32583 E182568F0EF2B02D00933242 /* JSWorkerGlobalScope.cpp in Sources */, 32580 32584 E1C36D340EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp in Sources */, 32581 511CA6791F3904B10019E074 /* ServiceWorkerProvider.cpp in Sources */,32582 32585 E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */, 32583 32586 E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */, … … 32600 32603 A1C7FAA2133A5D3500D6732D /* JSXPathResultCustom.cpp in Sources */, 32601 32604 BCEFE1EA0DCA5F6400739219 /* JSXSLTProcessor.cpp in Sources */, 32605 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */, 32602 32606 85031B430A44EFC700F992E0 /* KeyboardEvent.cpp in Sources */, 32603 32607 517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */, … … 33126 33130 A8DF4AF00980C42C0052981B /* RenderTableRow.cpp in Sources */, 33127 33131 A8DF4AED0980C42C0052981B /* RenderTableSection.cpp in Sources */, 33128 511CA67D1F3905A60019E074 /* ServiceWorkerJob.cpp in Sources */,33129 33132 BCEA488B097D93020094C9E4 /* RenderText.cpp in Sources */, 33130 33133 AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */, … … 33312 33315 5182C2401F313A090059BA7C /* ServiceWorkerContainer.cpp in Sources */, 33313 33316 5182C2421F313A090059BA7C /* ServiceWorkerGlobalScope.cpp in Sources */, 33317 511CA67D1F3905A60019E074 /* ServiceWorkerJob.cpp in Sources */, 33318 511CA6791F3904B10019E074 /* ServiceWorkerProvider.cpp in Sources */, 33314 33319 5182C2441F313A090059BA7C /* ServiceWorkerRegistration.cpp in Sources */, 33320 511CA6831F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.cpp in Sources */, 33315 33321 511F7D441EB1C39100E47B83 /* SessionID.cpp in Sources */, 33316 33322 93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */, -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r220320 r220622 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/CachedResource.cpp
r220549 r220622 260 260 } 261 261 262 // FIXME: We should not special-case Beacon here. 263 if (m_options.keepAlive && type() == CachedResource::Beacon) { 262 if (m_options.keepAlive) { 263 if (!cachedResourceLoader.keepaliveRequestTracker().tryRegisterRequest(*this)) { 264 setResourceError({ errorDomainWebKitInternal, 0, request.url(), ASCIILiteral("Reached maximum amount of queued data of 64Kb for keepalive requests") }); 265 failBeforeStarting(); 266 return; 267 } 268 // FIXME: We should not special-case Beacon here. 269 if (type() == CachedResource::Beacon) { 264 270 ASSERT(m_origin); 265 // Beacon is not exposed to workers so it is safe to rely on the document here. 266 auto* document = cachedResourceLoader.document(); 267 auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; 268 platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); 269 return; 271 // Beacon is not exposed to workers so it is safe to rely on the document here. 272 auto* document = cachedResourceLoader.document(); 273 auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; 274 platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); 275 // FIXME: We currently do not get notified when ping loads finish so we treat them as finishing right away. 276 finishLoading(nullptr); 277 return; 278 } 270 279 } 271 280 -
trunk/Source/WebCore/loader/cache/CachedResource.h
r220303 r220622 164 164 bool isImage() const { return type() == ImageResource; } 165 165 // FIXME: CachedRawResource could be a main resource, an audio/video resource, or a raw XHR/icon resource. 166 bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource ; }166 bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource || type() == Beacon; } 167 167 bool ignoreForRequestCount() const 168 168 { -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r220303 r220622 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 *error = resource->resourceError(); 832 839 return nullptr; 833 840 } … … 1246 1253 request.setCharset(m_document->charset()); 1247 1254 1248 CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), ForPreload::Yes);1255 CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), nullptr, ForPreload::Yes); 1249 1256 if (resource && (!m_preloads || !m_preloads->contains(resource.get()))) { 1250 1257 // Fonts need special treatment since just creating the resource doesn't trigger a load. -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.h
r220303 r220622 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
r210828 r220622 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
r201623 r220622 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(); … … 260 264 261 265 void appendKeyValuePairItems(const FormDataList&, const TextEncoding&, bool isMultiPartForm, Document*, EncodingType = FormURLEncoded); 262 263 266 bool hasGeneratedFiles() const; 264 267 bool hasOwnedGeneratedFiles() const; … … 270 273 Vector<char> m_boundary; 271 274 bool m_containsPasswordData { false }; 275 mutable std::optional<uint64_t> m_lengthInBytes; 272 276 }; 273 277
Note: See TracChangeset
for help on using the changeset viewer.