Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,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", nullptr, false);

// Misc events
m_Events.AddEvent("onClientFileDownloadComplete", "fileName, success", NULL, false);
Expand Down
10 changes: 10 additions & 0 deletions Client/mods/deathmatch/logic/CClientWebBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ void CClientWebBrowser::Events_OnAjaxRequest(CAjaxResourceHandlerInterface* pHan
pHandler->SetResponse(result);
}

void CClientWebBrowser::Events_OnConsoleMessage(const std::string& message, const std::string& source, int line, std::int16_t level)
{
CLuaArguments arguments;
arguments.PushString(message);
arguments.PushString(source);
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))
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientWebBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 std::string& message, const std::string& source, int line, std::int16_t level) override;

private:
CWebViewInterface* m_pWebView;
Expand Down
1 change: 1 addition & 0 deletions Client/sdk/core/CWebBrowserEventsInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 std::string& message, const std::string& source, int line, std::int16_t level) = 0;
};
Loading