@@ -55,7 +55,7 @@ export type TraceViewerAppOptions = {
5555
5656const tracesDirMarker = 'traces.dir' ;
5757
58- function validateTraceUrl ( traceFileOrUrl : string | undefined ) : string | undefined {
58+ function validateTraceUrlOrPath ( traceFileOrUrl : string | undefined ) : string | undefined {
5959 if ( ! traceFileOrUrl )
6060 return traceFileOrUrl ;
6161
@@ -152,7 +152,7 @@ export async function installRootRedirect(server: HttpServer, traceUrl: string |
152152}
153153
154154export async function runTraceViewerApp ( traceUrl : string | undefined , browserName : string , options : TraceViewerServerOptions & { headless ?: boolean } , exitOnClose ?: boolean ) {
155- traceUrl = validateTraceUrl ( traceUrl ) ;
155+ traceUrl = validateTraceUrlOrPath ( traceUrl ) ;
156156 const server = await startTraceViewerServer ( options ) ;
157157 await installRootRedirect ( server , traceUrl , options ) ;
158158 const page = await openTraceViewerApp ( server . urlPrefix ( 'precise' ) , browserName , options ) ;
@@ -162,7 +162,7 @@ export async function runTraceViewerApp(traceUrl: string | undefined, browserNam
162162}
163163
164164export async function runTraceInBrowser ( traceUrl : string | undefined , options : TraceViewerServerOptions ) {
165- traceUrl = validateTraceUrl ( traceUrl ) ;
165+ traceUrl = validateTraceUrlOrPath ( traceUrl ) ;
166166 const server = await startTraceViewerServer ( options ) ;
167167 await installRootRedirect ( server , traceUrl , options ) ;
168168 await openTraceInBrowser ( server . urlPrefix ( 'human-readable' ) ) ;
@@ -216,8 +216,8 @@ class StdinServer implements Transport {
216216
217217 constructor ( ) {
218218 process . stdin . on ( 'data' , data => {
219- const url = data . toString ( ) . trim ( ) ;
220- if ( url === this . _traceUrl )
219+ const url = validateTraceUrlOrPath ( data . toString ( ) . trim ( ) ) ;
220+ if ( ! url || url === this . _traceUrl )
221221 return ;
222222 if ( url . endsWith ( '.json' ) )
223223 this . _pollLoadTrace ( url ) ;
0 commit comments