mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(inspector): restore point highlight (#5455)
This commit is contained in:
parent
0782b25272
commit
ecd15e6175
@ -50,10 +50,9 @@ export class RecorderSupplement {
|
|||||||
private _bufferedOutput: BufferedOutput;
|
private _bufferedOutput: BufferedOutput;
|
||||||
private _recorderApp: RecorderApp | null = null;
|
private _recorderApp: RecorderApp | null = null;
|
||||||
private _params: channels.BrowserContextRecorderSupplementEnableParams;
|
private _params: channels.BrowserContextRecorderSupplementEnableParams;
|
||||||
private _currentCallsMetadata = new Set<CallMetadata>();
|
private _currentCallsMetadata = new Map<CallMetadata, SdkObject>();
|
||||||
private _pausedCallsMetadata = new Map<CallMetadata, () => void>();
|
private _pausedCallsMetadata = new Map<CallMetadata, () => void>();
|
||||||
private _pauseOnNextStatement = true;
|
private _pauseOnNextStatement = true;
|
||||||
private _sdkObject: SdkObject | null = null;
|
|
||||||
private _recorderSource: Source;
|
private _recorderSource: Source;
|
||||||
private _userSources = new Map<string, Source>();
|
private _userSources = new Map<string, Source>();
|
||||||
|
|
||||||
@ -166,11 +165,10 @@ export class RecorderSupplement {
|
|||||||
await this._context.exposeBinding('_playwrightRecorderState', false, source => {
|
await this._context.exposeBinding('_playwrightRecorderState', false, source => {
|
||||||
let actionPoint: Point | undefined = undefined;
|
let actionPoint: Point | undefined = undefined;
|
||||||
let actionSelector: string | undefined = undefined;
|
let actionSelector: string | undefined = undefined;
|
||||||
if (source.page === this._sdkObject?.attribution?.page) {
|
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
||||||
if (this._currentCallsMetadata.size) {
|
if (source.page === sdkObject.attribution.page) {
|
||||||
const metadata = this._currentCallsMetadata.values().next().value;
|
actionPoint = metadata.point || actionPoint;
|
||||||
actionPoint = metadata.values().next().value;
|
actionSelector = metadata.params.selector || actionSelector;
|
||||||
actionSelector = metadata.params.selector;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const uiState: UIState = { mode: this._mode, actionPoint, actionSelector };
|
const uiState: UIState = { mode: this._mode, actionPoint, actionSelector };
|
||||||
@ -206,7 +204,7 @@ export class RecorderSupplement {
|
|||||||
|
|
||||||
this._recorderApp?.setPaused(false);
|
this._recorderApp?.setPaused(false);
|
||||||
this._updateUserSources();
|
this._updateUserSources();
|
||||||
this.updateCallLog([...this._currentCallsMetadata]);
|
this.updateCallLog([...this._currentCallsMetadata.keys()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _onPage(page: Page) {
|
private async _onPage(page: Page) {
|
||||||
@ -326,8 +324,7 @@ export class RecorderSupplement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata): Promise<void> {
|
async onBeforeCall(sdkObject: SdkObject, metadata: CallMetadata): Promise<void> {
|
||||||
this._sdkObject = sdkObject;
|
this._currentCallsMetadata.set(metadata, sdkObject);
|
||||||
this._currentCallsMetadata.add(metadata);
|
|
||||||
this._updateUserSources();
|
this._updateUserSources();
|
||||||
this.updateCallLog([metadata]);
|
this.updateCallLog([metadata]);
|
||||||
if (metadata.method === 'pause' || (this._pauseOnNextStatement && metadata.method === 'goto'))
|
if (metadata.method === 'pause' || (this._pauseOnNextStatement && metadata.method === 'goto'))
|
||||||
@ -335,7 +332,6 @@ export class RecorderSupplement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onAfterCall(metadata: CallMetadata): Promise<void> {
|
async onAfterCall(metadata: CallMetadata): Promise<void> {
|
||||||
this._sdkObject = null;
|
|
||||||
this._currentCallsMetadata.delete(metadata);
|
this._currentCallsMetadata.delete(metadata);
|
||||||
this._pausedCallsMetadata.delete(metadata);
|
this._pausedCallsMetadata.delete(metadata);
|
||||||
this._updateUserSources();
|
this._updateUserSources();
|
||||||
@ -350,7 +346,7 @@ export class RecorderSupplement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply new decorations.
|
// Apply new decorations.
|
||||||
for (const metadata of this._currentCallsMetadata) {
|
for (const metadata of this._currentCallsMetadata.keys()) {
|
||||||
if (!metadata.stack || !metadata.stack[0])
|
if (!metadata.stack || !metadata.stack[0])
|
||||||
continue;
|
continue;
|
||||||
const { file, line } = metadata.stack[0];
|
const { file, line } = metadata.stack[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user