Compatability workaround for proper Source mapping in Hermes Profiler Replace scriptIds in the profile nodes with the actual scriptIds based on the URL
| 186 | // Compatability workaround for proper Source mapping in Hermes Profiler |
| 187 | // Replace scriptIds in the profile nodes with the actual scriptIds based on the URL |
| 188 | void HermesDebuggerConnection::handleProfilerStop(const Value& message) { |
| 189 | auto nodeArray = message.getMapValue("result").getMapValue("profile").getMapValue("nodes").getArrayRef(); |
| 190 | if (nodeArray != nullptr) { |
| 191 | for (size_t i = 0; i < nodeArray->size(); i++) { |
| 192 | auto callFrame = (*nodeArray)[i].getMapValue("callFrame"); |
| 193 | auto functionName = callFrame.getMapValue("functionName").toStringBox(); |
| 194 | callFrame.setMapValue("functionName", Value(cleanFunctionName(functionName))); |
| 195 | auto url = callFrame.getMapValue("url").toStringBox(); |
| 196 | if (_scriptIdsByUrl.find(url) != _scriptIdsByUrl.end()) { |
| 197 | auto scriptId = _scriptIdsByUrl[url]; |
| 198 | callFrame.setMapValue("scriptId", Value(scriptId)); |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | submitMessageToCDP(message); |
| 203 | } |
| 204 | |
| 205 | // Compatability workaround for debugging Hermes with Block Scoping enabled |
| 206 | // Issue outlined here: https://github.com/facebook/hermes/issues/1355. Should be fixed in a future release of Static |
nothing calls this directly
no test coverage detected