diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index df20bf6eaa..ccabca6cfc 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -2778,6 +2778,7 @@ void CClientGame::AddBuiltInEvents() m_Events.AddEvent("onClientBrowserTooltip", "text", NULL, false); m_Events.AddEvent("onClientBrowserInputFocusChanged", "gainedfocus", NULL, false); m_Events.AddEvent("onClientBrowserResourceBlocked", "url, domain, reason", NULL, false); + m_Events.AddEvent("onClientBrowserConsoleMessage", "message, source, line, level", NULL, false); // Misc events m_Events.AddEvent("onClientFileDownloadComplete", "fileName, success", NULL, false); diff --git a/Client/mods/deathmatch/logic/CClientWebBrowser.cpp b/Client/mods/deathmatch/logic/CClientWebBrowser.cpp index cf54f463e7..3991ee98c0 100644 --- a/Client/mods/deathmatch/logic/CClientWebBrowser.cpp +++ b/Client/mods/deathmatch/logic/CClientWebBrowser.cpp @@ -305,6 +305,16 @@ void CClientWebBrowser::Events_OnAjaxRequest(CAjaxResourceHandlerInterface* pHan pHandler->SetResponse(result); } +void CClientWebBrowser::Events_OnConsoleMessage(const SString& strMessage, const SString& strSource, int line, short level) +{ + CLuaArguments Arguments; + Arguments.PushString(strMessage); + Arguments.PushString(strSource); + Arguments.PushNumber(line); + Arguments.PushNumber(level); + CallEvent("onClientBrowserConsoleMessage", Arguments, false); +} + bool CClientWebBrowser::AddAjaxHandler(const SString& strURL, ajax_callback_t& handler) { if (!m_pWebView->RegisterAjaxHandler(strURL)) diff --git a/Client/mods/deathmatch/logic/CClientWebBrowser.h b/Client/mods/deathmatch/logic/CClientWebBrowser.h index 09de6ce0af..9d81dd1b76 100644 --- a/Client/mods/deathmatch/logic/CClientWebBrowser.h +++ b/Client/mods/deathmatch/logic/CClientWebBrowser.h @@ -84,6 +84,7 @@ class CClientWebBrowser : public CClientTexture, public CWebBrowserEventsInterfa bool Events_OnResourceFileCheck(const SString& strURL, CBuffer& outFileData) override; void Events_OnResourceBlocked(const SString& strURL, const SString& strDomain, unsigned char reason) override; void Events_OnAjaxRequest(CAjaxResourceHandlerInterface* pHandler, const SString& strURL) override; + void Events_OnConsoleMessage(const SString& strMessage, const SString& strSource, int line, short level); private: CWebViewInterface* m_pWebView; diff --git a/Client/sdk/core/CWebBrowserEventsInterface.h b/Client/sdk/core/CWebBrowserEventsInterface.h index 1db426df89..afd5d4d15c 100644 --- a/Client/sdk/core/CWebBrowserEventsInterface.h +++ b/Client/sdk/core/CWebBrowserEventsInterface.h @@ -28,4 +28,5 @@ class CWebBrowserEventsInterface virtual bool Events_OnResourceFileCheck(const SString& strURL, CBuffer& outFileData) = 0; virtual void Events_OnResourceBlocked(const SString& strURL, const SString& strDomain, unsigned char reason) = 0; virtual void Events_OnAjaxRequest(CAjaxResourceHandlerInterface* pHandler, const SString& strURL) = 0; + virtual void Events_OnConsoleMessage(const SString& strMessage, const SString& strSource, int line, short level) = 0; };