Skip to content

JCEF has no CefFindHandler binding (no onFindResult) -- find()/stopFinding() are fire-and-forget #32

Description

@Thrameos

Summary

org.cef.browser.CefBrowser.find()/stopFinding() exist (wired to native/CefBrowser_N.cpp), but there is no Java equivalent of CEF's CefFindHandler/OnFindResult -- no way for a Java caller to observe when an in-page find operation actually completes. grep-confirmed: no find_handler.cpp/FindHandler anywhere in native/ or java/org/cef/handler/.

CEF's own CefFindHandler::OnFindResult (include/capi/cef_find_handler_capi.h) is the intended way to know a find request settled; ~/devel/cef/tests/ceftests/find_handler_unittest.cc always waits for OnFindResult's finalUpdate before calling StopFinding().

Impact

Without this binding, find() is fire-and-forget from Java: a caller has no way to know when it's safe to act on the result, or safe to close/tear down the browser without a find request's mojo IPC still being in flight. Found via #27: a browser force-closed shortly after find()/viewSource() can hit a Debug/coverage-build-only DCHECK (interface_endpoint_client.cc:538: !has_pending_responders()) in CEF's own mojo layer, because nothing ever drains the pending response. Current test-level mitigation (CefBrowserApiTest.java) is a settle delay before closing, which is not a real fix, just a workaround for this gap.

Suggested fix

Add native/find_handler.cpp + org.cef.handler.CefFindHandler (onFindResult(CefBrowser browser, int identifier, int count, Rectangle selectionRect, int activeMatchOrdinal, boolean finalUpdate)), wired into client_handler.cpp/CefClient the same way every other handler type is (see CefJSDialogHandler/jsdialog_handler.cpp for the smallest comparable pattern to follow).

Activity

  1. Thrameos commented on Sep 2, 2026

    @Thrameos
    OwnerAuthor

    Fixed in 135dc98: added `org.cef.handler.CefFindHandler` (+ `CefFindHandlerAdapter`) and `native/find_handler.{h,cpp}`, wired into `client_handler.cpp`/`CefClient` the same way every other handler type is (following the `CefJSDialogHandler`/`jsdialog_handler.cpp` pattern this issue suggested).

    `CefBrowserApiTest` now waits on the real `onFindResult(finalUpdate=true)` before calling `stopFinding()`/closing, replacing the blind settle-delay workaround this issue's Impact section described. Verified in isolation (JUnit console launcher, --select-class only): passes in ~8s with no hang.

    🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions