Skip to content

Add missing OnDevToolsAgentAttached/OnDevToolsAgentDetached API surface - #50

Merged
Thrameos merged 1 commit into
masterfrom
backport/devtools-agent-attached-detached
Sep 6, 2026
Merged

Thrameos merged 1 commit into
masterfrom
backport/devtools-agent-attached-detached

Conversation

@Thrameos

@Thrameos Thrameos commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Our Java CefDevToolsMessageObserver only exposed onDevToolsMethodResult/onDevToolsEvent, missing the two attach/detach callbacks the real C++ CefDevToolsMessageObserver interface has.
  • Adds both to the native bridge (devtools_message_observer.h/.cpp) and to the Java interface, wired into CefDevToolsClient's internal observer with a new public isAgentAttached() accessor.
  • Per CEF's own header docs, attachment "will generally occur in response to the first message sent while the agent is detached" -- diagnostic/observable state, not a precondition to gate executeDevToolsMethod() on.
  • Backport of coverage/phase1-value-objects-phase2-handlers' 7b73b62, applied verbatim (this branch's files matched that commit's pre-fix state exactly).

Test plan

🤖 Generated with Claude Code

https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq

Our Java CefDevToolsMessageObserver only exposed onDevToolsMethodResult/
onDevToolsEvent, missing the two attach/detach callbacks the real C++
CefDevToolsMessageObserver interface has. Added both to the native
bridge (devtools_message_observer.h/.cpp, JNI_CALL_VOID_METHOD already
safely no-ops against older/other implementers, though CefDevToolsClient
is currently the only one) and to the Java interface, wired into
CefDevToolsClient's internal observer with a new public
isAgentAttached() accessor.

Per CEF's own header docs, attachment "will generally occur in response
to the first message sent while the agent is detached" -- so this is
diagnostic/observable state, not a precondition we can gate
executeDevToolsMethod() on.

Backport of coverage/phase1-value-objects-phase2-handlers' 7b73b62,
applied verbatim (this branch's files matched that commit's pre-fix
state exactly). Adds a smoke test verifying isAgentAttached()'s safe
default (false, before any message is sent) to the existing
CefDevToolsRegistrationTest.java -- doesn't exercise an actual
attach/detach transition since executeDevToolsMethod() is a confirmed
unrecoverable hang in this environment (issue #12).

Verified: full clean rebuild (native + Java), CefDevToolsRegistrationTest
(both tests) pass. A post-summary "Aborted (core dumped)" crash after
the JUnit run reported 0 failures is the already-tracked, pre-existing
GH #10 shutdown-race SIGSEGV (plan/tasks/20260903-01-gh10-shutdown-
sigsegv.md), unrelated to this change.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HBFmQs6JDypYP5qdC99yDq
*
* @param browser the originating browser instance
*/
void onDevToolsAgentAttached(CefBrowser browser);
*
* @param browser the originating browser instance
*/
void onDevToolsAgentDetached(CefBrowser browser);
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.01%. Comparing base (be68fe1) to head (3d34fe5).

Files with missing lines Patch % Lines
native/devtools_message_observer.cpp 0.00% 14 Missing ⚠️
java/org/cef/browser/CefDevToolsClient.java 33.33% 4 Missing ⚠️
.../tests/junittests/CefDevToolsRegistrationTest.java 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #50      +/-   ##
============================================
- Coverage     38.01%   38.01%   -0.01%     
+ Complexity      735      734       -1     
============================================
  Files           243      243              
  Lines         14863    14901      +38     
  Branches       2449     2454       +5     
============================================
+ Hits           5650     5664      +14     
- Misses         8011     8030      +19     
- Partials       1202     1207       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Thrameos Thrameos added the enhancement New feature or request label Sep 6, 2026
@Thrameos
Thrameos merged commit 613927f into master Sep 6, 2026
9 checks passed
@Thrameos
Thrameos deleted the backport/devtools-agent-attached-detached branch September 6, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants