WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
175482_Fetch_keepalive_quota_wip.patch (text/plain), 60.58 KB, created by
Chris Dumez
on 2017-08-11 11:27:14 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-08-11 11:27:14 PDT
Size:
60.58 KB
patch
obsolete
>diff --git a/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt b/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt >index f9eee904ae5..ec7ecfb69a7 100644 >--- a/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt >+++ b/LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt >@@ -1,5 +1,5 @@ > CONSOLE MESSAGE: line 64: Not allowed to load local resource: nonexistent.html >-CONSOLE MESSAGE: line 64: XMLHttpRequest cannot load nonexistent.html due to access control checks. >+CONSOLE MESSAGE: line 64: XMLHttpRequest cannot load nonexistent.html. Not allowed to request resource > > Bug 22475: REGRESSION: Async XMLHttpRequest never finishes on nonexistent files anymore > >diff --git a/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt b/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt >index 3f2aa09775e..d40b123a253 100644 >--- a/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt >+++ b/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt >@@ -1,7 +1,7 @@ > 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 >-CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks. >+CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js. Resource blocked by content blocker > 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 >-CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks. >+CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js. Resource blocked by content blocker > Asynchronous onreadystatechange status: 0, readyState:1, responseText: > Finished runTest. Waiting for callbacks > Asynchronous onreadystatechange status: 0, readyState:1, responseText: >diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt b/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt >index 5d3fbb75cac..89516e33917 100644 >--- a/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt >+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt >@@ -2,7 +2,7 @@ frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame > main frame - didFinishDocumentLoadForFrame > frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame > 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. >-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. >+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 > frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame > frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame > main frame - didHandleOnloadEventsForFrame >diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt b/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt >index c8e65e2dae9..3f6476f0b9c 100644 >--- a/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt >+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt >@@ -4,7 +4,7 @@ main frame - didHandleOnloadEventsForFrame > main frame - didFinishLoadForFrame > main frame - didCommitLoadForFrame > 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. >-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. >+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 > main frame - didFinishDocumentLoadForFrame > main frame - didHandleOnloadEventsForFrame > main frame - didFinishLoadForFrame >diff --git a/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt b/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt >index 7fcfdd1dd15..c42e555e343 100644 >--- a/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt >+++ b/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt >@@ -1,4 +1,4 @@ > 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/. > >-CONSOLE MESSAGE: line 28: XMLHttpRequest cannot load http://127.0.0.1:8000/ due to access control checks. >+CONSOLE MESSAGE: line 28: XMLHttpRequest cannot load http://127.0.0.1:8000/. Not allowed to request resource > 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. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >index b608de73670..c12cfa71ad3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >@@ -5,9 +5,9 @@ CONSOLE MESSAGE: line 27: Fetch API cannot load about:invalid.com. Cross origin > CONSOLE MESSAGE: line 27: Fetch API cannot load about:config. Cross origin requests are only supported for HTTP. > CONSOLE MESSAGE: line 27: Fetch API cannot load about:unicorn. Cross origin requests are only supported for HTTP. > >-FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >+FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >+FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful" >+FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." > PASS Fetching about:invalid.com is KO > PASS Fetching about:config is KO > PASS Fetching about:unicorn is KO >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >index 93992602d35..6304a83beba 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >@@ -1,7 +1,7 @@ > >-FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Type error" >+FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >+FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful" >+FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." > PASS Fetching about:invalid.com is KO > PASS Fetching about:config is KO > PASS Fetching about:unicorn is KO >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt >index 49f3ce5e352..8da7aa69595 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt >@@ -11,10 +11,10 @@ CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources > CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin. > 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. > >-FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >+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." >+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." >+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." >+FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." >+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." > PASS 3 origins allowed, no match > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt >index 909cc92d314..81037f7a100 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt >@@ -5,10 +5,10 @@ CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin > CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin. > CONSOLE MESSAGE: Access-Control-Allow-Origin cannot contain more than one origin. > >-FAIL 3 origins allowed, match the 3rd (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match the 3rd ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice (http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Type error" >-FAIL 3 origins allowed, match twice ("*" and http://localhost:8800) promise_test: Unhandled rejection with value: object "TypeError: Type error" >+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." >+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." >+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." >+FAIL 3 origins allowed, match twice ("*") promise_test: Unhandled rejection with value: object "TypeError: Access-Control-Allow-Origin cannot contain more than one origin." >+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." > PASS 3 origins allowed, no match > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt >index 07a66db2606..918ef8d07a5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt >@@ -7,8 +7,8 @@ CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/resources > CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/resources/preflight.py?origin=http://localhost:8800&credentials&allow_methods=*&allow_headers=*&. Request header field X-Test is not allowed by Access-Control-Allow-Headers. > > PASS CORS that succeeds with credentials: false; method: GET (allowed: get); header: X-Test,1 (allowed: x-test) >-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" >-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" >+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." >+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." > PASS CORS that fails with credentials: true; method: OK (allowed: *); header: X-Test,1 (allowed: *) > PASS CORS that fails with credentials: true; method: PUT (allowed: *); header: undefined (allowed: ) > PASS CORS that fails with credentials: true; method: PUT (allowed: put); header: undefined (allowed: *) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt >index ae4cf83e342..82cf622f39a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt >@@ -1,7 +1,7 @@ > > PASS CORS that succeeds with credentials: false; method: GET (allowed: get); header: X-Test,1 (allowed: x-test) >-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" >-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" >+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." >+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." > PASS CORS that fails with credentials: true; method: OK (allowed: *); header: X-Test,1 (allowed: *) > PASS CORS that fails with credentials: true; method: PUT (allowed: *); header: undefined (allowed: ) > PASS CORS that fails with credentials: true; method: PUT (allowed: put); header: undefined (allowed: *) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >index 6b52eb7a46c..f5e5efdb20c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >@@ -1,8 +1,14 @@ >+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 >+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 >+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Reached maximum amount of queued data of 64Kb for keepalive requests >+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 >+ >+Harness Error (FAIL), message = Reached maximum amount of queued data of 64Kb for keepalive requests > > PASS A Keep-Alive fetch() with a small body should succeed. > PASS A Keep-Alive fetch() with a body at the Quota Limit should succeed. >-FAIL A Keep-Alive fetch() with a body over the Quota Limit should reject. assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS A Keep-Alive fetch() with a body over the Quota Limit should reject. > PASS A Keep-Alive fetch() should return it's allocated Quota upon promise resolution. > PASS A Keep-Alive fetch() should return only it's allocated Quota upon promise resolution. >-FAIL A Keep-Alive fetch() should not be allowed if the Quota is used up. assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS A Keep-Alive fetch() should not be allowed if the Quota is used up. > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >index d5f23f91581..9c1ea17235e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >@@ -10,5 +10,5 @@ PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control > PASS HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache. > PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache. > FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store. assert_equals: Response used expected 2 but got 1 >-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" >+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" > >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 33cdd4c88dd..34733487eda 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -2069,6 +2069,7 @@ set(WebCore_SOURCES > loader/cache/CachedSVGFont.cpp > loader/cache/CachedScript.cpp > loader/cache/CachedXSLStyleSheet.cpp >+ loader/cache/KeepaliveRequestTracker.cpp > loader/cache/MemoryCache.cpp > > loader/icon/IconLoader.cpp >diff --git a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >index 2c1991bf7f5..8b2f5a7802a 100644 >--- a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >+++ b/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp >@@ -73,7 +73,12 @@ ExceptionOr<bool> NavigatorBeacon::sendBeacon(Navigator&, Document& document, co > options.mode = FetchOptions::Mode::NoCors; > } > } >- document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }); >+ ResourceError error; >+ if (!document.cachedResourceLoader().requestBeaconResource({ WTFMove(request), options }, &error)) { >+ if (!error.isNull()) >+ document.addConsoleMessage(MessageSource::Network, MessageLevel::Error, error.localizedDescription()); >+ return false; >+ } > return true; > } > >diff --git a/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp b/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >index 37d30f8c577..6bc1d9ab260 100644 >--- a/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >+++ b/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp >@@ -32,6 +32,7 @@ > #include "FetchLoader.h" > #include "HTTPParsers.h" > #include "JSBlob.h" >+#include "ResourceError.h" > #include "ResourceResponse.h" > > namespace WebCore { >@@ -277,10 +278,10 @@ FetchBodyOwner::BlobLoader::BlobLoader(FetchBodyOwner& owner) > void FetchBodyOwner::BlobLoader::didReceiveResponse(const ResourceResponse& response) > { > if (response.httpStatusCode() != 200) >- didFail(); >+ didFail({ }); > } > >-void FetchBodyOwner::BlobLoader::didFail() >+void FetchBodyOwner::BlobLoader::didFail(const ResourceError&) > { > // didFail might be called within FetchLoader::start call. > if (loader->isStarted()) >diff --git a/Source/WebCore/Modules/fetch/FetchBodyOwner.h b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >index c3213e97213..5b83d2671f0 100644 >--- a/Source/WebCore/Modules/fetch/FetchBodyOwner.h >+++ b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >@@ -88,7 +88,7 @@ private: > // FetchLoaderClient API > void didReceiveResponse(const ResourceResponse&) final; > void didReceiveData(const char* data, size_t size) final { owner.blobChunk(data, size); } >- void didFail() final; >+ void didFail(const ResourceError&) final; > void didSucceed() final { owner.blobLoadingSucceeded(); } > > FetchBodyOwner& owner; >diff --git a/Source/WebCore/Modules/fetch/FetchLoader.cpp b/Source/WebCore/Modules/fetch/FetchLoader.cpp >index e3a51f1ae84..781828801f9 100644 >--- a/Source/WebCore/Modules/fetch/FetchLoader.cpp >+++ b/Source/WebCore/Modules/fetch/FetchLoader.cpp >@@ -35,6 +35,7 @@ > #include "FetchBody.h" > #include "FetchLoaderClient.h" > #include "FetchRequest.h" >+#include "ResourceError.h" > #include "ResourceRequest.h" > #include "ScriptExecutionContext.h" > #include "SecurityOrigin.h" >@@ -48,7 +49,7 @@ void FetchLoader::start(ScriptExecutionContext& context, const Blob& blob) > { > auto urlForReading = BlobURL::createPublicURL(context.securityOrigin()); > if (urlForReading.isEmpty()) { >- m_client.didFail(); >+ m_client.didFail({ errorDomainWebKitInternal, 0, URL(), ASCIILiteral("Could not create URL for Blob") }); > return; > } > >@@ -88,7 +89,7 @@ void FetchLoader::start(ScriptExecutionContext& context, const FetchRequest& req > contentSecurityPolicy.upgradeInsecureRequestIfNeeded(fetchRequest, ContentSecurityPolicy::InsecureRequestType::Load); > > if (!context.shouldBypassMainWorldContentSecurityPolicy() && !contentSecurityPolicy.allowConnectToSource(fetchRequest.url())) { >- m_client.didFail(); >+ m_client.didFail({ errorDomainWebKitInternal, 0, URL(), ASCIILiteral("Not allowed by ContentSecurityPolicy"), ResourceError::Type::AccessControl }); > return; > } > >@@ -144,9 +145,9 @@ void FetchLoader::didFinishLoading(unsigned long) > m_client.didSucceed(); > } > >-void FetchLoader::didFail(const ResourceError&) >+void FetchLoader::didFail(const ResourceError& error) > { >- m_client.didFail(); >+ m_client.didFail(error); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/fetch/FetchLoaderClient.h b/Source/WebCore/Modules/fetch/FetchLoaderClient.h >index 195f1ef204f..cbff9bd91fc 100644 >--- a/Source/WebCore/Modules/fetch/FetchLoaderClient.h >+++ b/Source/WebCore/Modules/fetch/FetchLoaderClient.h >@@ -32,6 +32,7 @@ > > namespace WebCore { > >+class ResourceError; > class ResourceResponse; > > class FetchLoaderClient { >@@ -43,7 +44,7 @@ public: > virtual void didReceiveData(const char*, size_t) { } > > virtual void didSucceed() = 0; >- virtual void didFail() = 0; >+ virtual void didFail(const ResourceError&) = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.cpp b/Source/WebCore/Modules/fetch/FetchResponse.cpp >index 68adb559fe9..22532c44050 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.cpp >+++ b/Source/WebCore/Modules/fetch/FetchResponse.cpp >@@ -33,6 +33,7 @@ > #include "HTTPParsers.h" > #include "JSBlob.h" > #include "JSFetchResponse.h" >+#include "ResourceError.h" > #include "ScriptExecutionContext.h" > > namespace WebCore { >@@ -138,11 +139,11 @@ void FetchResponse::BodyLoader::didSucceed() > } > } > >-void FetchResponse::BodyLoader::didFail() >+void FetchResponse::BodyLoader::didFail(const ResourceError& error) > { > ASSERT(m_response.hasPendingActivity()); > if (m_promise) >- std::exchange(m_promise, std::nullopt)->reject(TypeError); >+ std::exchange(m_promise, std::nullopt)->reject(Exception { TypeError, String(error.localizedDescription()) }); > > #if ENABLE(STREAMS_API) > if (m_response.m_readableStreamSource) { >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.h b/Source/WebCore/Modules/fetch/FetchResponse.h >index f9b02fb0e58..540e67b39cc 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.h >+++ b/Source/WebCore/Modules/fetch/FetchResponse.h >@@ -118,7 +118,7 @@ private: > private: > // FetchLoaderClient API > void didSucceed() final; >- void didFail() final; >+ void didFail(const ResourceError&) final; > void didReceiveResponse(const ResourceResponse&) final; > void didReceiveData(const char*, size_t) final; > >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 8aa57aded53..a7b709c8b46 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -3457,6 +3457,8 @@ > 839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; }; > 83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; }; > 83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */; }; >+ 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; }; > 83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; }; > 83BB5C881D5D6F45005A71F4 /* AllDescendantsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */; }; > 83C05A5A1A686212007E5DEA /* StylePropertyShorthandFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */; }; >@@ -11561,6 +11563,8 @@ > 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; }; > 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; }; > 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; }; >+ 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeepaliveRequestTracker.cpp; sourceTree = "<group>"; }; >+ 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeepaliveRequestTracker.h; sourceTree = "<group>"; }; > 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; }; > 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDescendantsCollection.h; sourceTree = "<group>"; }; > 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; }; >@@ -22331,6 +22335,8 @@ > BCB16C0E0979C3BD00467741 /* CachedXSLStyleSheet.cpp */, > BCB16C0F0979C3BD00467741 /* CachedXSLStyleSheet.h */, > F587864902DE3A9A01EA4122 /* CachePolicy.h */, >+ 83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */, >+ 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */, > BCB16BFE0979C3BD00467741 /* MemoryCache.cpp */, > BCB16BFF0979C3BD00467741 /* MemoryCache.h */, > ); >@@ -27818,6 +27824,7 @@ > 77D5101C1ED722BF00DA4C87 /* JSCredentialsContainer.h in Headers */, > 77D510021ED4F71800DA4C87 /* JSCredentialUserData.h in Headers */, > 975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */, >+ 83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */, > E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */, > E1C657131815F9DD00256CDD /* JSCryptoAlgorithmDictionary.h in Headers */, > 5739E12F1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h in Headers */, >@@ -32313,6 +32320,7 @@ > B2FA3D900AB75A6F000E5AC4 /* JSSVGFESpotLightElement.cpp in Sources */, > B2FA3D920AB75A6F000E5AC4 /* JSSVGFETileElement.cpp in Sources */, > B2FA3D940AB75A6F000E5AC4 /* JSSVGFETurbulenceElement.cpp in Sources */, >+ 83B74EF51F3E0BF200996BC7 /* KeepaliveRequestTracker.cpp in Sources */, > B2FA3D960AB75A6F000E5AC4 /* JSSVGFilterElement.cpp in Sources */, > B27B28250CEF0C0700D39D54 /* JSSVGFontElement.cpp in Sources */, > A83B79040CCAFF15000B0825 /* JSSVGFontFaceElement.cpp in Sources */, >diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp >index 7ee60beafdc..548b163fdce 100644 >--- a/Source/WebCore/loader/DocumentThreadableLoader.cpp >+++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp >@@ -451,12 +451,16 @@ void DocumentThreadableLoader::loadRequest(ResourceRequest&& request, SecurityCh > > // We create an URL here as the request will be moved in requestRawResource > URL requestUrl = newRequest.resourceRequest().url(); >- m_resource = m_document.cachedResourceLoader().requestRawResource(WTFMove(newRequest)); >+ ResourceError error; >+ m_resource = m_document.cachedResourceLoader().requestRawResource(WTFMove(newRequest), &error); > if (m_resource) > m_resource->addClient(*this); > else { >- // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error. >- logErrorAndFail(ResourceError(String(), 0, requestUrl, String(), ResourceError::Type::AccessControl)); >+ if (error.isNull()) { >+ // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error. >+ logErrorAndFail(ResourceError(String(), 0, requestUrl, String(), ResourceError::Type::AccessControl)); >+ } else >+ logErrorAndFail(error); > } > return; > } >diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp >index 86ebe784e37..9d3799d9832 100644 >--- a/Source/WebCore/loader/cache/CachedResource.cpp >+++ b/Source/WebCore/loader/cache/CachedResource.cpp >@@ -266,6 +266,8 @@ void CachedResource::load(CachedResourceLoader& cachedResourceLoader) > auto* document = cachedResourceLoader.document(); > auto* contentSecurityPolicy = document && !document->shouldBypassMainWorldContentSecurityPolicy() ? document->contentSecurityPolicy() : nullptr; > platformStrategies()->loaderStrategy()->createPingHandle(frame.loader().networkingContext(), request, *m_origin, contentSecurityPolicy, m_options); >+ // FIXME: We currently do not get notified when ping loads finish so we treat them as finishing right away. >+ finishLoading(nullptr); > return; > } > >diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h >index 8ba98e59682..5d2c99ecb10 100644 >--- a/Source/WebCore/loader/cache/CachedResource.h >+++ b/Source/WebCore/loader/cache/CachedResource.h >@@ -163,7 +163,7 @@ public: > > bool isImage() const { return type() == ImageResource; } > // FIXME: CachedRawResource could be a main resource, an audio/video resource, or a raw XHR/icon resource. >- bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource; } >+ bool isMainOrMediaOrIconOrRawResource() const { return type() == MainResource || type() == MediaResource || type() == Icon || type() == RawResource || type() == Beacon; } > bool ignoreForRequestCount() const > { > return m_resourceRequest.ignoreForRequestCount() >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >index 830ce51cb47..4bfc7ab70a0 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >@@ -103,13 +103,12 @@ static CachedResource* createResource(CachedResource::Type type, CachedResourceR > #endif > case CachedResource::FontResource: > return new CachedFont(WTFMove(request), sessionID); >+ case CachedResource::Beacon: > case CachedResource::MediaResource: > case CachedResource::RawResource: > case CachedResource::Icon: > case CachedResource::MainResource: > return new CachedRawResource(WTFMove(request), type, sessionID); >- case CachedResource::Beacon: >- return new CachedResource(WTFMove(request), CachedResource::Beacon, sessionID); > #if ENABLE(XSLT) > case CachedResource::XSLStyleSheet: > return new CachedXSLStyleSheet(WTFMove(request), sessionID); >@@ -182,7 +181,7 @@ SessionID CachedResourceLoader::sessionID() const > return sessionID; > } > >-CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest&& request) >+CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResourceRequest&& request, ResourceError* error) > { > if (Frame* frame = this->frame()) { > if (frame->loader().pageDismissalEventBeingDispatched() != FrameLoader::PageDismissalType::None) { >@@ -196,33 +195,33 @@ CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(CachedResou > } > > auto defer = clientDefersImage(request.resourceRequest().url()) ? DeferOption::DeferredByClient : DeferOption::NoDefer; >- return downcast<CachedImage>(requestResource(CachedResource::ImageResource, WTFMove(request), ForPreload::No, defer).get()); >+ return downcast<CachedImage>(requestResource(CachedResource::ImageResource, WTFMove(request), error, ForPreload::No, defer).get()); > } > >-CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG) >+CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG, ResourceError* error) > { > #if ENABLE(SVG_FONTS) > if (isSVG) >- return downcast<CachedSVGFont>(requestResource(CachedResource::SVGFontResource, WTFMove(request)).get()); >+ return downcast<CachedSVGFont>(requestResource(CachedResource::SVGFontResource, WTFMove(request), error).get()); > #else > UNUSED_PARAM(isSVG); > #endif >- return downcast<CachedFont>(requestResource(CachedResource::FontResource, WTFMove(request)).get()); >+ return downcast<CachedFont>(requestResource(CachedResource::FontResource, WTFMove(request), error).get()); > } > > #if ENABLE(VIDEO_TRACK) >-CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request) >+CachedResourceHandle<CachedTextTrack> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request)).get()); >+ return downcast<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request), error).get()); > } > #endif > >-CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request) >+CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request)).get()); >+ return downcast<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request), error).get()); > } > >-CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request) >+CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request, ResourceError*) > { > ASSERT(document()); > request.setDomainForCachePartition(*document()); >@@ -248,55 +247,55 @@ CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSSt > return userSheet; > } > >-CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(CachedResourceRequest&& request) >+CachedResourceHandle<CachedScript> CachedResourceLoader::requestScript(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedScript>(requestResource(CachedResource::Script, WTFMove(request)).get()); >+ return downcast<CachedScript>(requestResource(CachedResource::Script, WTFMove(request), error).get()); > } > > #if ENABLE(XSLT) >-CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request) >+CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request)).get()); >+ return downcast<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request), error).get()); > } > #endif > >-CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(CachedResourceRequest&& request) >+CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedSVGDocument>(requestResource(CachedResource::SVGDocumentResource, WTFMove(request)).get()); >+ return downcast<CachedSVGDocument>(requestResource(CachedResource::SVGDocumentResource, WTFMove(request), error).get()); > } > > #if ENABLE(LINK_PREFETCH) >-CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, CachedResourceRequest&& request) >+CachedResourceHandle<CachedResource> CachedResourceLoader::requestLinkResource(CachedResource::Type type, CachedResourceRequest&& request, ResourceError* error) > { > ASSERT(frame()); > ASSERT(type == CachedResource::LinkPrefetch || type == CachedResource::LinkSubresource); >- return requestResource(type, WTFMove(request)); >+ return requestResource(type, WTFMove(request), error); > } > #endif > >-CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMedia(CachedResourceRequest&& request) >+CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMedia(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request)).get()); >+ return downcast<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request), error).get()); > } > >-CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestIcon(CachedResourceRequest&& request) >+CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestIcon(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request)).get()); >+ return downcast<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request), error).get()); > } > >-CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request) >+CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request)).get()); >+ return downcast<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request), error).get()); > } > >-CachedResourceHandle<CachedResource> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request) >+CachedResourceHandle<CachedResource> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request, ResourceError* error) > { >- return requestResource(CachedResource::Beacon, WTFMove(request)).get(); >+ return requestResource(CachedResource::Beacon, WTFMove(request), error).get(); > } > >-CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request) >+CachedResourceHandle<CachedRawResource> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request, ResourceError* error) > { >- return downcast<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request)).get()); >+ return downcast<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request), error).get()); > } > > static MixedContentChecker::ContentType contentTypeFromResourceType(CachedResource::Type type) >@@ -689,7 +688,7 @@ void CachedResourceLoader::updateHTTPRequestHeaders(CachedResource::Type type, C > request.updateAccordingCacheMode(); > } > >-CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ForPreload forPreload, DeferOption defer) >+CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ResourceError* error, ForPreload forPreload, DeferOption defer) > { > if (Document* document = this->document()) > request.upgradeInsecureRequestIfNeeded(*document); >@@ -700,6 +699,8 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache > > if (!url.isValid()) { > RELEASE_LOG_IF_ALLOWED("requestResource: URL is invalid (frame = %p)", frame()); >+ if (error) >+ *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("URL is invalid") }; > return nullptr; > } > >@@ -708,6 +709,8 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache > // We are passing url as well as request, as request url may contain a fragment identifier. > if (!canRequest(type, url, request, forPreload)) { > RELEASE_LOG_IF_ALLOWED("requestResource: Not allowed to request resource (frame = %p)", frame()); >+ if (error) >+ *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("Not allowed to request resource"), ResourceError::Type::AccessControl }; > return nullptr; > } > >@@ -725,6 +728,8 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache > resource->setResourceError(ResourceError(ContentExtensions::WebKitContentBlockerDomain, 0, resourceRequest.url(), WEB_UI_STRING("The URL was blocked by a content blocker", "WebKitErrorBlockedByContentBlocker description"))); > return resource; > } >+ if (error) >+ *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("Resource blocked by content blocker"), ResourceError::Type::AccessControl }; > return nullptr; > } > if (blockedStatus.madeHTTPS >@@ -823,14 +828,25 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache > } > > if ((policy != Use || resource->stillNeedsLoad()) && defer == DeferOption::NoDefer) { >+ if (resource->options().keepAlive && !m_keepaliveRequestTracker.canLoadRequest(*resource)) { >+ if (error) >+ *error = { errorDomainWebKitInternal, 0, url, ASCIILiteral("Reached maximum amount of queued data of 64Kb for keepalive requests") }; >+ return nullptr; >+ } >+ > resource->load(*this); > > // We don't support immediate loads, but we do support immediate failure. > if (resource->errorOccurred()) { > if (resource->allowsCaching() && resource->inCache()) > memoryCache.remove(*resource); >+ if (error) >+ *error = resource->resourceError(); > return nullptr; > } >+ >+ if (resource->options().keepAlive) >+ m_keepaliveRequestTracker.registerRequest(*resource); > } > > if (document() && !document()->loadEventFinished() && !resource->resourceRequest().url().protocolIsData()) >@@ -1245,7 +1261,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::preload(CachedResourc > if (request.charset().isEmpty() && (type == CachedResource::Script || type == CachedResource::CSSStyleSheet)) > request.setCharset(m_document->charset()); > >- CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), ForPreload::Yes); >+ CachedResourceHandle<CachedResource> resource = requestResource(type, WTFMove(request), nullptr, ForPreload::Yes); > if (resource && (!m_preloads || !m_preloads->contains(resource.get()))) { > // Fonts need special treatment since just creating the resource doesn't trigger a load. > if (type == CachedResource::FontResource) >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h >index 71a5b88b7e0..b2df259ee87 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.h >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.h >@@ -30,6 +30,7 @@ > #include "CachedResourceHandle.h" > #include "CachedResourceRequest.h" > #include "ContentSecurityPolicy.h" >+#include "KeepaliveRequestTracker.h" > #include "ResourceTimingInformation.h" > #include "Timer.h" > #include <wtf/HashMap.h> >@@ -71,25 +72,25 @@ public: > static Ref<CachedResourceLoader> create(DocumentLoader* documentLoader) { return adoptRef(*new CachedResourceLoader(documentLoader)); } > ~CachedResourceLoader(); > >- CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&&); >- CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&&); >- CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&&); >- CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&&); >- CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&&, bool isSVG); >- CachedResourceHandle<CachedRawResource> requestMedia(CachedResourceRequest&&); >- CachedResourceHandle<CachedRawResource> requestIcon(CachedResourceRequest&&); >- CachedResourceHandle<CachedResource> requestBeaconResource(CachedResourceRequest&&); >- CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&&); >- CachedResourceHandle<CachedRawResource> requestMainResource(CachedResourceRequest&&); >- CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&&); >+ CachedResourceHandle<CachedImage> requestImage(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedCSSStyleSheet> requestCSSStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedCSSStyleSheet> requestUserCSSStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedScript> requestScript(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedFont> requestFont(CachedResourceRequest&&, bool isSVG, ResourceError* = nullptr); >+ CachedResourceHandle<CachedRawResource> requestMedia(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedRawResource> requestIcon(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedResource> requestBeaconResource(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedRawResource> requestRawResource(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedRawResource> requestMainResource(CachedResourceRequest&&, ResourceError* = nullptr); >+ CachedResourceHandle<CachedSVGDocument> requestSVGDocument(CachedResourceRequest&&, ResourceError* = nullptr); > #if ENABLE(XSLT) >- CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(CachedResourceRequest&&); >+ CachedResourceHandle<CachedXSLStyleSheet> requestXSLStyleSheet(CachedResourceRequest&&, ResourceError* = nullptr); > #endif > #if ENABLE(LINK_PREFETCH) >- CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, CachedResourceRequest&&); >+ CachedResourceHandle<CachedResource> requestLinkResource(CachedResource::Type, CachedResourceRequest&&, ResourceError* = nullptr); > #endif > #if ENABLE(VIDEO_TRACK) >- CachedResourceHandle<CachedTextTrack> requestTextTrack(CachedResourceRequest&&); >+ CachedResourceHandle<CachedTextTrack> requestTextTrack(CachedResourceRequest&&, ResourceError* = nullptr); > #endif > > // Logs an access denied message to the console for the specified URL. >@@ -152,7 +153,7 @@ private: > enum class ForPreload { Yes, No }; > enum class DeferOption { NoDefer, DeferredByClient }; > >- CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&&, ForPreload = ForPreload::No, DeferOption = DeferOption::NoDefer); >+ CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&&, ResourceError* = nullptr, ForPreload = ForPreload::No, DeferOption = DeferOption::NoDefer); > CachedResourceHandle<CachedResource> revalidateResource(CachedResourceRequest&&, CachedResource&); > CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, CachedResourceRequest&&); > >@@ -193,6 +194,7 @@ private: > Timer m_garbageCollectDocumentResourcesTimer; > > ResourceTimingInformation m_resourceTimingInfo; >+ KeepaliveRequestTracker m_keepaliveRequestTracker; > > // 29 bits left > bool m_autoLoadImages : 1; >diff --git a/Source/WebCore/loader/cache/KeepaliveRequestTracker.cpp b/Source/WebCore/loader/cache/KeepaliveRequestTracker.cpp >new file mode 100644 >index 00000000000..4225ba1eec6 >--- /dev/null >+++ b/Source/WebCore/loader/cache/KeepaliveRequestTracker.cpp >@@ -0,0 +1,87 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "KeepaliveRequestTracker.h" >+ >+namespace WebCore { >+ >+const uint64_t maxInflightKeepaliveBytes { 65536 }; // 64 kibibytes as per Fetch specification. >+ >+KeepaliveRequestTracker::~KeepaliveRequestTracker() >+{ >+ auto inflightRequests = WTFMove(m_inflightKeepaliveRequests); >+ for (auto& resource : inflightRequests) >+ resource->removeClient(*this); >+} >+ >+bool KeepaliveRequestTracker::canLoadRequest(CachedResource& resource) >+{ >+ ASSERT(resource.options().keepAlive); >+ auto* body = resource.resourceRequest().httpBody(); >+ if (!body) >+ return true; >+ >+ uint64_t bodySize = body->lengthInBytes(); >+ return m_inflightKeepaliveBytes + bodySize <= maxInflightKeepaliveBytes; >+} >+ >+void KeepaliveRequestTracker::registerRequest(CachedResource& resource) >+{ >+ ASSERT(resource.options().keepAlive); >+ auto* body = resource.resourceRequest().httpBody(); >+ if (!body) >+ return; >+ ASSERT(!m_inflightKeepaliveRequests.contains(&resource)); >+ m_inflightKeepaliveRequests.append(&resource); >+ m_inflightKeepaliveBytes += body->lengthInBytes(); >+ ASSERT(m_inflightKeepaliveBytes <= maxInflightKeepaliveBytes); >+ >+ resource.addClient(*this); >+} >+ >+void KeepaliveRequestTracker::responseReceived(CachedResource& resource, const ResourceResponse&) >+{ >+ // Per Fetch specification, allocated quota should be returned before the promise is resolved, >+ // which is when the response is received. >+ unregisterRequest(resource); >+} >+ >+void KeepaliveRequestTracker::notifyFinished(CachedResource& resource) >+{ >+ unregisterRequest(resource); >+} >+ >+void KeepaliveRequestTracker::unregisterRequest(CachedResource& resource) >+{ >+ ASSERT(resource.options().keepAlive); >+ resource.removeClient(*this); >+ bool wasRemoved = m_inflightKeepaliveRequests.removeFirst(&resource); >+ ASSERT_UNUSED(wasRemoved, wasRemoved); >+ m_inflightKeepaliveBytes -= resource.resourceRequest().httpBody()->lengthInBytes(); >+ ASSERT(m_inflightKeepaliveBytes <= maxInflightKeepaliveBytes); >+} >+ >+} >diff --git a/Source/WebCore/loader/cache/KeepaliveRequestTracker.h b/Source/WebCore/loader/cache/KeepaliveRequestTracker.h >new file mode 100644 >index 00000000000..8f3bde062a4 >--- /dev/null >+++ b/Source/WebCore/loader/cache/KeepaliveRequestTracker.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "CachedRawResourceClient.h" >+#include "CachedResource.h" >+#include "CachedResourceHandle.h" >+#include <wtf/Forward.h> >+ >+namespace WebCore { >+ >+class KeepaliveRequestTracker final : public CachedRawResourceClient { >+public: >+ ~KeepaliveRequestTracker(); >+ bool canLoadRequest(CachedResource&); >+ void registerRequest(CachedResource&); >+ >+ // CachedRawResourceClient. >+ void responseReceived(CachedResource&, const ResourceResponse&) final; >+ void notifyFinished(CachedResource&) final; >+ >+private: >+ void unregisterRequest(CachedResource&); >+ >+ Vector<CachedResourceHandle<CachedResource>> m_inflightKeepaliveRequests; >+ uint64_t m_inflightKeepaliveBytes { 0 }; >+}; >+ >+} >diff --git a/Source/WebCore/platform/network/FormData.cpp b/Source/WebCore/platform/network/FormData.cpp >index 564a05379f5..f73834d3f87 100644 >--- a/Source/WebCore/platform/network/FormData.cpp >+++ b/Source/WebCore/platform/network/FormData.cpp >@@ -124,6 +124,35 @@ Ref<FormData> FormData::isolatedCopy() const > return formData; > } > >+size_t FormDataElement::lengthInBytes() const >+{ >+ switch (m_type) { >+ case Type::Data: >+ return m_data.size(); >+ case Type::EncodedFile: { >+ if (m_fileLength != BlobDataItem::toEndOfFile) >+ return m_fileLength; >+ long long fileSize; >+ if (getFileSize(m_shouldGenerateFile ? m_generatedFilename : m_filename, fileSize)) >+ return fileSize; >+ return 0; >+ } >+ case Type::EncodedBlob: { >+ if (!blobRegistry().isBlobRegistryImpl()) >+ return 0; >+ auto* blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(m_url); >+ if (!blobData) >+ return 0; >+ size_t length = 0; >+ for (auto& blobDataItem : blobData->items()) >+ length += (blobDataItem.length() - blobDataItem.offset()); >+ return length; >+ } >+ } >+ ASSERT_NOT_REACHED(); >+ return 0; >+} >+ > FormDataElement FormDataElement::isolatedCopy() const > { > switch (m_type) { >@@ -386,4 +415,12 @@ void FormData::removeGeneratedFilesIfNeeded() > } > } > >+size_t FormData::lengthInBytes() const >+{ >+ size_t length = 0; >+ for (auto& element : m_elements) >+ length += element.lengthInBytes(); >+ return length; >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/network/FormData.h b/Source/WebCore/platform/network/FormData.h >index 7e44dcaf959..24104df3b9e 100644 >--- a/Source/WebCore/platform/network/FormData.h >+++ b/Source/WebCore/platform/network/FormData.h >@@ -69,6 +69,8 @@ public: > { > } > >+ size_t lengthInBytes() const; >+ > FormDataElement isolatedCopy() const; > > template<typename Encoder> >@@ -254,6 +256,8 @@ public: > return FormURLEncoded; > } > >+ size_t lengthInBytes() const; >+ > private: > FormData(); > FormData(const FormData&);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 175482
:
317939
|
317941
|
317951
|
317955
|
317961
|
317965
|
317968
|
317971
|
317976
|
317984
|
317985
|
318048
|
318051
|
318058
|
318065
|
318068
|
318073
|
318097
|
318110
|
318131