mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix(dev-middleware): allow inspector proxy to fetch sourcemaps on lan connections (#43307)
Summary: The inspector proxy is inlining source maps on `Debugger.scriptParsed` CDP events. The inlining prevents Chrome DevTools from downloading this remotely, as that's not supported in newer versions anymore. The current implementation locks this inlining mechanism to just `localhost` and/or `127.0.0.1` addresses, making it incompatible with LAN or tunnel device connections. This PR removes that limitation to allow source map inlining on these LAN and tunnel connections. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL][FIXED] Allow Inspector proxy to inline source maps on LAN connections Pull Request resolved: https://github.com/facebook/react-native/pull/43307 Test Plan: - See added test - Start Metro and connect a device over LAN, open the chrome devtools Reviewed By: huntie Differential Revision: D54485247 Pulled By: robhogan fbshipit-source-id: 6fcb0c6dd762d2f0a013497ba0a1126095b9130b
This commit is contained in:
@@ -758,10 +758,6 @@ export default class Device {
|
||||
// Fetch text, raising an exception if the text could not be fetched,
|
||||
// or is too large.
|
||||
async #fetchText(url: URL): Promise<string> {
|
||||
if (!['localhost', '127.0.0.1'].includes(url.hostname)) {
|
||||
throw new Error('remote fetches not permitted');
|
||||
}
|
||||
|
||||
// $FlowFixMe[incompatible-call] Suppress arvr node-fetch flow error
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user