Repository navigation
docs: clarify debugger.sendCommand timing and empty-result behavior - #53114
MarshallOfSound merged 3 commits into
Conversation
|
For more information on signing commits, see GitHub's documentation on Telling Git about your signing key. |
9f06be8 to
af943d8
Compare
|
|
||
| Send given command to the debugging target. | ||
|
|
||
| **Notes:** |
There was a problem hiding this comment.
Nit: the API docs use > [!NOTE] callouts for notes (about 195 uses in docs/api). Can we use that form here?
There was a problem hiding this comment.
Thank you for the feedback. Updated to use the [!NOTE] alert syntax to
match the convention used elsewhere in docs/api (referenced
docs/api/desktop-capturer.md for the multi-point formatting). Pushed in
aa3dea1.
15ab9a9 to
aa3dea1
Compare
MarshallOfSound
left a comment
There was a problem hiding this comment.
Doesn't seem to render correctly? Check the markdown syntax
|
You're right, thank you for catching that. The cause: the Fixed by prefixing that comment line with |
Documents two long-standing but undocumented behaviors of
debugger.sendCommand():
- Commands sent before the target has navigated may not resolve
until navigation occurs.
- Commands whose protocol response has no `result` data resolve
with an empty object (`{}`), not `null` or `undefined`.
Both behaviors were originally reported in electron#14810 and electron#14811
(closed as working-as-intended) and re-verified against current
Electron's Promise-based sendCommand API before writing this up.
Fixes electron#14822
…correctly The disable comment wasn't prefixed with `>`, which split the blockquote into two separate blocks on GitHub's renderer instead of one alert box. Verified via the markdown render API before and after.
Head branch was pushed to by a user without write access
0618ff0 to
69fda7e
Compare
|
The workflow runs need re-approval after the rebase (still showing |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
No Release Notes |
|
I have automatically backported this PR to "44-x-y", please check out #53605 |
|
I have automatically backported this PR to "45-x-y", please check out #53606 |
Description of Change
This documents two behaviors of
debugger.sendCommand()reported yearsago (#14810, #14811) but only ever tracked as a documentation gap
(#14822) - never reflected in
docs/api/debugger.md. Both underlyingreports were closed as working-as-intended; the behavior itself hasn't
changed, it was just never written down. I re-verified both against
current Electron (Promise-based API, not the callback API from 2018)
before writing this.
Evidence
1. Delay before navigation -
sendCommand('Page.enable')calledimmediately after
attach(), beforeloadFile():Control run - same command sent after the page had already loaded once:
~445ms vs ~19ms: pending navigation measurably delays resolution.
2. Empty object on success:
Matches
DispatchProtocolMessageinshell/browser/api/electron_api_debugger.cc:81, which resolves with anempty
DictValuewhen the protocol response has noresultfield.Fixes #14822
Checklist
npm testpasses (docs-only change; verified instead vianpm run lint:markdown,lint:docs-relative-links, andlint:api-history- all clean)Release Notes
Notes: none