mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make debugger ScriptIDs per RuntimeModule rather than per filename
Summary: When a filename (potentially with changes) is loaded multiple times, we keep multiple instances around but fail to alert the attached debugger about this. By coupling ScriptIDs to RuntimeModules rather than filenames, we can track multiple instances of the same name instead. Changelog: [Internal] Reviewed By: bestander Differential Revision: D18362052 fbshipit-source-id: 2147af32bc48c5fd2a2b080ea09dfa4133de7cf5
This commit is contained in:
1 parent
a95184cbad
commit
23feaa56cf
1 file changed
+8
-3
@@ -47,11 +47,16 @@ void setHermesLocation(
|
||||
hermesLoc.fileName = stripCachePrevention(chromeLoc.url.value());
|
||||
} else if (chromeLoc.urlRegex.hasValue()) {
|
||||
const std::regex regex(stripCachePrevention(chromeLoc.urlRegex.value()));
|
||||
for (const auto &fileName : parsedScripts) {
|
||||
if (std::regex_match(fileName, regex)) {
|
||||
hermesLoc.fileName = fileName;
|
||||
auto it = parsedScripts.rbegin();
|
||||
|
||||
// We currently only support one physical breakpoint per location, so
|
||||
// search backwards so that we find the latest matching file.
|
||||
while (it != parsedScripts.rend()) {
|
||||
if (std::regex_match(*it, regex)) {
|
||||
hermesLoc.fileName = *it;
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user