java-cef icon indicating copy to clipboard operation
java-cef copied to clipboard

CefApp.getInstance: Passing a flag with two '=' instances fails

Open s-and-r opened this issue 1 year ago • 0 comments

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

s-and-r avatar Apr 11 '24 10:04 s-and-r