Skip to content
Snippets Groups Projects
Commit 1cb8d16a authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! MB 80: Enable Mullvad Browser as a default browser

Debugging faciliites.
parent 587a2073
No related branches found
No related tags found
1 merge request!111MB 274: Rebase alpha onto 115.9.0esr
......@@ -7,7 +7,7 @@
#ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
#define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
#include "mozilla/Types.h"
#include <cwchar>
MOZ_BEGIN_EXTERN_C
......@@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName;
MOZ_END_EXTERN_C
#include "mozilla/WindowsEventLog.h"
// This is not compatible with Mingw.
#define LOG_ERROR(hr)
#define LOG_ERROR_MESSAGE(format, ...)
#ifdef LOG_ERRORS_FILE
extern FILE* gLogFile;
# define LOG_ERROR(hr) \
if (gLogFile) { \
fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \
(unsigned int)hr); \
}
# define LOG_ERROR_MESSAGE(format, ...) \
if (gLogFile) { \
fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \
fputs("\r\n", gLogFile); \
}
#else
# define LOG_ERROR(hr)
# define LOG_ERROR_MESSAGE(format, ...)
#endif
#endif // __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
......@@ -364,12 +364,22 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl(
return S_OK;
}
#ifdef LOG_ERRORS_FILE
FILE* gLogFile;
#endif
// Simplified version of wmain that uses only this file from main.cpp.
int wmain(int argc, wchar_t** argv) {
if (argc < 3 || !argv[1] || !argv[2]) {
return E_INVALIDARG;
}
#ifdef LOG_ERRORS_FILE
std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"),
&fclose);
gLogFile = logFile.get();
#endif
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(hr)) {
LOG_ERROR(hr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment