Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONEM-32477]:WPE 2.38 - port debug logs->DetailsConsoleMessage #339

Open
wants to merge 1 commit into
base: lgi-wpe-2.38-23Q3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[ONEM-32477]:WPE 2.38 - port debug logs->DetailsConsoleMessage
suresh-khurdiya-epam committed Nov 22, 2023
commit 04c2f8c9da63ea7d3b505fe5a0085c759baef233
2 changes: 2 additions & 0 deletions Source/WebKit/UIProcess/API/APIUIClient.h
Original file line number Diff line number Diff line change
@@ -231,6 +231,8 @@ class UIClient {
virtual void startXRSession(WebKit::WebPageProxy&, CompletionHandler<void(RetainPtr<id>)>&& completionHandler) { completionHandler(nil); }
virtual void endXRSession(WebKit::WebPageProxy&) { }
#endif

virtual void willAddDetailedMessageToConsole( WebKit::WebPageProxy&, const WTF::String& source, const WTF::String& level, uint64_t line, uint64_t col, const WTF::String& message, const WTF::String& url) { }
};

} // namespace API
12 changes: 12 additions & 0 deletions Source/WebKit/UIProcess/API/C/WKPage.cpp
Original file line number Diff line number Diff line change
@@ -2068,6 +2068,18 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
m_client.didResignInputElementStrongPasswordAppearance(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo);
}

void willAddDetailedMessageToConsole(WebPageProxy& page, const String& source, const String& level,
uint64_t line, uint64_t column, const String& message, const String& url) final
{
fprintf(stderr, "SK:WKPage.cpp: *** willAddDetailedMessageToConsole->m_client:message:%s \n", message.utf8().data());
if (!m_client.willAddDetailedMessageToConsole)
return;

fprintf(stderr, "SK:WKPage.cpp: willAddDetailedMessageToConsole->m_client:message:%s \n", message.utf8().data());
m_client.willAddDetailedMessageToConsole(toAPI(page), toAPI(source.impl()), toAPI(level.impl()),
line, column, toAPI(message.impl()), toAPI(url.impl()), m_client.base.clientInfo);
}

#if ENABLE(POINTER_LOCK)
void requestPointerLock(WebPageProxy* page) final
{
12 changes: 12 additions & 0 deletions Source/WebKit/UIProcess/API/C/WKPageUIClient.h
Original file line number Diff line number Diff line change
@@ -154,6 +154,7 @@ typedef void (*WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5)(WKPageRe
typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageWillAddDetailedMessageToConsoleCallback)(WKPageRef page, WKStringRef source, WKStringRef level, uint64_t line, uint64_t column, WKStringRef message, WKStringRef url, const void* clientInfo);

typedef struct WKPageUIClientBase {
int version;
@@ -757,6 +758,7 @@ typedef struct WKPageUIClientV8 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;
} WKPageUIClientV8;
@@ -845,6 +847,7 @@ typedef struct WKPageUIClientV9 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -936,6 +939,7 @@ typedef struct WKPageUIClientV10 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1031,6 +1035,7 @@ typedef struct WKPageUIClientV11 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1129,6 +1134,7 @@ typedef struct WKPageUIClientV12 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1230,6 +1236,7 @@ typedef struct WKPageUIClientV13 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1334,6 +1341,7 @@ typedef struct WKPageUIClientV14 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1441,6 +1449,7 @@ typedef struct WKPageUIClientV15 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1552,6 +1561,7 @@ typedef struct WKPageUIClientV16 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1666,6 +1676,7 @@ typedef struct WKPageUIClientV17 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

@@ -1782,6 +1793,7 @@ typedef struct WKPageUIClientV18 {
WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline;

// Version 8.
WKPageWillAddDetailedMessageToConsoleCallback willAddDetailedMessageToConsole;
WKRequestPointerLockCallback requestPointerLock;
WKDidLosePointerLockCallback didLosePointerLock;

6 changes: 6 additions & 0 deletions Source/WebKit/UIProcess/WebPageProxy.cpp
Original file line number Diff line number Diff line change
@@ -11703,6 +11703,12 @@ bool WebPageProxy::shouldAvoidSynchronouslyWaitingToPreventDeadlock() const
return false;
}

void WebPageProxy::willAddDetailedMessageToConsole(const String& src, const String& level, uint64_t line, uint64_t col, const String& message, const String& url)
{
fprintf(stderr, "SK: WebPageProxy::willAddDetailedMessageToConsole ->m_ uiClient->will message:%s\n", message.utf8().data());
m_uiClient->willAddDetailedMessageToConsole(*this, src, level, line, col, message, url);
}

} // namespace WebKit

#undef WEBPAGEPROXY_RELEASE_LOG
2 changes: 2 additions & 0 deletions Source/WebKit/UIProcess/WebPageProxy.h
Original file line number Diff line number Diff line change
@@ -1808,6 +1808,8 @@ class WebPageProxy final : public API::ObjectImpl<API::Object::Type::Page>
void getApplicationManifest(CompletionHandler<void(const std::optional<WebCore::ApplicationManifest>&)>&&);
#endif

void willAddDetailedMessageToConsole(const String& src, const String& level, uint64_t line, uint64_t col, const String& message, const String& url);

WebPreferencesStore preferencesStore() const;

