Skip to content

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

@s-and-r

Description

@s-and-r

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions