Merge pull request #1 from Voicemod-Sociedad-Limitada/feat/ignore-download-chromium
feat: setDownloadBehavior chromium request skippable by env variable
This commit is contained in:
commit
b892909912
|
|
@ -348,13 +348,15 @@ export class CRBrowserContext extends BrowserContext {
|
||||||
override async _initialize() {
|
override async _initialize() {
|
||||||
assert(!Array.from(this._browser._crPages.values()).some(page => page._browserContext === this));
|
assert(!Array.from(this._browser._crPages.values()).some(page => page._browserContext === this));
|
||||||
const promises: Promise<any>[] = [super._initialize()];
|
const promises: Promise<any>[] = [super._initialize()];
|
||||||
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') {
|
if (!process.env.PLAYWRIGHT_IGNORE_DOWNLOAD_BEHAVIOUR) {
|
||||||
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
|
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') {
|
||||||
behavior: this._options.acceptDownloads === 'accept' ? 'allowAndName' : 'deny',
|
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
|
||||||
browserContextId: this._browserContextId,
|
behavior: this._options.acceptDownloads === 'accept' ? 'allowAndName' : 'deny',
|
||||||
downloadPath: this._browser.options.downloadsPath,
|
browserContextId: this._browserContextId,
|
||||||
eventsEnabled: true,
|
downloadPath: this._browser.options.downloadsPath,
|
||||||
}));
|
eventsEnabled: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue