Removed remarks regarding workaround for browser user agent. It appears that the user agent can't be changed on a per-request basis (at least for requests from service workers).

This commit is contained in:
dbuechel 2020-02-17 15:44:22 +01:00
parent 13aec073cb
commit 38159dae3e
2 changed files with 8 additions and 20 deletions

View file

@ -184,24 +184,22 @@ namespace SafeExamBrowser.Browser
{
var warning = logger.LogLevel == LogLevel.Warning;
var error = logger.LogLevel == LogLevel.Error;
var cefSettings = new CefSettings
{
CachePath = appConfig.BrowserCachePath,
LogFile = appConfig.BrowserLogFilePath,
LogSeverity = error ? LogSeverity.Error : (warning ? LogSeverity.Warning : LogSeverity.Info),
PersistSessionCookies = !settings.DeleteCookiesOnShutdown,
UserAgent = InitializeUserAgent()
};
InitializeProxySettings(cefSettings);
var cefSettings = new CefSettings();
cefSettings.CachePath = appConfig.BrowserCachePath;
cefSettings.CefCommandLineArgs.Add("touch-events", "enabled");
cefSettings.LogFile = appConfig.BrowserLogFilePath;
cefSettings.LogSeverity = error ? LogSeverity.Error : (warning ? LogSeverity.Warning : LogSeverity.Info);
cefSettings.PersistSessionCookies = !settings.DeleteCookiesOnShutdown;
cefSettings.UserAgent = InitializeUserAgent();
if (!settings.AllowPdfReader)
{
cefSettings.CefCommandLineArgs.Add("disable-pdf-extension", "");
}
InitializeProxySettings(cefSettings);
logger.Debug($"Cache Path: {cefSettings.CachePath}");
logger.Debug($"Engine Version: Chromium {Cef.ChromiumVersion}, CEF {Cef.CefVersion}, CefSharp {Cef.CefSharpVersion}");
logger.Debug($"Log File: {cefSettings.LogFile}");
@ -245,10 +243,6 @@ namespace SafeExamBrowser.Browser
}
}
/// <summary>
/// TODO: Workaround to correctly set the user agent due to missing support for request interception for requests made by service workers.
/// Remove once CEF fully supports service workers and reactivate the functionality in <see cref="Handlers.RequestHandler"/>!
/// </summary>
private string InitializeUserAgent()
{
var osVersion = $"{Environment.OSVersion.Version.Major}.{Environment.OSVersion.Version.Minor}";

View file

@ -90,12 +90,6 @@ namespace SafeExamBrowser.Browser.Handlers
{
var headers = new NameValueCollection(request.Headers);
var urlWithoutFragment = request.Url.Split('#')[0];
var userAgent = request.Headers["User-Agent"];
// TODO: CEF does not yet support intercepting requests from service workers, thus the user agent must be statically set at browser
// startup for now. Once CEF has full support of service workers, the static user agent should be removed and the method below
// reactivated. See https://bitbucket.org/chromiumembedded/cef/issues/2622 for the current status of development.
// headers["User-Agent"] = $"{userAgent} SEB/{appConfig.ProgramInformationalVersion}";
if (settings.SendConfigurationKey)
{