[Beacon] Improve error reporting
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Aug 2017 00:27:59 +0000 (00:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Aug 2017 00:27:59 +0000 (00:27 +0000)
commit298ba43acb83f8cfbf6ba354b522a7d59ab4fad9
tree748e45c6f79d7a9a697ab105f67ab915324d19ff
parent1b48a95bad72b1b028b93781b47f42eefd9eb51c
[Beacon] Improve error reporting
https://bugs.webkit.org/show_bug.cgi?id=175723

Reviewed by Darin Adler.

Source/WebCore:

Have Ping loads such as beacons report errors via their completion handler.
The Beacon API is using this error to log a console message when beacon loads
fail, provided that the page is still alive.

Test: http/wpt/beacon/beacon-async-error-logging.html

* Modules/beacon/NavigatorBeacon.cpp:
(WebCore::NavigatorBeacon::NavigatorBeacon):
(WebCore::NavigatorBeacon::~NavigatorBeacon):
(WebCore::NavigatorBeacon::from):
(WebCore::NavigatorBeacon::supplementName):
(WebCore::NavigatorBeacon::notifyFinished):
(WebCore::NavigatorBeacon::logError):
(WebCore::NavigatorBeacon::sendBeacon):
* Modules/beacon/NavigatorBeacon.h:
* loader/LoaderStrategy.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestBeaconResource):
* loader/cache/CachedResourceLoader.h:
* platform/network/PingHandle.h:

Source/WebKit:

Have Ping loads such as beacons report errors via their completion handler.
The Beacon API is using this error to log a console message when beacon loads
fail, provided that the page is still alive.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::loadPing):
(WebKit::NetworkConnectionToWebProcess::didFinishPingLoad):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::~PingLoad):
(WebKit::PingLoad::didFinish):
(WebKit::PingLoad::willPerformHTTPRedirection):
(WebKit::PingLoad::didReceiveChallenge):
(WebKit::PingLoad::didReceiveResponseNetworkSession):
(WebKit::PingLoad::didCompleteWithError):
(WebKit::PingLoad::wasBlocked):
(WebKit::PingLoad::cannotShowURL):
(WebKit::PingLoad::timeoutTimerFired):
(WebKit::PingLoad::currentRequest const):
(WebKit::PingLoad::makeCrossOriginAccessRequestWithPreflight):
* NetworkProcess/PingLoad.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didFinishPingLoad):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Network/NetworkProcessConnection.messages.in:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::networkProcessCrashed):
(WebKit::WebLoaderStrategy::startPingLoad):
(WebKit::WebLoaderStrategy::didFinishPingLoad):
* WebProcess/Network/WebLoaderStrategy.h:

Source/WebKitLegacy:

Have Ping loads such as beacons report errors via their completion handler.
The Beacon API is using this error to log a console message when beacon loads
fail, provided that the page is still alive.

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::startPingLoad):
* WebCoreSupport/WebResourceLoadScheduler.h:

LayoutTests:

Add layout test coverage.

* http/wpt/beacon/beacon-async-error-logging-expected.txt: Added.
* http/wpt/beacon/beacon-async-error-logging.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/beacon/beacon-async-error-logging.html [new file with mode: 0644]
LayoutTests/http/wpt/beacon/beacon-quota-expected.txt
LayoutTests/http/wpt/beacon/beacon-quota.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/beacon/NavigatorBeacon.cpp
Source/WebCore/Modules/beacon/NavigatorBeacon.h
Source/WebCore/loader/LoaderStrategy.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.h
Source/WebCore/platform/network/PingHandle.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/PingLoad.cpp
Source/WebKit/NetworkProcess/PingLoad.h
Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h