Skip to content

fix(jcef): guard zoom shortcut outside desktop - #2364

Open
haizhi03 wants to merge 1 commit into
OtterMind:mainfrom
haizhi03:fix/jcef-shortcut-guard
Open

fix(jcef): guard zoom shortcut outside desktop#2364
haizhi03 wants to merge 1 commit into
OtterMind:mainfrom
haizhi03:fix/jcef-shortcut-guard

Conversation

@haizhi03

@haizhi03 haizhi03 commented Aug 1, 2026

Copy link
Copy Markdown

Related issue

Closes #2363

Summary

This PR prevents browser development environments from calling JCEF-only zoom APIs when window.javaQuery is
unavailable.

The global zoom shortcuts currently call jcefApi.webFrameSetZoom(...) directly. That API depends on the JCEF bridge
injected by the desktop container. In a normal browser/web development environment, the bridge does not exist, so
pressing a zoom shortcut raises an unhandled rejection: Java Query is not available.

The fix adds a shared JCEF availability check, routes zoom shortcut handling through a small helper, and lets normal
browser environments keep their default zoom behavior instead of intercepting the shortcut.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:

    • yarn test:shortcut
      • Passed. Existing shortcut tests passed and the new JCEF zoom regression test passed.
    • yarn eslint src/jcef/base.ts src/utils/shortcutManager.ts src/utils/jcefZoom.ts src/utils/jcefZoom.test.ts --max- warnings=0
      • Passed.
  • Manual verification:

    • Verified that zoom shortcut handling now checks whether window.javaQuery is available before calling
      webFrameSetZoom.
    • In non-JCEF/browser environments, the shortcut manager does not intercept zoom shortcuts, so browser default zoom
      behavior can continue.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data:

    • N/A. This change only affects frontend shortcut handling and JCEF bridge availability checks.
  • Database or driver compatibility:

    • N/A. No database or driver behavior is changed.
  • Network, privacy, or security:

    • N/A. No network requests, credentials, or private data handling are changed.
  • Community / Local / Pro boundary:

    • Low risk. The change only skips JCEF-only zoom calls when the JCEF bridge is unavailable.
  • Backward compatibility:

    • Desktop/JCEF behavior is preserved when window.javaQuery is available.
    • Browser/web development behavior improves by avoiding an unhandled rejection and preserving default browser zoom
      behavior.

Reviewer map

  • Start here:

    • chat2db-community-client/src/utils/shortcutManager.ts
    • chat2db-community-client/src/utils/jcefZoom.ts
    • chat2db-community-client/src/jcef/base.ts
  • Failure condition:

    • Pressing zoom shortcuts in a normal browser environment still triggers Unhandled Rejection (Error): Java Query is not available.
    • Pressing zoom shortcuts in the JCEF desktop container no longer calls web-frame-set-zoom.
  • Rollback or disable path:

    • Revert this PR to restore the previous direct jcefApi.webFrameSetZoom(...) shortcut behavior.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: Used AI assistance to identify the JCEF shortcut guard point, implement the frontend fix, and draft
regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Browser dev environment throws "Java Query is not available" when using zoom shortcuts

2 participants