Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fire error event when link preload fails synchronously.
https://bugs.webkit.org/show_bug.cgi?id=246663 rdar://101269688 Reviewed by Youenn Fablet. This fires an error event when fetch fails before scheduling with the Network process when preloading a resource specified by a link element. The code path for firing error events in case of a network error is to return a CachedResource with an error state to a LinkPreloadResourceClient. The client then calls the LinkLoader with the resource and the loader in turn has the HTMLLinkElement fire an event depending on the state of the resource returned. This code path never executes when we block due to CSP since we do not get to the point of scheduling the load with the Network process or even creating the LinkPreloadResourceClient. This change detects that condition and has the HTMLLinkElement fire an error event. See the spec for The fetch and process the linked resource steps here: https://html.spec.whatwg.org/multipage/links.html#preload In particular, we are supposed to return a "network error" when blocking due to CSP and so we should fire an error event: https://fetch.spec.whatwg.org/#main-fetch * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/font-src/font-mismatch-blocked.sub-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/font-src/font-none-blocked.sub-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/reporting/report-preload-and-consume.https-expected.txt: * Source/WebCore/loader/LinkLoader.cpp: (WebCore::LinkLoader::triggerError): (WebCore::LinkLoader::preloadIfNeeded): * Source/WebCore/loader/LinkLoader.h: Canonical link: https://commits.webkit.org/255740@main
- Loading branch information