java-cef
java-cef copied to clipboard
CefApp.getInstance: Passing a flag with two '=' instances fails
Describe the bug Passing a flag that contains two '=' instances to CefApp.getInstance fails.
For example, "--blink-settings=printingMaximumShrinkFactor=1", which is a workaround for a known issue where output may be scaled instead of cropped after calling printToPdf, see the FIXME in LocalFrameView::ForceLayoutForPagination.
Passing that flag fails because the code in CefApp.onBeforeCommandLineProcessing does not take into account that a switch may contain more than one instance of '='. Instead of appendSwitchWithValue, it incorrectly calls appendSwitch.
To Reproduce
String[] flags = { "--blink-settings=printingMaximumShrinkFactor=1" };
CefApp.getInstance(flags).createClient();
Expected behavior A breakpoint in CefApp.onBeforeCommandLineProcessing on the line with appendSwitchWithValue should be hit.
This does not happen because onBeforeCommandLineProcessing only calls appendSwitchWithValue if (switchVals.length == 2) but in this case switchVals.length equals 3.
Versions:
- JCEF Version: ea25085
- CEF Version: 122.1.10+gc902316+chromium-122.0.6261.112