void setDefersLoadingForTesting(bool);
2 changes: 2 additions & 0 deletions Source/WebKit/UIProcess/WebPageProxy.messages.in
Original file line number Diff line number Diff line change
@@ -101,6 +101,8 @@ messages -> WebPageProxy {
EndDateTimePicker();
#endif

WillAddDetailedMessageToConsole(String src, String level, uint64_t line, uint64_t column, String message, String url);

# Policy messages
DecidePolicyForResponse(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::PolicyCheckIdentifier policyCheckIdentifier, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, String downloadAttribute, bool wasAllowedByInjectedBundle, uint64_t listenerID, WebKit::UserData userData)
DecidePolicyForNavigationActionAsync(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::PolicyCheckIdentifier policyCheckIdentifier, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, std::optional<WebKit::WebPageProxyIdentifier> originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, uint64_t listenerID)
Original file line number Diff line number Diff line change
@@ -46,12 +46,16 @@ InjectedBundlePageUIClient::InjectedBundlePageUIClient(const WKBundlePageUIClien

void InjectedBundlePageUIClient::willAddMessageToConsole(WebPage* page, MessageSource, MessageLevel, const String& message, unsigned lineNumber, unsigned /*columnNumber*/, const String& /*sourceID*/)
{
if (m_client.willAddMessageToConsole)
fprintf(stderr, "SK: InjectedBundlePageUIClient::willAddMessageToConsole :messahe:%s\n", message.utf8().data());
if (m_client.willAddMessageToConsole) {
fprintf(stderr, "SK: InjectedBundlePageUIClient::willAddMessageToConsole->m_client.willAddMessageToConsole \n");
m_client.willAddMessageToConsole(toAPI(page), toAPI(message.impl()), lineNumber, m_client.base.clientInfo);
}
}

void InjectedBundlePageUIClient::willAddMessageWithArgumentsToConsole(WebPage* page, MessageSource, MessageLevel, const String& message, Span<const String> messageArguments, unsigned lineNumber, unsigned columnNumber, const String& sourceID)
{
fprintf(stderr, "SK: InjectedBundlePageUIClient::willAddMessageWithArgumentsToConsole \n");
if (m_client.willAddMessageWithDetailsToConsole)
m_client.willAddMessageWithDetailsToConsole(toAPI(page), toAPI(message.impl()), toAPI(&API::Array::createStringArray(messageArguments).leakRef()), lineNumber, columnNumber, toAPI(sourceID.impl()), m_client.base.clientInfo);
}
Original file line number Diff line number Diff line change
@@ -411,6 +411,7 @@ void WebChromeClient::setResizable(bool resizable)
void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID)
{
// Notify the bundle client.
fprintf(stderr, "\n WebChromeClient::addMessageToConsole->m_page.injectedBundleUIClient().willAddMessageToConsole: message:%s\n", message.utf8().data());
m_page.injectedBundleUIClient().willAddMessageToConsole(&m_page, source, level, message, lineNumber, columnNumber, sourceID);
}

20 changes: 18 additions & 2 deletions Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Original file line number Diff line number Diff line change
@@ -281,6 +281,13 @@ void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, ResourceL
return;

webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(*webPage, m_frame, identifier, response);

if (response.httpStatusCode() >= 400) {
String message = "Failed to load resource: the server responded with a status of " + String::number(response.httpStatusCode()) + " (" + response.httpStatusText() + ')';
fprintf(stderr, "SK: WebFrameLoaderClient::dispatchDidReceiveResponse->webPage->send(WillAddDetailedMessageToConsole: message:%s \n", message.utf8().data());
LOG(Loading,"Using Log WebFrameLoaderClient::dispatchDidReceiveResponse");
webPage->send(Messages::WebPageProxy::WillAddDetailedMessageToConsole("Network"_s, "Error"_s, 0, 0, message, response.url().string()));
}
}

void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, ResourceLoaderIdentifier identifier, int dataLength)
@@ -320,6 +327,13 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, ResourceLoade

webPage->injectedBundleResourceLoadClient().didFailLoadForResource(*webPage, m_frame, identifier, error);
webPage->removeResourceRequest(identifier);

auto errorDescription = error.localizedDescription();
auto errorMessage = makeString("Failed to load resource", errorDescription.isEmpty() ? "" : ": ", errorDescription);
fprintf(stderr, "SK: **** WebFrameLoaderClient:dispatchDidFailLoading:->webPage->send(WillAddDetailedMessageToConsole: message:%s \n", errorMessage.utf8().data());
fprintf(stderr, "dispatchedDidFailLoading: isTimeout=%d, isCancellation=%d, isAccessControl=%d, errorCode=%d description:%s)",error.isTimeout(), error.isCancellation(), error.isAccessControl(), error.errorCode(),error.localizedDescription().utf8().data());
LOG(Loading,"Using Log WebFrameLoaderClient::dispatchDidFailLoading");
webPage->send(Messages::WebPageProxy::WillAddDetailedMessageToConsole("Network"_s, "Error"_s, 0, 0, errorMessage, error.failingURL().string()));
}

bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int /*length*/)
@@ -623,10 +637,12 @@ void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)

auto& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader());
auto navigationID = documentLoader.navigationID();


fprintf(stderr, "WebFrameLoaderClient::dispatchDidFailLoad");
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFailLoadWithErrorForFrame(*webPage, m_frame, error, userData);

fprintf(stderr, " dispatchDidFailLoad: isTimeout=%d, isCancellation=%d, isAccessControl=%d, errorCode=%d description:%s)",error.isTimeout(), error.isCancellation(), error.isAccessControl(), error.errorCode(),error.localizedDescription().utf8().data());
LOG(Loading,"Using Log WebFrameLoaderClient::dispatchDidFailLoad");
// Notify the UIProcess.
webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), navigationID, error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));