unprint 0.18.32 → 0.18.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app.js +14 -10
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -1268,7 +1268,10 @@ async function getBrowserInstance(scope, options, useProxy = false) {
|
|
|
1268
1268
|
async function closeAllBrowsers() {
|
|
1269
1269
|
const closingClients = Array.from(clients.values());
|
|
1270
1270
|
|
|
1271
|
-
await Promise.all(closingClients.map(async (client) =>
|
|
1271
|
+
await Promise.all(closingClients.map(async (client) => {
|
|
1272
|
+
await client.context.close();
|
|
1273
|
+
await client.browser.close();
|
|
1274
|
+
}));
|
|
1272
1275
|
|
|
1273
1276
|
events.emit('browserClose', {
|
|
1274
1277
|
keys: closingClients.map((client) => client.key),
|
|
@@ -1281,7 +1284,8 @@ async function closeAllBrowsers() {
|
|
|
1281
1284
|
async function closeBrowser(client, options) {
|
|
1282
1285
|
if (options.client === null // this browser is single-use
|
|
1283
1286
|
|| (client.retired && client.active === 0)) { // this browser is retired to minimize garbage build-up
|
|
1284
|
-
// this browser won't be reused
|
|
1287
|
+
// this browser won't be reused, browser close DOES NOT automatically close context https://github.com/microsoft/playwright/issues/15163
|
|
1288
|
+
await client.context.close();
|
|
1285
1289
|
await client.browser.close();
|
|
1286
1290
|
|
|
1287
1291
|
events.emit('browserClose', {
|
|
@@ -1408,7 +1412,7 @@ async function browserRequest(url, customOptions = {}) {
|
|
|
1408
1412
|
|
|
1409
1413
|
await closeBrowser(client, options);
|
|
1410
1414
|
|
|
1411
|
-
return {
|
|
1415
|
+
return curateResponse({
|
|
1412
1416
|
ok: false,
|
|
1413
1417
|
status,
|
|
1414
1418
|
statusText,
|
|
@@ -1416,7 +1420,7 @@ async function browserRequest(url, customOptions = {}) {
|
|
|
1416
1420
|
cookies: curateCookies(res, customOptions),
|
|
1417
1421
|
response: res,
|
|
1418
1422
|
res,
|
|
1419
|
-
};
|
|
1423
|
+
}, data, options, { url, customOptions });
|
|
1420
1424
|
}
|
|
1421
1425
|
|
|
1422
1426
|
events.emit('requestSuccess', feedbackBase);
|
|
@@ -1572,6 +1576,10 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1572
1576
|
return request(newUrl, body, options, method, redirects + 1);
|
|
1573
1577
|
}
|
|
1574
1578
|
|
|
1579
|
+
const data = options.interface === 'fetch'
|
|
1580
|
+
? await res.text()
|
|
1581
|
+
: await res.body.text();
|
|
1582
|
+
|
|
1575
1583
|
if (!(status >= 200 && status < 300)) {
|
|
1576
1584
|
handleError(new Error(`HTTP response from ${url} not OK (${status} ${res.statusText})`), 'HTTP_NOT_OK');
|
|
1577
1585
|
|
|
@@ -1581,7 +1589,7 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1581
1589
|
statusText: res.statusText,
|
|
1582
1590
|
});
|
|
1583
1591
|
|
|
1584
|
-
return {
|
|
1592
|
+
return curateResponse({
|
|
1585
1593
|
ok: false,
|
|
1586
1594
|
status,
|
|
1587
1595
|
statusText: res.statusText,
|
|
@@ -1589,13 +1597,9 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1589
1597
|
cookies: curateCookies(res, customOptions),
|
|
1590
1598
|
response: res,
|
|
1591
1599
|
res,
|
|
1592
|
-
};
|
|
1600
|
+
}, data, options, { url, customOptions });
|
|
1593
1601
|
}
|
|
1594
1602
|
|
|
1595
|
-
const data = options.interface === 'fetch'
|
|
1596
|
-
? await res.text()
|
|
1597
|
-
: await res.body.text();
|
|
1598
|
-
|
|
1599
1603
|
events.emit('requestSuccess', {
|
|
1600
1604
|
...feedbackBase,
|
|
1601
1605
|
status,
|