Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 25 additions & 3 deletions CefSharp.Core.Runtime/Internals/CefSharpApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,32 @@ namespace CefSharp

if (kvp->Key == "disable-features" || kvp->Key == "enable-features")
{
//Temp workaround so we can set the disable-features/enable-features command line argument
// See https://github.com/cefsharp/CefSharp/issues/2408
commandLine->AppendSwitchWithValue(name, value);
if (CefSharpSettings::MergeFeaturesCommandLineArgs)
{
CefString existingValue = commandLine->GetSwitchValue(name);
if (existingValue.empty())
{
commandLine->AppendSwitchWithValue(name, value);
}
else
{
String^ currentValue = StringUtils::ToClr(existingValue);
if (!currentValue->Contains(kvp->Value))
{
commandLine->RemoveSwitch(name);
commandLine->AppendSwitchWithValue(name, StringUtils::ToNative(currentValue + "," + kvp->Value));
}
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
else
{
//Temp workaround so we can set the disable-features/enable-features command line argument
// See https://github.com/cefsharp/CefSharp/issues/2408
commandLine->RemoveSwitch(name);
commandLine->AppendSwitchWithValue(name, value);
}
}

// Right now the command line args handed to the application (global command line) have higher
// precedence than command line args provided by the app
else if (!commandLine->HasSwitch(name))
Expand Down
7 changes: 7 additions & 0 deletions CefSharp/CefSharpSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static CefSharpSettings()
WcfTimeout = TimeSpan.FromSeconds(2);
#endif
SubprocessExitIfParentProcessClosed = true;
MergeFeaturesCommandLineArgs = true;
}

#if !NETCOREAPP
Expand Down Expand Up @@ -82,6 +83,12 @@ static CefSharpSettings()
/// </summary>
public static bool FocusedNodeChangedEnabled { get; set; }

/// <summary>
/// Any enable-features/disable-features command line arguments will be automatically merged with existing values if supplied.
/// This currently defaults to true.
/// </summary>
public static bool MergeFeaturesCommandLineArgs { get; set; }

/// <summary>
/// CefSharp.WinForms and CefSharp.Wpf.HwndHost ONLY!
/// The default is to create <see cref="CefRuntimeStyle.Alloy"/>
Expand Down