chromiumembedded / java-cef

Java Chromium Embedded Framework (JCEF). A simple framework for embedding Chromium-based browsers in other applications using the Java programming language.
https://bitbucket.org/chromiumembedded/java-cef
Other
605 stars 135 forks source link

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

Closed s-and-r closed 1 month ago

s-and-r commented 3 months ago

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: