mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
fix(tracing): do not serialise out-of-process Buffers (#29425)
This commit is contained in:
parent
b15a7076dc
commit
498b8bb269
@ -351,7 +351,7 @@ export class DispatcherConnection {
|
||||
const result = await dispatcher._handleCommand(callMetadata, method, validParams);
|
||||
const validator = findValidator(dispatcher._type, method, 'Result');
|
||||
response.result = validator(result, '', { tChannelImpl: this._tChannelImplToWire.bind(this), binary: this._isLocal ? 'buffer' : 'toBase64' });
|
||||
callMetadata.result = response.result;
|
||||
callMetadata.result = result;
|
||||
} catch (e) {
|
||||
if (isTargetClosedError(e) && sdkObject) {
|
||||
const reason = closeReason(sdkObject);
|
||||
|
@ -6,4 +6,5 @@
|
||||
../../../utils/
|
||||
../../../utilsBundle.ts
|
||||
../../../zipBundle.ts
|
||||
../common/
|
||||
../../dispatchers/dispatcher.ts
|
||||
../common/
|
@ -42,6 +42,7 @@ import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter';
|
||||
import { Snapshotter } from './snapshotter';
|
||||
import { yazl } from '../../../zipBundle';
|
||||
import type { ConsoleMessage } from '../../console';
|
||||
import { Dispatcher } from '../../dispatchers/dispatcher';
|
||||
|
||||
const version: trace.VERSION = 6;
|
||||
|
||||
@ -496,8 +497,10 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
|
||||
function visitTraceEvent(object: any, sha1s: Set<string>): any {
|
||||
if (Array.isArray(object))
|
||||
return object.map(o => visitTraceEvent(o, sha1s));
|
||||
if (object instanceof Dispatcher)
|
||||
return `<${(object as Dispatcher<any, any, any>)._type}>`;
|
||||
if (object instanceof Buffer)
|
||||
return undefined;
|
||||
return `<Buffer>`;
|
||||
if (object instanceof Date)
|
||||
return object;
|
||||
if (typeof object === 'object') {
|
||||
|
@ -109,9 +109,7 @@ test('should not collect snapshots by default', async ({ context, page, server }
|
||||
expect(events.some(e => e.type === 'resource-snapshot')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should not include buffers in the trace', async ({ context, page, server, mode }, testInfo) => {
|
||||
test.skip(mode !== 'default', 'no buffers with remote connections');
|
||||
|
||||
test('should not include buffers in the trace', async ({ context, page, server }, testInfo) => {
|
||||
await context.tracing.start({ snapshots: true });
|
||||
await page.goto(server.PREFIX + '/empty.html');
|
||||
await page.screenshot();
|
||||
@ -120,7 +118,9 @@ test('should not include buffers in the trace', async ({ context, page, server,
|
||||
const screenshotEvent = actionObjects.find(a => a.apiName === 'page.screenshot');
|
||||
expect(screenshotEvent.beforeSnapshot).toBeTruthy();
|
||||
expect(screenshotEvent.afterSnapshot).toBeTruthy();
|
||||
expect(screenshotEvent.result).toEqual({});
|
||||
expect(screenshotEvent.result).toEqual({
|
||||
'binary': '<Buffer>',
|
||||
});
|
||||
});
|
||||
|
||||
test('should exclude internal pages', async ({ browserName, context, page, server }, testInfo) => {
|
||||
|
Loading…
Reference in New Issue
Block a user