From c2db8da4df4b55f9b829c3c22f29cb747ebf8c4b Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 16 Mar 2021 10:02:38 +0800 Subject: [PATCH] fix(inspector): await inspector init to avoid races (#5829) --- src/server/supplements/inspectorController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/supplements/inspectorController.ts b/src/server/supplements/inspectorController.ts index cac5b82ca6497..1bea4896d83fe 100644 --- a/src/server/supplements/inspectorController.ts +++ b/src/server/supplements/inspectorController.ts @@ -25,7 +25,7 @@ export class InspectorController implements InstrumentationListener { async onContextCreated(context: BrowserContext): Promise { if (isDebugMode()) - RecorderSupplement.getOrCreate(context, { pauseOnNextStatement: true }); + await RecorderSupplement.getOrCreate(context, { pauseOnNextStatement: true }); } async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata): Promise { @@ -53,7 +53,7 @@ export class InspectorController implements InstrumentationListener { } if (shouldOpenInspector(sdkObject, metadata)) - RecorderSupplement.getOrCreate(context, { pauseOnNextStatement: true }); + await RecorderSupplement.getOrCreate(context, { pauseOnNextStatement: true }); const recorder = await RecorderSupplement.getNoCreate(context); await recorder?.onBeforeCall(sdkObject, metadata);