From eaf662b316f2f6333ecb8fb6e17e6f3779367372 Mon Sep 17 00:00:00 2001 From: Matt Blagden Date: Wed, 16 Aug 2023 07:59:09 -0700 Subject: [PATCH] Use correct type for profile script ID 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 --- lib/VM/Profiler/ChromeTraceSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/VM/Profiler/ChromeTraceSerializer.cpp b/lib/VM/Profiler/ChromeTraceSerializer.cpp index 02e7eadff55..3a1d0e36b54 100644 --- a/lib/VM/Profiler/ChromeTraceSerializer.cpp +++ b/lib/VM/Profiler/ChromeTraceSerializer.cpp @@ -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);