Refactors InspectorProxy to compare pathname portion of url passed in… (#41005)
Summary: … request to local pathname comparator variables to fix issue with other rightward elements of url such as query or fragment entering the comparison and causing 404 errors for key debugging routes. A change in Chromium appended the query "?for_tabs" to the /json/list request made by Chrome DevTools to find remote debugger targets. The current comparison in InspectorProxy.js compares the entire node IncomingMessage url field to the local pathname constants. The issue arises as url can also contain the query and fragment portions so the original comparison of "/json/list" === "/json/list" which resolved as true would become "/json/list?for_tabs" === "/json/list" and evaluate to false ultimately resulting in a 404 for the request. In summary, all these changes/issues caused remote debugging of Hermes code in React Native apps to become unavailable, greatly impacting developer experience. ## Changelog: [GENERAL] [FIXED] JS Debugging: Fix inspector-proxy to allow for DevTools requests with query strings Pull Request resolved: https://github.com/facebook/react-native/pull/41005 Reviewed By: NickGerleman Differential Revision: D50342265 Pulled By: robhogan fbshipit-source-id: a65f2908f0bea9fc15e1e3e4e6d31a3b9598e81f
This commit is contained in:
Родитель
fbc28fa73d
Коммит
ab81c16b65
|
@ -94,12 +94,13 @@ export default class InspectorProxy implements InspectorProxyQueries {
|
|||
response: ServerResponse,
|
||||
next: (?Error) => mixed,
|
||||
) {
|
||||
const pathname = url.parse(request.url).pathname;
|
||||
if (
|
||||
request.url === PAGES_LIST_JSON_URL ||
|
||||
request.url === PAGES_LIST_JSON_URL_2
|
||||
pathname === PAGES_LIST_JSON_URL ||
|
||||
pathname === PAGES_LIST_JSON_URL_2
|
||||
) {
|
||||
this._sendJsonResponse(response, this.getPageDescriptions());
|
||||
} else if (request.url === PAGES_LIST_JSON_VERSION_URL) {
|
||||
} else if (pathname === PAGES_LIST_JSON_VERSION_URL) {
|
||||
this._sendJsonResponse(response, {
|
||||
Browser: 'Mobile JavaScript',
|
||||
'Protocol-Version': '1.1',
|
||||
|
|
Загрузка…
Ссылка в новой задаче