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,6 +348,7 @@ export class CRBrowserContext extends BrowserContext {
|
|||
override async _initialize() {
|
||||
assert(!Array.from(this._browser._crPages.values()).some(page => page._browserContext === this));
|
||||
const promises: Promise<any>[] = [super._initialize()];
|
||||
if (!process.env.PLAYWRIGHT_IGNORE_DOWNLOAD_BEHAVIOUR) {
|
||||
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') {
|
||||
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
|
||||
behavior: this._options.acceptDownloads === 'accept' ? 'allowAndName' : 'deny',
|
||||
|
|
@ -356,6 +357,7 @@ export class CRBrowserContext extends BrowserContext {
|
|||
eventsEnabled: true,
|
||||
}));
|
||||
}
|
||||
}
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue