Skip to content

Commit

Permalink
Use correct type for profile script ID
Browse files Browse the repository at this point in the history
Summary:
Stopping the sampling profiler produced a JSON trace with
numeric `scriptId`s, whereas [the CDP spec expects a string](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-ScriptId),
resulting in an exception instead of a profiler trace:
```
JSONValue not a string
```

Make the `ChromeTraceSerializer` emit strings for `scriptID` to
adhere to the protocol spec.

Reviewed By: dannysu

Differential Revision: D48325992

fbshipit-source-id: a23c3acafd6c8f3d80bf8f75d94de5e21f7256db
  • Loading branch information
Matt Blagden authored and facebook-github-bot committed Aug 16, 2023
1 parent 3ecaae9 commit eaf662b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/VM/Profiler/ChromeTraceSerializer.cpp
Expand Up @@ -376,7 +376,7 @@ static void emitProfileNode(

json.openDict();
json.emitKeyValue("functionName", name);
json.emitKeyValue("scriptId", scriptId);
json.emitKeyValue("scriptId", std::to_string(scriptId));
json.emitKeyValue("url", url);
json.emitKeyValue("lineNumber", lineNumber);
json.emitKeyValue("columnNumber", columnNumber);
Expand Down

0 comments on commit eaf662b

Please sign in to comment.