Skip to content

Commit 039ccfe

Browse files
magomezpgorszkowski-igalia
authored andcommitted
Add logging for loading failures
1 parent 61b6e2a commit 039ccfe

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ void WebLocalFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, Reso
293293
#if PLATFORM(GTK) || PLATFORM(WPE)
294294
webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(identifier, m_frame->frameID(), response));
295295
#endif
296+
297+
if (response.httpStatusCode() >= 400) {
298+
String message = "Failed to load resource: the server responded with a status of " + String::number(response.httpStatusCode()) + " (" + response.httpStatusText() + ')';
299+
LOG(Loading,"dispatchDidReceiveResponse->message:%s", message.utf8().data());
300+
}
296301
}
297302

298303
void WebLocalFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, ResourceLoaderIdentifier identifier, int dataLength)
@@ -342,6 +347,8 @@ void WebLocalFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, Resource
342347
#endif
343348

344349
webPage->removeResourceRequest(identifier);
350+
351+
LOG(Loading,"dispatchedDidFailLoading: isTimeout=%d, isCancellation=%d, isAccessControl=%d, errorCode=%d description:%s", error.isTimeout(), error.isCancellation(), error.isAccessControl(), error.errorCode(), error.localizedDescription().utf8().data());
345352
}
346353

347354
bool WebLocalFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int /*length*/)
@@ -712,6 +719,8 @@ void WebLocalFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
712719
// If we have a load listener, notify it.
713720
if (LoadListener* loadListener = m_frame->loadListener())
714721
loadListener->didFailLoad(m_frame.ptr(), error.isCancellation());
722+
723+
LOG(Loading,"dispatchDidFailLoad: isTimeout= %d, isCancellation= %d, isAccessControl= %d, errorCode= %d description: %s", error.isTimeout(), error.isCancellation(), error.isAccessControl(), error.errorCode(), error.localizedDescription().utf8().data());
715724
}
716725

717726
void WebLocalFrameLoaderClient::dispatchDidFinishDocumentLoad()

0 commit comments

Comments
 (0)