@browserless.io/browserless 2.24.3 → 2.25.0
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/CHANGELOG.md +17 -1
- package/README.md +1 -1
- package/build/browserless.js +3 -1
- package/build/browsers/browsers.cdp.d.ts +3 -0
- package/build/browsers/browsers.cdp.js +4 -1
- package/build/browsers/browsers.playwright.d.ts +4 -0
- package/build/browsers/browsers.playwright.js +5 -1
- package/build/browsers/index.js +3 -2
- package/build/http.d.ts +9 -0
- package/build/http.js +9 -0
- package/build/routes/chrome/http/content.post.body.json +8 -8
- package/build/routes/chrome/http/pdf.post.body.json +8 -8
- package/build/routes/chrome/http/scrape.post.body.json +8 -8
- package/build/routes/chrome/http/screenshot.post.body.json +8 -8
- package/build/routes/chrome/tests/kill-sessions.spec.js +1 -1
- package/build/routes/chromium/http/content.post.body.json +8 -8
- package/build/routes/chromium/http/pdf.post.body.json +8 -8
- package/build/routes/chromium/http/scrape.post.body.json +8 -8
- package/build/routes/chromium/http/screenshot.post.body.json +8 -8
- package/build/routes/chromium/tests/kill-sessions.spec.js +1 -1
- package/build/routes/edge/http/content.post.body.json +579 -0
- package/build/routes/edge/http/content.post.d.ts +8 -0
- package/build/routes/edge/http/content.post.js +7 -0
- package/build/routes/edge/http/content.post.query.json +183 -0
- package/build/routes/edge/http/content.post.response.json +5 -0
- package/build/routes/edge/http/download.post.body.json +32 -0
- package/build/routes/edge/http/download.post.d.ts +8 -0
- package/build/routes/edge/http/download.post.js +7 -0
- package/build/routes/edge/http/download.post.query.json +120 -0
- package/build/routes/edge/http/download.post.response.json +4 -0
- package/build/routes/edge/http/function.post.body.json +32 -0
- package/build/routes/edge/http/function.post.d.ts +8 -0
- package/build/routes/edge/http/function.post.js +7 -0
- package/build/routes/edge/http/function.post.query.json +120 -0
- package/build/routes/edge/http/function.post.response.json +4 -0
- package/build/routes/edge/http/json-list.get.d.ts +5 -0
- package/build/routes/edge/http/json-list.get.js +5 -0
- package/build/routes/edge/http/json-list.get.response.json +52 -0
- package/build/routes/edge/http/json-new.put.d.ts +5 -0
- package/build/routes/edge/http/json-new.put.js +5 -0
- package/build/routes/edge/http/json-new.put.response.json +44 -0
- package/build/routes/edge/http/json-protocol.get.d.ts +5 -0
- package/build/routes/edge/http/json-protocol.get.js +5 -0
- package/build/routes/edge/http/json-protocol.get.response.json +6 -0
- package/build/routes/edge/http/json-version.get.d.ts +5 -0
- package/build/routes/edge/http/json-version.get.js +5 -0
- package/build/routes/edge/http/json-version.get.response.json +44 -0
- package/build/routes/edge/http/pdf.post.body.json +724 -0
- package/build/routes/edge/http/pdf.post.d.ts +8 -0
- package/build/routes/edge/http/pdf.post.js +7 -0
- package/build/routes/edge/http/pdf.post.query.json +120 -0
- package/build/routes/edge/http/pdf.post.response.json +5 -0
- package/build/routes/edge/http/performance.post.body.json +26 -0
- package/build/routes/edge/http/performance.post.d.ts +8 -0
- package/build/routes/edge/http/performance.post.js +7 -0
- package/build/routes/edge/http/performance.post.query.json +120 -0
- package/build/routes/edge/http/performance.post.response.json +7 -0
- package/build/routes/edge/http/scrape.post.body.json +626 -0
- package/build/routes/edge/http/scrape.post.d.ts +8 -0
- package/build/routes/edge/http/scrape.post.js +7 -0
- package/build/routes/edge/http/scrape.post.query.json +183 -0
- package/build/routes/edge/http/scrape.post.response.json +334 -0
- package/build/routes/edge/http/screenshot.post.body.json +669 -0
- package/build/routes/edge/http/screenshot.post.d.ts +8 -0
- package/build/routes/edge/http/screenshot.post.js +7 -0
- package/build/routes/edge/http/screenshot.post.query.json +120 -0
- package/build/routes/edge/http/screenshot.post.response.json +5 -0
- package/build/routes/edge/tests/content.spec.d.ts +1 -0
- package/build/routes/edge/tests/content.spec.js +312 -0
- package/build/routes/edge/tests/download.spec.d.ts +1 -0
- package/build/routes/edge/tests/download.spec.js +67 -0
- package/build/routes/edge/tests/function.spec.d.ts +1 -0
- package/build/routes/edge/tests/function.spec.js +277 -0
- package/build/routes/edge/tests/json-version.spec.d.ts +1 -0
- package/build/routes/edge/tests/json-version.spec.js +37 -0
- package/build/routes/edge/tests/kill-sessions.spec.d.ts +1 -0
- package/build/routes/edge/tests/kill-sessions.spec.js +80 -0
- package/build/routes/edge/tests/page-websocket.spec.d.ts +1 -0
- package/build/routes/edge/tests/page-websocket.spec.js +97 -0
- package/build/routes/edge/tests/pdf.spec.d.ts +1 -0
- package/build/routes/edge/tests/pdf.spec.js +345 -0
- package/build/routes/edge/tests/performance.spec.d.ts +1 -0
- package/build/routes/edge/tests/performance.spec.js +124 -0
- package/build/routes/edge/tests/scrape.spec.d.ts +1 -0
- package/build/routes/edge/tests/scrape.spec.js +354 -0
- package/build/routes/edge/tests/screenshot.spec.d.ts +1 -0
- package/build/routes/edge/tests/screenshot.spec.js +339 -0
- package/build/routes/edge/tests/websocket.spec.d.ts +1 -0
- package/build/routes/edge/tests/websocket.spec.js +384 -0
- package/build/routes/edge/ws/browser.d.ts +7 -0
- package/build/routes/edge/ws/browser.js +6 -0
- package/build/routes/edge/ws/browser.query.json +120 -0
- package/build/routes/edge/ws/cdp.d.ts +8 -0
- package/build/routes/edge/ws/cdp.js +7 -0
- package/build/routes/edge/ws/cdp.query.json +120 -0
- package/build/routes/edge/ws/page.d.ts +8 -0
- package/build/routes/edge/ws/page.js +7 -0
- package/build/routes/edge/ws/page.query.json +120 -0
- package/build/routes/edge/ws/playwright.d.ts +8 -0
- package/build/routes/edge/ws/playwright.js +7 -0
- package/build/routes/edge/ws/playwright.query.json +100 -0
- package/build/routes/firefox/tests/kill-sessions.spec.js +1 -1
- package/build/routes/webkit/tests/kill-sessions.spec.js +1 -1
- package/build/sdk-utils.js +1 -1
- package/build/shared/scrape.http.js +2 -2
- package/build/types.d.ts +32 -0
- package/build/types.js +18 -0
- package/build/utils.d.ts +1 -0
- package/build/utils.js +16 -2
- package/docker/chrome/Dockerfile +14 -14
- package/docker/chromium/Dockerfile +14 -14
- package/docker/edge/.dockerignore +16 -0
- package/docker/edge/Dockerfile +43 -0
- package/docker/firefox/Dockerfile +14 -14
- package/docker/multi/Dockerfile +18 -18
- package/docker/sdk/Dockerfile +10 -0
- package/package.json +18 -18
- package/src/browserless.ts +4 -0
- package/src/browsers/browsers.cdp.ts +5 -0
- package/src/browsers/browsers.playwright.ts +6 -0
- package/src/browsers/index.ts +4 -1
- package/src/http.ts +9 -0
- package/src/routes/chrome/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/chromium/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/edge/http/content.post.ts +20 -0
- package/src/routes/edge/http/download.post.ts +20 -0
- package/src/routes/edge/http/function.post.ts +20 -0
- package/src/routes/edge/http/json-list.get.ts +7 -0
- package/src/routes/edge/http/json-new.put.ts +7 -0
- package/src/routes/edge/http/json-protocol.get.ts +7 -0
- package/src/routes/edge/http/json-version.get.ts +7 -0
- package/src/routes/edge/http/pdf.post.ts +20 -0
- package/src/routes/edge/http/performance.post.ts +20 -0
- package/src/routes/edge/http/scrape.post.ts +20 -0
- package/src/routes/edge/http/screenshot.post.ts +20 -0
- package/src/routes/edge/tests/content.spec.ts +376 -0
- package/src/routes/edge/tests/download.spec.ts +77 -0
- package/src/routes/edge/tests/function.spec.ts +317 -0
- package/src/routes/edge/tests/json-version.spec.ts +52 -0
- package/src/routes/edge/tests/kill-sessions.spec.ts +99 -0
- package/src/routes/edge/tests/page-websocket.spec.ts +129 -0
- package/src/routes/edge/tests/pdf.spec.ts +389 -0
- package/src/routes/edge/tests/performance.spec.ts +155 -0
- package/src/routes/edge/tests/scrape.spec.ts +417 -0
- package/src/routes/edge/tests/screenshot.spec.ts +387 -0
- package/src/routes/edge/tests/websocket.spec.ts +510 -0
- package/src/routes/edge/ws/browser.ts +10 -0
- package/src/routes/edge/ws/cdp.ts +17 -0
- package/src/routes/edge/ws/page.ts +10 -0
- package/src/routes/edge/ws/playwright.ts +17 -0
- package/src/routes/firefox/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/webkit/tests/kill-sessions.spec.ts +1 -1
- package/src/sdk-utils.ts +1 -1
- package/src/shared/scrape.http.ts +2 -2
- package/src/types.ts +19 -0
- package/src/utils.ts +38 -16
- package/static/docs/swagger.json +2097 -10
- package/static/docs/swagger.min.json +2096 -9
- package/static/function/client.js +76 -68
- package/static/function/index.html +76 -68
|
@@ -4401,7 +4401,7 @@
|
|
|
4401
4401
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4402
4402
|
init_dirname();
|
|
4403
4403
|
init_buffer2();
|
|
4404
|
-
var packageVersion = "24.
|
|
4404
|
+
var packageVersion = "24.2.1";
|
|
4405
4405
|
|
|
4406
4406
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4407
4407
|
init_dirname();
|
|
@@ -5217,25 +5217,24 @@
|
|
|
5217
5217
|
|
|
5218
5218
|
// node_modules/puppeteer-core/lib/esm/puppeteer/api/Browser.js
|
|
5219
5219
|
var WEB_PERMISSION_TO_PROTOCOL_PERMISSION = /* @__PURE__ */ new Map([
|
|
5220
|
-
["geolocation", "geolocation"],
|
|
5221
|
-
["midi", "midi"],
|
|
5222
|
-
["notifications", "notifications"],
|
|
5223
|
-
// TODO: push isn't a valid type?
|
|
5224
|
-
// ['push', 'push'],
|
|
5225
|
-
["camera", "videoCapture"],
|
|
5226
|
-
["microphone", "audioCapture"],
|
|
5227
|
-
["background-sync", "backgroundSync"],
|
|
5228
|
-
["ambient-light-sensor", "sensors"],
|
|
5229
5220
|
["accelerometer", "sensors"],
|
|
5230
|
-
["
|
|
5231
|
-
["
|
|
5232
|
-
["
|
|
5221
|
+
["ambient-light-sensor", "sensors"],
|
|
5222
|
+
["background-sync", "backgroundSync"],
|
|
5223
|
+
["camera", "videoCapture"],
|
|
5233
5224
|
["clipboard-read", "clipboardReadWrite"],
|
|
5234
|
-
["clipboard-write", "clipboardReadWrite"],
|
|
5235
5225
|
["clipboard-sanitized-write", "clipboardSanitizedWrite"],
|
|
5226
|
+
["clipboard-write", "clipboardReadWrite"],
|
|
5227
|
+
["geolocation", "geolocation"],
|
|
5228
|
+
["gyroscope", "sensors"],
|
|
5229
|
+
["idle-detection", "idleDetection"],
|
|
5230
|
+
["keyboard-lock", "keyboardLock"],
|
|
5231
|
+
["magnetometer", "sensors"],
|
|
5232
|
+
["microphone", "audioCapture"],
|
|
5233
|
+
["midi", "midi"],
|
|
5234
|
+
["notifications", "notifications"],
|
|
5236
5235
|
["payment-handler", "paymentHandler"],
|
|
5237
5236
|
["persistent-storage", "durableStorage"],
|
|
5238
|
-
["
|
|
5237
|
+
["pointer-lock", "pointerLock"],
|
|
5239
5238
|
// chrome-specific permissions we have.
|
|
5240
5239
|
["midi-sysex", "midiSysex"]
|
|
5241
5240
|
]);
|
|
@@ -6711,7 +6710,7 @@
|
|
|
6711
6710
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6712
6711
|
* can be passed as-is and a
|
|
6713
6712
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6714
|
-
* allows
|
|
6713
|
+
* allows querying by
|
|
6715
6714
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6716
6715
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6717
6716
|
* and
|
|
@@ -6738,7 +6737,7 @@
|
|
|
6738
6737
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6739
6738
|
* can be passed as-is and a
|
|
6740
6739
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6741
|
-
* allows
|
|
6740
|
+
* allows querying by
|
|
6742
6741
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6743
6742
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6744
6743
|
* and
|
|
@@ -6872,7 +6871,7 @@
|
|
|
6872
6871
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6873
6872
|
* can be passed as-is and a
|
|
6874
6873
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6875
|
-
* allows
|
|
6874
|
+
* allows querying by
|
|
6876
6875
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6877
6876
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6878
6877
|
* and
|
|
@@ -6945,7 +6944,7 @@
|
|
|
6945
6944
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6946
6945
|
* can be passed as-is and a
|
|
6947
6946
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6948
|
-
* allows
|
|
6947
|
+
* allows querying by
|
|
6949
6948
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6950
6949
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6951
6950
|
* and
|
|
@@ -7567,7 +7566,7 @@
|
|
|
7567
7566
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7568
7567
|
* can be passed as-is and a
|
|
7569
7568
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7570
|
-
* allows
|
|
7569
|
+
* allows querying by
|
|
7571
7570
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7572
7571
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7573
7572
|
* and
|
|
@@ -7594,7 +7593,7 @@
|
|
|
7594
7593
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7595
7594
|
* can be passed as-is and a
|
|
7596
7595
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7597
|
-
* allows
|
|
7596
|
+
* allows querying by
|
|
7598
7597
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7599
7598
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7600
7599
|
* and
|
|
@@ -7628,7 +7627,7 @@
|
|
|
7628
7627
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7629
7628
|
* can be passed as-is and a
|
|
7630
7629
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7631
|
-
* allows
|
|
7630
|
+
* allows querying by
|
|
7632
7631
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7633
7632
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7634
7633
|
* and
|
|
@@ -7667,7 +7666,7 @@
|
|
|
7667
7666
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7668
7667
|
* can be passed as-is and a
|
|
7669
7668
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7670
|
-
* allows
|
|
7669
|
+
* allows querying by
|
|
7671
7670
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7672
7671
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7673
7672
|
* and
|
|
@@ -7699,7 +7698,7 @@
|
|
|
7699
7698
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7700
7699
|
* can be passed as-is and a
|
|
7701
7700
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7702
|
-
* allows
|
|
7701
|
+
* allows querying by
|
|
7703
7702
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7704
7703
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7705
7704
|
* and
|
|
@@ -7737,7 +7736,7 @@
|
|
|
7737
7736
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7738
7737
|
* can be passed as-is and a
|
|
7739
7738
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7740
|
-
* allows
|
|
7739
|
+
* allows querying by
|
|
7741
7740
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7742
7741
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7743
7742
|
* and
|
|
@@ -7789,7 +7788,7 @@
|
|
|
7789
7788
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7790
7789
|
* can be passed as-is and a
|
|
7791
7790
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7792
|
-
* allows
|
|
7791
|
+
* allows querying by
|
|
7793
7792
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7794
7793
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7795
7794
|
* and
|
|
@@ -8407,7 +8406,7 @@
|
|
|
8407
8406
|
}
|
|
8408
8407
|
};
|
|
8409
8408
|
|
|
8410
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/
|
|
8409
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js
|
|
8411
8410
|
init_dirname();
|
|
8412
8411
|
init_buffer2();
|
|
8413
8412
|
|
|
@@ -8533,7 +8532,7 @@
|
|
|
8533
8532
|
}
|
|
8534
8533
|
};
|
|
8535
8534
|
|
|
8536
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/
|
|
8535
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js
|
|
8537
8536
|
var CdpCDPSession = class extends CDPSession {
|
|
8538
8537
|
#sessionId;
|
|
8539
8538
|
#targetType;
|
|
@@ -8542,6 +8541,7 @@
|
|
|
8542
8541
|
#parentSessionId;
|
|
8543
8542
|
#target;
|
|
8544
8543
|
#rawErrors = false;
|
|
8544
|
+
#detached = false;
|
|
8545
8545
|
/**
|
|
8546
8546
|
* @internal
|
|
8547
8547
|
*/
|
|
@@ -8558,7 +8558,7 @@
|
|
|
8558
8558
|
*
|
|
8559
8559
|
* @internal
|
|
8560
8560
|
*/
|
|
8561
|
-
|
|
8561
|
+
setTarget(target) {
|
|
8562
8562
|
this.#target = target;
|
|
8563
8563
|
}
|
|
8564
8564
|
/**
|
|
@@ -8566,13 +8566,16 @@
|
|
|
8566
8566
|
*
|
|
8567
8567
|
* @internal
|
|
8568
8568
|
*/
|
|
8569
|
-
|
|
8569
|
+
target() {
|
|
8570
8570
|
assert(this.#target, "Target must exist");
|
|
8571
8571
|
return this.#target;
|
|
8572
8572
|
}
|
|
8573
8573
|
connection() {
|
|
8574
8574
|
return this.#connection;
|
|
8575
8575
|
}
|
|
8576
|
+
get #closed() {
|
|
8577
|
+
return this.#connection._closed || this.#detached;
|
|
8578
|
+
}
|
|
8576
8579
|
parentSession() {
|
|
8577
8580
|
if (!this.#parentSessionId) {
|
|
8578
8581
|
return this;
|
|
@@ -8581,7 +8584,7 @@
|
|
|
8581
8584
|
return parent ?? void 0;
|
|
8582
8585
|
}
|
|
8583
8586
|
send(method, params, options) {
|
|
8584
|
-
if (
|
|
8587
|
+
if (this.#closed) {
|
|
8585
8588
|
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
8586
8589
|
}
|
|
8587
8590
|
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
@@ -8589,7 +8592,7 @@
|
|
|
8589
8592
|
/**
|
|
8590
8593
|
* @internal
|
|
8591
8594
|
*/
|
|
8592
|
-
|
|
8595
|
+
onMessage(object) {
|
|
8593
8596
|
if (object.id) {
|
|
8594
8597
|
if (object.error) {
|
|
8595
8598
|
if (this.#rawErrors) {
|
|
@@ -8610,19 +8613,20 @@
|
|
|
8610
8613
|
* won't emit any events and can't be used to send messages.
|
|
8611
8614
|
*/
|
|
8612
8615
|
async detach() {
|
|
8613
|
-
if (
|
|
8616
|
+
if (this.#closed) {
|
|
8614
8617
|
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
8615
8618
|
}
|
|
8616
8619
|
await this.#connection.send("Target.detachFromTarget", {
|
|
8617
8620
|
sessionId: this.#sessionId
|
|
8618
8621
|
});
|
|
8622
|
+
this.#detached = true;
|
|
8619
8623
|
}
|
|
8620
8624
|
/**
|
|
8621
8625
|
* @internal
|
|
8622
8626
|
*/
|
|
8623
|
-
|
|
8627
|
+
onClosed() {
|
|
8624
8628
|
this.#callbacks.clear();
|
|
8625
|
-
this.#
|
|
8629
|
+
this.#detached = true;
|
|
8626
8630
|
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
8627
8631
|
}
|
|
8628
8632
|
/**
|
|
@@ -8749,7 +8753,7 @@
|
|
|
8749
8753
|
} else if (object.method === "Target.detachedFromTarget") {
|
|
8750
8754
|
const session = this.#sessions.get(object.params.sessionId);
|
|
8751
8755
|
if (session) {
|
|
8752
|
-
session.
|
|
8756
|
+
session.onClosed();
|
|
8753
8757
|
this.#sessions.delete(object.params.sessionId);
|
|
8754
8758
|
this.emit(CDPSessionEvent.SessionDetached, session);
|
|
8755
8759
|
const parentSession = this.#sessions.get(object.sessionId);
|
|
@@ -8761,7 +8765,7 @@
|
|
|
8761
8765
|
if (object.sessionId) {
|
|
8762
8766
|
const session = this.#sessions.get(object.sessionId);
|
|
8763
8767
|
if (session) {
|
|
8764
|
-
session.
|
|
8768
|
+
session.onMessage(object);
|
|
8765
8769
|
}
|
|
8766
8770
|
} else if (object.id) {
|
|
8767
8771
|
if (object.error) {
|
|
@@ -8786,7 +8790,7 @@
|
|
|
8786
8790
|
this.#transport.onclose = void 0;
|
|
8787
8791
|
this.#callbacks.clear();
|
|
8788
8792
|
for (const session of this.#sessions.values()) {
|
|
8789
|
-
session.
|
|
8793
|
+
session.onClosed();
|
|
8790
8794
|
}
|
|
8791
8795
|
this.#sessions.clear();
|
|
8792
8796
|
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
@@ -10965,7 +10969,7 @@
|
|
|
10965
10969
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
10966
10970
|
* can be passed as-is and a
|
|
10967
10971
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
10968
|
-
* allows
|
|
10972
|
+
* allows querying by
|
|
10969
10973
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
10970
10974
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
10971
10975
|
* and
|
|
@@ -10991,7 +10995,7 @@
|
|
|
10991
10995
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
10992
10996
|
* can be passed as-is and a
|
|
10993
10997
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
10994
|
-
* allows
|
|
10998
|
+
* allows querying by
|
|
10995
10999
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
10996
11000
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
10997
11001
|
* and
|
|
@@ -11027,7 +11031,7 @@
|
|
|
11027
11031
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
11028
11032
|
* can be passed as-is and a
|
|
11029
11033
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
11030
|
-
* allows
|
|
11034
|
+
* allows querying by
|
|
11031
11035
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
11032
11036
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
11033
11037
|
* and
|
|
@@ -11066,7 +11070,7 @@
|
|
|
11066
11070
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
11067
11071
|
* can be passed as-is and a
|
|
11068
11072
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
11069
|
-
* allows
|
|
11073
|
+
* allows querying by
|
|
11070
11074
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
11071
11075
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
11072
11076
|
* and
|
|
@@ -11624,7 +11628,7 @@
|
|
|
11624
11628
|
var DeviceRequestPromptManager = class {
|
|
11625
11629
|
#client;
|
|
11626
11630
|
#timeoutSettings;
|
|
11627
|
-
#
|
|
11631
|
+
#deviceRequestPromptDeferreds = /* @__PURE__ */ new Set();
|
|
11628
11632
|
/**
|
|
11629
11633
|
* @internal
|
|
11630
11634
|
*/
|
|
@@ -11644,7 +11648,7 @@
|
|
|
11644
11648
|
*/
|
|
11645
11649
|
async waitForDevicePrompt(options = {}) {
|
|
11646
11650
|
assert(this.#client !== null, "Cannot wait for device prompt through detached session!");
|
|
11647
|
-
const needsEnable = this.#
|
|
11651
|
+
const needsEnable = this.#deviceRequestPromptDeferreds.size === 0;
|
|
11648
11652
|
let enablePromise;
|
|
11649
11653
|
if (needsEnable) {
|
|
11650
11654
|
enablePromise = this.#client.send("DeviceAccess.enable");
|
|
@@ -11659,7 +11663,7 @@
|
|
|
11659
11663
|
deferred.reject(options.signal?.reason);
|
|
11660
11664
|
}, { once: true });
|
|
11661
11665
|
}
|
|
11662
|
-
this.#
|
|
11666
|
+
this.#deviceRequestPromptDeferreds.add(deferred);
|
|
11663
11667
|
try {
|
|
11664
11668
|
const [result] = await Promise.all([
|
|
11665
11669
|
deferred.valueOrThrow(),
|
|
@@ -11667,22 +11671,22 @@
|
|
|
11667
11671
|
]);
|
|
11668
11672
|
return result;
|
|
11669
11673
|
} finally {
|
|
11670
|
-
this.#
|
|
11674
|
+
this.#deviceRequestPromptDeferreds.delete(deferred);
|
|
11671
11675
|
}
|
|
11672
11676
|
}
|
|
11673
11677
|
/**
|
|
11674
11678
|
* @internal
|
|
11675
11679
|
*/
|
|
11676
11680
|
#onDeviceRequestPrompted(event) {
|
|
11677
|
-
if (!this.#
|
|
11681
|
+
if (!this.#deviceRequestPromptDeferreds.size) {
|
|
11678
11682
|
return;
|
|
11679
11683
|
}
|
|
11680
11684
|
assert(this.#client !== null);
|
|
11681
11685
|
const devicePrompt = new DeviceRequestPrompt(this.#client, this.#timeoutSettings, event);
|
|
11682
|
-
for (const promise of this.#
|
|
11686
|
+
for (const promise of this.#deviceRequestPromptDeferreds) {
|
|
11683
11687
|
promise.resolve(devicePrompt);
|
|
11684
11688
|
}
|
|
11685
|
-
this.#
|
|
11689
|
+
this.#deviceRequestPromptDeferreds.clear();
|
|
11686
11690
|
}
|
|
11687
11691
|
};
|
|
11688
11692
|
|
|
@@ -12032,7 +12036,7 @@
|
|
|
12032
12036
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12033
12037
|
* can be passed as-is and a
|
|
12034
12038
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12035
|
-
* allows
|
|
12039
|
+
* allows querying by
|
|
12036
12040
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12037
12041
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12038
12042
|
* and
|
|
@@ -12057,7 +12061,7 @@
|
|
|
12057
12061
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12058
12062
|
* can be passed as-is and a
|
|
12059
12063
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12060
|
-
* allows
|
|
12064
|
+
* allows querying by
|
|
12061
12065
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12062
12066
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12063
12067
|
* and
|
|
@@ -12117,7 +12121,7 @@
|
|
|
12117
12121
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12118
12122
|
* can be passed as-is and a
|
|
12119
12123
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12120
|
-
* allows
|
|
12124
|
+
* allows querying by
|
|
12121
12125
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12122
12126
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12123
12127
|
* and
|
|
@@ -12180,7 +12184,7 @@
|
|
|
12180
12184
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12181
12185
|
* can be passed as-is and a
|
|
12182
12186
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12183
|
-
* allows
|
|
12187
|
+
* allows querying by
|
|
12184
12188
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12185
12189
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12186
12190
|
* and
|
|
@@ -15555,7 +15559,7 @@ ${sourceUrlComment}
|
|
|
15555
15559
|
failed: "Failed"
|
|
15556
15560
|
};
|
|
15557
15561
|
function handleError(error) {
|
|
15558
|
-
if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
|
|
15562
|
+
if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes("Unsafe header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
|
|
15559
15563
|
error.originalMessage.includes("invalid argument")) {
|
|
15560
15564
|
throw error;
|
|
15561
15565
|
}
|
|
@@ -16556,6 +16560,10 @@ ${sourceUrlComment}
|
|
|
16556
16560
|
if (!mainFrame) {
|
|
16557
16561
|
return;
|
|
16558
16562
|
}
|
|
16563
|
+
if (this.client.connection()?._closed) {
|
|
16564
|
+
this.#removeFramesRecursively(mainFrame);
|
|
16565
|
+
return;
|
|
16566
|
+
}
|
|
16559
16567
|
for (const child of mainFrame.childFrames()) {
|
|
16560
16568
|
this.#removeFramesRecursively(child);
|
|
16561
16569
|
}
|
|
@@ -16582,9 +16590,9 @@ ${sourceUrlComment}
|
|
|
16582
16590
|
assert(this.#client instanceof CdpCDPSession, "CDPSession is not an instance of CDPSessionImpl.");
|
|
16583
16591
|
const frame = this._frameTree.getMainFrame();
|
|
16584
16592
|
if (frame) {
|
|
16585
|
-
this.#frameNavigatedReceived.add(this.#client.
|
|
16593
|
+
this.#frameNavigatedReceived.add(this.#client.target()._targetId);
|
|
16586
16594
|
this._frameTree.removeFrame(frame);
|
|
16587
|
-
frame.updateId(this.#client.
|
|
16595
|
+
frame.updateId(this.#client.target()._targetId);
|
|
16588
16596
|
this._frameTree.addFrame(frame);
|
|
16589
16597
|
frame.updateClient(client);
|
|
16590
16598
|
}
|
|
@@ -18210,7 +18218,7 @@ ${sourceUrlComment}
|
|
|
18210
18218
|
this.#primaryTargetClient = client;
|
|
18211
18219
|
this.#tabTargetClient = client.parentSession();
|
|
18212
18220
|
assert(this.#tabTargetClient, "Tab target session is not defined.");
|
|
18213
|
-
this.#tabTarget = this.#tabTargetClient.
|
|
18221
|
+
this.#tabTarget = this.#tabTargetClient.target();
|
|
18214
18222
|
assert(this.#tabTarget, "Tab target is not defined.");
|
|
18215
18223
|
this.#primaryTarget = target;
|
|
18216
18224
|
this.#targetManager = target._targetManager();
|
|
@@ -18286,7 +18294,7 @@ ${sourceUrlComment}
|
|
|
18286
18294
|
async #onActivation(newSession) {
|
|
18287
18295
|
this.#primaryTargetClient = newSession;
|
|
18288
18296
|
assert(this.#primaryTargetClient instanceof CdpCDPSession, "CDPSession is not instance of CDPSessionImpl");
|
|
18289
|
-
this.#primaryTarget = this.#primaryTargetClient.
|
|
18297
|
+
this.#primaryTarget = this.#primaryTargetClient.target();
|
|
18290
18298
|
assert(this.#primaryTarget, "Missing target on swap");
|
|
18291
18299
|
this.#keyboard.updateClient(newSession);
|
|
18292
18300
|
this.#mouse.updateClient(newSession);
|
|
@@ -18299,7 +18307,7 @@ ${sourceUrlComment}
|
|
|
18299
18307
|
}
|
|
18300
18308
|
async #onSecondaryTarget(session) {
|
|
18301
18309
|
assert(session instanceof CdpCDPSession);
|
|
18302
|
-
if (session.
|
|
18310
|
+
if (session.target()._subtype() !== "prerender") {
|
|
18303
18311
|
return;
|
|
18304
18312
|
}
|
|
18305
18313
|
this.#frameManager.registerSpeculativeSession(session).catch(debugError);
|
|
@@ -18339,9 +18347,9 @@ ${sourceUrlComment}
|
|
|
18339
18347
|
};
|
|
18340
18348
|
#onAttachedToTarget = (session) => {
|
|
18341
18349
|
assert(session instanceof CdpCDPSession);
|
|
18342
|
-
this.#frameManager.onAttachedToTarget(session.
|
|
18343
|
-
if (session.
|
|
18344
|
-
const worker = new CdpWebWorker(session, session.
|
|
18350
|
+
this.#frameManager.onAttachedToTarget(session.target());
|
|
18351
|
+
if (session.target()._getTargetInfo().type === "worker") {
|
|
18352
|
+
const worker = new CdpWebWorker(session, session.target().url(), session.target()._targetId, session.target().type(), this.#addConsoleMessage.bind(this), this.#handleException.bind(this));
|
|
18345
18353
|
this.#workers.set(session.id(), worker);
|
|
18346
18354
|
this.emit("workercreated", worker);
|
|
18347
18355
|
}
|
|
@@ -19152,7 +19160,7 @@ ${sourceUrlComment}
|
|
|
19152
19160
|
this._targetId = targetInfo.targetId;
|
|
19153
19161
|
this.#sessionFactory = sessionFactory;
|
|
19154
19162
|
if (this.#session && this.#session instanceof CdpCDPSession) {
|
|
19155
|
-
this.#session.
|
|
19163
|
+
this.#session.setTarget(this);
|
|
19156
19164
|
}
|
|
19157
19165
|
}
|
|
19158
19166
|
async asPage() {
|
|
@@ -19190,7 +19198,7 @@ ${sourceUrlComment}
|
|
|
19190
19198
|
throw new Error("sessionFactory is not initialized");
|
|
19191
19199
|
}
|
|
19192
19200
|
return this.#sessionFactory(false).then((session) => {
|
|
19193
|
-
session.
|
|
19201
|
+
session.setTarget(this);
|
|
19194
19202
|
return session;
|
|
19195
19203
|
});
|
|
19196
19204
|
}
|
|
@@ -19561,14 +19569,14 @@ ${sourceUrlComment}
|
|
|
19561
19569
|
}
|
|
19562
19570
|
this.#setupAttachmentListeners(session);
|
|
19563
19571
|
if (isExistingTarget) {
|
|
19564
|
-
session.
|
|
19572
|
+
session.setTarget(target);
|
|
19565
19573
|
this.#attachedTargetsBySessionId.set(session.id(), this.#attachedTargetsByTargetId.get(targetInfo.targetId));
|
|
19566
19574
|
} else {
|
|
19567
19575
|
target._initialize();
|
|
19568
19576
|
this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
|
|
19569
19577
|
this.#attachedTargetsBySessionId.set(session.id(), target);
|
|
19570
19578
|
}
|
|
19571
|
-
const parentTarget = parentSession instanceof CDPSession ? parentSession.
|
|
19579
|
+
const parentTarget = parentSession instanceof CDPSession ? parentSession.target() : null;
|
|
19572
19580
|
parentTarget?._addChildTarget(target);
|
|
19573
19581
|
parentSession.emit(CDPSessionEvent.Ready, session);
|
|
19574
19582
|
this.#targetsIdsForInit.delete(target._targetId);
|
|
@@ -19601,7 +19609,7 @@ ${sourceUrlComment}
|
|
|
19601
19609
|
return;
|
|
19602
19610
|
}
|
|
19603
19611
|
if (parentSession instanceof CDPSession) {
|
|
19604
|
-
parentSession.
|
|
19612
|
+
parentSession.target()._removeChildTarget(target);
|
|
19605
19613
|
}
|
|
19606
19614
|
this.#attachedTargetsByTargetId.delete(target._targetId);
|
|
19607
19615
|
this.emit("targetGone", target);
|
|
@@ -20077,7 +20085,7 @@ puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:
|
|
|
20077
20085
|
* SPDX-License-Identifier: Apache-2.0
|
|
20078
20086
|
*)
|
|
20079
20087
|
|
|
20080
|
-
puppeteer-core/lib/esm/puppeteer/cdp/
|
|
20088
|
+
puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js:
|
|
20081
20089
|
(**
|
|
20082
20090
|
* @license
|
|
20083
20091
|
* Copyright 2017 Google Inc.
|