Skip to content

[DevTools] Fix console links not being openable#210

Closed
everettbu wants to merge 1 commit into
mainfrom
sebbie/11-26-_devtools_fix_console_links_not_being_openable
Closed

[DevTools] Fix console links not being openable#210
everettbu wants to merge 1 commit into
mainfrom
sebbie/11-26-_devtools_fix_console_links_not_being_openable

Conversation

@everettbu

@everettbu everettbu commented Dec 12, 2025

Copy link
Copy Markdown

Mirror of facebook/react#35229
Original author: eps1lon


In draft so I don't accidentally merge.

Fixes react/react#33983 (comment)
See https://issues.chromium.org/u/1/issues/462747680

Seems like chrome.devtools.panels.openResource is not actually the default behavior for the resource handler. It's erroring when trying to open URLs that don't point to Chrome Resources and not doing anything. Will bring this up with Chrome but until then we should have a workaround.

E.g. clicking on https://google.com does nothing.

Falling back to window.open in case openResource errors. https://developer.chrome.com/docs/extensions/reference/api/devtools/panels#method-openResource doesn't document the parameter to the callback but it returns an error-like object.

Test plan

  1. Load extension from CI artifact
    Click on the link from console.log('https://google.com'). File links also work (e.g. console.log('file://404'))

@everettbu
everettbu force-pushed the sebbie/11-26-_devtools_fix_console_links_not_being_openable branch from 1825f21 to 82b4ac5 Compare January 21, 2026 09:17
@everettbu
everettbu marked this pull request as ready for review January 21, 2026 09:17
@greptile-apps

greptile-apps Bot commented Jan 21, 2026

Copy link
Copy Markdown

Greptile Summary

Added error handling to chrome.devtools.panels.openResource to fix console links that point to external URLs or non-Chrome resources (like https://google.com or file://404). When openResource fails, the code now falls back to window.open to open the URL in the browser's default behavior.

  • Fixed issue where clicking on external URLs in console logs would fail silently
  • Added callback parameter to openResource that checks for errors via maybeError.isError
  • Provides graceful fallback to window.open when Chrome cannot handle the resource

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward bug fix that adds proper error handling to an existing API call. It follows the documented Chrome extension API callback pattern, provides a sensible fallback behavior, and doesn't introduce breaking changes or security issues. The fix addresses a real bug where external URLs couldn't be opened from console logs.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-extensions/src/main/index.js Added error handling callback to openResource that falls back to window.open when Chrome cannot open the resource

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Jan 21, 2026
@everettbu
everettbu deleted the sebbie/11-26-_devtools_fix_console_links_not_being_openable branch January 21, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants