Fixes #27072.
This commit is contained in:
parent
ed919f3dda
commit
2a577a5caf
|
|
@ -384,7 +384,9 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
|
|||
onEvent(sdkObject: SdkObject, event: trace.EventTraceEvent) {
|
||||
if (!sdkObject.attribution.context)
|
||||
return;
|
||||
if (event.method === 'console' || (event.method === '__create__' && event.class === 'ConsoleMessage')) {
|
||||
if (event.method === 'console' ||
|
||||
(event.method === '__create__' && event.class === 'ConsoleMessage') ||
|
||||
(event.method === '__create__' && event.class === 'JSHandle')) {
|
||||
// Console messages are handled separately.
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export class TraceModel {
|
|||
private _backend!: TraceModelBackend;
|
||||
private _attachments = new Map<string, trace.AfterActionTraceEventAttachment>();
|
||||
private _resourceToContentType = new Map<string, string>();
|
||||
private _jsHandles = new Map<string, { preview: string }>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
|
@ -112,6 +113,7 @@ export class TraceModel {
|
|||
}
|
||||
|
||||
this._snapshotStorage!.finalize();
|
||||
this._jsHandles.clear();
|
||||
}
|
||||
|
||||
async hasEntry(filename: string): Promise<boolean> {
|
||||
|
|
@ -297,12 +299,23 @@ export class TraceModel {
|
|||
return null;
|
||||
|
||||
if (event.type === 'event') {
|
||||
if (metadata.method === '__create__' && metadata.type === 'JSHandle')
|
||||
this._jsHandles.set(metadata.params.guid, metadata.params.initializer);
|
||||
if (metadata.method === '__create__' && metadata.type === 'ConsoleMessage') {
|
||||
return {
|
||||
type: 'object',
|
||||
class: metadata.type,
|
||||
guid: metadata.params.guid,
|
||||
initializer: metadata.params.initializer,
|
||||
initializer: {
|
||||
...metadata.params.initializer,
|
||||
args: metadata.params.initializer.args?.map((arg: any) => {
|
||||
if (arg.guid) {
|
||||
const handle = this._jsHandles.get(arg.guid);
|
||||
return { preview: handle?.preview || '', value: '' };
|
||||
}
|
||||
return { preview: '', value: '' };
|
||||
})
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue