fix(jcef): guard zoom shortcut outside desktop - #2364
Open
haizhi03 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Closes #2363
Summary
This PR prevents browser development environments from calling JCEF-only zoom APIs when
window.javaQueryisunavailable.
The global zoom shortcuts currently call
jcefApi.webFrameSetZoom(...)directly. That API depends on the JCEF bridgeinjected 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
Verification
Commands and results:
yarn test:shortcutyarn eslint src/jcef/base.ts src/utils/shortcutManager.ts src/utils/jcefZoom.ts src/utils/jcefZoom.test.ts --max- warnings=0Manual verification:
window.javaQueryis available before callingwebFrameSetZoom.behavior can continue.
UI evidence: N/A
Risk and compatibility
Public API or stored data:
Database or driver compatibility:
Network, privacy, or security:
Community / Local / Pro boundary:
Backward compatibility:
window.javaQueryis available.behavior.
Reviewer map
Start here:
chat2db-community-client/src/utils/shortcutManager.tschat2db-community-client/src/utils/jcefZoom.tschat2db-community-client/src/jcef/base.tsFailure condition:
Unhandled Rejection (Error): Java Query is not available.web-frame-set-zoom.Rollback or disable path:
jcefApi.webFrameSetZoom(...)shortcut behavior.Contributor declaration
AI assistance: Used AI assistance to identify the JCEF shortcut guard point, implement the frontend fix, and draft
regression coverage.