playwright-core
Advanced tools
Comparing version 1.46.0-alpha-2024-06-20 to 1.46.0-alpha-2024-06-21
@@ -30,3 +30,3 @@ { | ||
"name": "webkit", | ||
"revision": "2035", | ||
"revision": "2037", | ||
"installByDefault": true, | ||
@@ -33,0 +33,0 @@ "revisionOverrides": { |
@@ -145,7 +145,7 @@ "use strict"; | ||
(0, _utils.assert)((options.data === undefined ? 0 : 1) + (options.form === undefined ? 0 : 1) + (options.multipart === undefined ? 0 : 1) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`); | ||
(0, _utils.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' should be greater than or equal to '0'`); | ||
(0, _utils.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' must be greater than or equal to '0'`); | ||
(0, _utils.assert)(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`); | ||
const url = options.url !== undefined ? options.url : options.request.url(); | ||
const params = objectToArray(options.params); | ||
const method = options.method || ((_options$request = options.request) === null || _options$request === void 0 ? void 0 : _options$request.method()); | ||
const maxRedirects = options.maxRedirects; | ||
// Cannot call allHeaders() here as the request may be paused inside route handler. | ||
@@ -213,3 +213,4 @@ const headersObj = options.headers || ((_options$request2 = options.request) === null || _options$request2 === void 0 ? void 0 : _options$request2.headers()); | ||
ignoreHTTPSErrors: options.ignoreHTTPSErrors, | ||
maxRedirects: maxRedirects, | ||
maxRedirects: options.maxRedirects, | ||
maxRetries: options.maxRetries, | ||
...fixtures | ||
@@ -216,0 +217,0 @@ }); |
@@ -569,3 +569,7 @@ "use strict"; | ||
if (options.noDefaultViewport && !!options.isMobile) throw new Error(`"isMobile" option is not supported with null "viewport"`); | ||
if (options.acceptDownloads === undefined) options.acceptDownloads = 'accept'; | ||
if (options.acceptDownloads === undefined && browserOptions.name !== 'electron') options.acceptDownloads = 'accept'; | ||
// Electron requires explicit acceptDownloads: true since we wait for | ||
// https://github.com/electron/electron/pull/41718 to be widely shipped. | ||
// In 6-12 months, we can remove this check. | ||
else if (options.acceptDownloads === undefined && browserOptions.name === 'electron') options.acceptDownloads = 'internal-browser-default'; | ||
if (!options.viewport && !options.noDefaultViewport) options.viewport = { | ||
@@ -572,0 +576,0 @@ width: 1280, |
@@ -301,3 +301,3 @@ "use strict"; | ||
const promises = [super._initialize()]; | ||
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') { | ||
if (this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') { | ||
promises.push(this._browser._session.send('Browser.setDownloadBehavior', { | ||
@@ -304,0 +304,0 @@ behavior: this._options.acceptDownloads === 'accept' ? 'allowAndName' : 'deny', |
@@ -137,3 +137,3 @@ "use strict"; | ||
const fetchResponse = await controller.run(progress => { | ||
return this._sendRequest(progress, requestUrl, options, postData); | ||
return this._sendRequestWithRetries(progress, requestUrl, options, postData, params.maxRetries); | ||
}); | ||
@@ -175,2 +175,21 @@ const fetchUid = this._storeResponseBody(fetchResponse.body); | ||
} | ||
async _sendRequestWithRetries(progress, url, options, postData, maxRetries) { | ||
var _maxRetries; | ||
(_maxRetries = maxRetries) !== null && _maxRetries !== void 0 ? _maxRetries : maxRetries = 0; | ||
let backoff = 250; | ||
for (let i = 0; i <= maxRetries; i++) { | ||
try { | ||
return await this._sendRequest(progress, url, options, postData); | ||
} catch (e) { | ||
if (maxRetries === 0) throw e; | ||
if (i === maxRetries || options.deadline && (0, _utils.monotonicTime)() + backoff > options.deadline) throw new Error(`Failed after ${i + 1} attempt(s): ${e}`); | ||
// Retry on connection reset only. | ||
if (e.code !== 'ECONNRESET') throw e; | ||
progress.log(` Received ECONNRESET, will retry after ${backoff}ms.`); | ||
await new Promise(f => setTimeout(f, backoff)); | ||
backoff *= 2; | ||
} | ||
} | ||
throw new Error('Unreachable'); | ||
} | ||
async _sendRequest(progress, url, options, postData) { | ||
@@ -177,0 +196,0 @@ var _getHeader; |
{ | ||
"name": "playwright-core", | ||
"version": "1.46.0-alpha-2024-06-20", | ||
"version": "1.46.0-alpha-2024-06-21", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7243051
101259