unprint 0.18.33 → 0.18.35

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.18.33",
3
+ "version": "0.18.35",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {},
package/src/app.js CHANGED
@@ -1149,7 +1149,7 @@ function curateCookies(res, options) {
1149
1149
 
1150
1150
  function curateResponse(res, data, options, { url, control, customOptions }) {
1151
1151
  const base = {
1152
- ok: true,
1152
+ ok: res.ok ?? true,
1153
1153
  data,
1154
1154
  body: data,
1155
1155
  status: res.statusCode || res.status,
@@ -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) => client.browser.close()));
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', {