From f496c65491fd5148f2430f4aee4bb167ba8d44d4 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 6 May 2021 12:57:02 -0700 Subject: [PATCH] cherry-pick(release-1.11): use old screencast protocol calls for Mac 10.14 (#6442) Cherry-pick #6440, SHA aab602cc3b7ccef294f57bb617eedb434d943474 References #6439 --- src/server/webkit/wkPage.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/webkit/wkPage.ts b/src/server/webkit/wkPage.ts index cd86f5e57a097..6a65cfd47f39a 100644 --- a/src/server/webkit/wkPage.ts +++ b/src/server/webkit/wkPage.ts @@ -19,6 +19,7 @@ import * as jpeg from 'jpeg-js'; import path from 'path'; import * as png from 'pngjs'; import { splitErrorMessage } from '../../utils/stackTrace'; +import { hostPlatform } from '../../utils/registry'; import { assert, createGuid, debugAssert, headersArrayToObject, headersObjectToArray } from '../../utils/utils'; import * as accessibility from '../accessibility'; import * as dialog from '../dialog'; @@ -737,7 +738,8 @@ export class WKPage implements PageDelegate { async _startScreencast(options: types.PageScreencastOptions): Promise { assert(!this._recordingVideoFile); - const { screencastId } = await this._pageProxySession.send('Screencast.startVideo', { + const START_VIDEO_PROTOCOL_COMMAND = hostPlatform === 'mac10.14' ? 'Screencast.start' : 'Screencast.startVideo'; + const { screencastId } = await this._pageProxySession.send(START_VIDEO_PROTOCOL_COMMAND as any, { file: options.outputFile, width: options.width, height: options.height, @@ -749,7 +751,8 @@ export class WKPage implements PageDelegate { async _stopScreencast(): Promise { if (!this._recordingVideoFile) return; - await this._pageProxySession.sendMayFail('Screencast.stopVideo'); + const STOP_VIDEO_PROTOCOL_COMMAND = hostPlatform === 'mac10.14' ? 'Screencast.stop' : 'Screencast.stopVideo'; + await this._pageProxySession.sendMayFail(STOP_VIDEO_PROTOCOL_COMMAND as any); this._recordingVideoFile = null; }