Skip to content

Commit f1dd8ad

Browse files
committed
Add logging for loading failures
1 parent 3647a8e commit f1dd8ad

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,16 @@ 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+
StringBuilder message;
299+
message.append("Failed to load resource: the server responded with a status of "_s);
300+
message.append(String::number(response.httpStatusCode()));
301+
message.append(" ("_s);
302+
message.append(response.httpStatusText());
303+
message.append(")"_s);
304+
LOG(Loading,"dispatchDidReceiveResponse->message:%s", message.toString().utf8().data());
305+
}
296306
}
297307

298308
void WebLocalFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, ResourceLoaderIdentifier identifier, int dataLength)
@@ -342,6 +352,8 @@ void WebLocalFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, Resource
342352
#endif
343353

344354
webPage->removeResourceRequest(identifier);
355+
356+
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());
345357
}
346358

347359
bool WebLocalFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int /*length*/)
@@ -713,6 +725,8 @@ void WebLocalFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
713725
// If we have a load listener, notify it.
714726
if (LoadListener* loadListener = m_frame->loadListener())
715727
loadListener->didFailLoad(m_frame.ptr(), error.isCancellation());
728+
729+
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());
716730
}
717731

718732
void WebLocalFrameLoaderClient::dispatchDidFinishDocumentLoad()

0 commit comments

Comments
 (0)