chore: don't reuse recorder app profile (#5365)

This commit is contained in:
Pavel Feldman 2021-02-08 16:02:23 -08:00 committed by GitHub
parent b32be4b3d4
commit 6680713e84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 10 deletions

View file

@ -71,7 +71,7 @@ export abstract class BrowserType {
return browser;
}
async launchPersistentContext(userDataDir: string, options: types.LaunchPersistentOptions = {}): Promise<BrowserContext> {
async launchPersistentContext(userDataDir?: string, options: types.LaunchPersistentOptions = {}): Promise<BrowserContext> {
options = validateLaunchOptions(options);
const persistent: types.BrowserContextOptions = options;
const controller = new ProgressController();

View file

@ -127,7 +127,7 @@ export class Chromium extends BrowserType {
}
}
export const DEFAULT_ARGS = [
const DEFAULT_ARGS = [
'--disable-background-networking',
'--enable-features=NetworkService,NetworkServiceInProcess',
'--disable-background-timer-throttling',

View file

@ -14,7 +14,6 @@
* limitations under the License.
*/
import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as util from 'util';
@ -23,7 +22,6 @@ import { Page } from '../../page';
import { ProgressController } from '../../progress';
import { createPlaywright } from '../../playwright';
import { EventEmitter } from 'events';
import { DEFAULT_ARGS } from '../../chromium/chromium';
const readFileAsync = util.promisify(fs.readFile);
@ -92,15 +90,10 @@ export class RecorderApp extends EventEmitter {
static async open(): Promise<RecorderApp> {
const recorderPlaywright = createPlaywright(true);
const context = await recorderPlaywright.chromium.launchPersistentContext('', {
ignoreAllDefaultArgs: true,
const context = await recorderPlaywright.chromium.launchPersistentContext(undefined, {
args: [
...DEFAULT_ARGS,
`--user-data-dir=${path.join(os.homedir(),'.playwright-app')}`,
'--remote-debugging-pipe',
'--app=data:text/html,',
'--window-size=300,800',
'--no-sandbox',
],
noDefaultViewport: true
});