feat: suppress devtools console logging#49292
Conversation
|
Thanks for the PR, @clavin! I've thought about it some more. Would it make more sense to add stub implementations of I don't have a strong opinion on this. If you and other maintainers think suppressing is better, I'm happy with merging this. But I thought this was worthwhile bringing this up. |
From the little information I have, these 2 functions should serve as form autofill suggestions, right? I may be wrong on this, so please correct me if I am so. I wonder why these are not implemented at all in the first place? Are there any problems with them and their functionality, or did the team just not get to them yet? Could they be properly implemented, either as in Chromium or through an Electron-specific patch? |
That solution makes sense too! Tbh I haven't looked into what this would look like, nor why these are unimplemented in our build. I'm nervous that stubbing them may require patching, and I'm not convinced that this issue meets the threshold for on-going patch maintenance. When the solution is this simple, addressing the root of the problem seems better than patching in stubs (if the problem comes up again in the future). Messages that are important to us as maintainers, but not to users, still fall into this trap:
Your concern to not sweep these messages under the rug does persuade me; so, I added another carve-out: in testing builds (which run in CI and that most of us use for development), the messages will still be logged as normal. For release builds, the messages are suppressed (unless verbose logging is enabled). Thx for the feedback @nikwen 😄 |
|
@clavin I like the testing build logging solution! Thanks! 🙌 @TheOneTheOnlyJJ Regarding your question:
I don't think we say that we officially support the Chrome Devtools Protocol, which those commands are part of. I haven't looked into what the commands do exactly and whether they even make sense in the context of Electron, so I can't comment on whether a patch for them would be accepted. But I don't think they'll do anything unless you use the Chrome Devtools Protocol. |
The missing apis are needed for autofill view in devtools We don't support the autofill feature. The protocol handler for autofill apis https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/protocol/autofill_handler.cc;bpv=0;bpt=1 depends on the relevant If we want to fix this the proper way it has to be addressed in upstream devtools and it will not be a trivial patch we can maintain,
|
|
Release Notes Persisted
|
|
I have automatically backported this PR to "40-x-y", please check out #49359 |

Background
Electron app developers often see console errors from the DevTools frontend when running from the command line, for example:
These originate upstream in Chromium:
content::LogConsoleMessageto the native console.These messages are intended for Chromium/DevTools developers, but they predominantly reach app developers. The console is an impactful surface for dev UX, and routinely seeing unactionable "errors" degrades the experience. (To be clear, it isn't a high priority surface, though.)
Solution
Before
content::LogConsoleMessagewrites to the native console, the message passes throughRenderFrameHostDelegate::DidAddMessageToConsole, which is plumbed to the corresponding WebContents delegate method. That hook can returntrueto indicate the message was handled and suppress the default logging path.Electron's DevTools frontend is hosted in
electron::InspectableWebContents. This change overrides the delegateDidAddMessageToConsolemethod to suppress the messages from the DevTools' WebContents.In case we need an escape hatch to see these log messages again, they are reimplemented as verbose logs. Run with
--vmodule=inspectable_web_contents=1to print out the log messages again. The messages also print as usual in testing builds (which we run in CI).Fixes #41614.
Checklist
npm testpassesRelease Notes
Notes: DevTools errors are no longer printed to console