Skip to content

Commit

Permalink
fix: executionContextCleared test flake
Browse files Browse the repository at this point in the history
1. Execution contexts are cleared and we start waiting on shutdown
2. New scripts come in
3. Shutdown resolves and we incorrectly discard new scripts and context
  • Loading branch information
connor4312 committed Apr 29, 2024
1 parent 14af88d commit e7adc97
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/adapter/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,11 +884,18 @@ export class Thread implements IVariableStoreLocationProvider {
}

async _executionContextsCleared() {
const removedContexts = [...this._executionContexts.values()];
const pausedDetails = this._pausedDetails;
this._executionContexts.clear();
await this.shutdown.shutdownContext();
this._removeAllScripts();
for (const context of removedContexts) {
context.remove(this._sourceContainer);
}
this._breakpointManager.executionContextWasCleared();
if (this._pausedDetails) this.onResumed();

if (pausedDetails && pausedDetails === this._pausedDetails) {
this.onResumed();
}
}

_ensureDebuggerEnabledAndRefreshDebuggerId() {
Expand Down

0 comments on commit e7adc97

Please # to comment.