add logger for javascript errors

This commit is contained in:
Jonas Sourlier 2022-05-03 08:40:59 +02:00
parent ccbeb9d32d
commit ef63a67aee

View file

@ -36,6 +36,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private readonly bool isMainWindow; private readonly bool isMainWindow;
private readonly BrowserSettings settings; private readonly BrowserSettings settings;
private readonly IText text; private readonly IText text;
private readonly ILogger logger;
private WindowClosedEventHandler closed; private WindowClosedEventHandler closed;
private WindowClosingEventHandler closing; private WindowClosingEventHandler closing;
@ -75,11 +76,12 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
remove { closing -= value; } remove { closing -= value; }
} }
internal BrowserWindow(IBrowserControl browserControl, BrowserSettings settings, bool isMainWindow, IText text) internal BrowserWindow(IBrowserControl browserControl, BrowserSettings settings, bool isMainWindow, IText text, ILogger logger)
{ {
this.isMainWindow = isMainWindow; this.isMainWindow = isMainWindow;
this.settings = settings; this.settings = settings;
this.text = text; this.text = text;
this.logger = logger;
InitializeComponent(); InitializeComponent();
InitializeBrowserWindow(browserControl); InitializeBrowserWindow(browserControl);
@ -463,6 +465,7 @@ if (typeof __SEB_focusElement === 'undefined') {
{ {
if (!result.Success) if (!result.Success)
{ {
logger.Error($"Javascript error {result.Message}!");
} }
}); });
@ -470,6 +473,7 @@ if (typeof __SEB_focusElement === 'undefined') {
{ {
if (!result.Success) if (!result.Success)
{ {
logger.Error($"Javascript error {result.Message}!");
} }
}); });
} }