@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
|
@@ -4393,7 +4393,7 @@
|
|
|
4393
4393
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4394
4394
|
init_dirname();
|
|
4395
4395
|
init_buffer2();
|
|
4396
|
-
var packageVersion = "24.
|
|
4396
|
+
var packageVersion = "24.2.1";
|
|
4397
4397
|
|
|
4398
4398
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4399
4399
|
init_dirname();
|
|
@@ -5209,25 +5209,24 @@
|
|
|
5209
5209
|
|
|
5210
5210
|
// node_modules/puppeteer-core/lib/esm/puppeteer/api/Browser.js
|
|
5211
5211
|
var WEB_PERMISSION_TO_PROTOCOL_PERMISSION = /* @__PURE__ */ new Map([
|
|
5212
|
-
["geolocation", "geolocation"],
|
|
5213
|
-
["midi", "midi"],
|
|
5214
|
-
["notifications", "notifications"],
|
|
5215
|
-
// TODO: push isn't a valid type?
|
|
5216
|
-
// ['push', 'push'],
|
|
5217
|
-
["camera", "videoCapture"],
|
|
5218
|
-
["microphone", "audioCapture"],
|
|
5219
|
-
["background-sync", "backgroundSync"],
|
|
5220
|
-
["ambient-light-sensor", "sensors"],
|
|
5221
5212
|
["accelerometer", "sensors"],
|
|
5222
|
-
["
|
|
5223
|
-
["
|
|
5224
|
-
["
|
|
5213
|
+
["ambient-light-sensor", "sensors"],
|
|
5214
|
+
["background-sync", "backgroundSync"],
|
|
5215
|
+
["camera", "videoCapture"],
|
|
5225
5216
|
["clipboard-read", "clipboardReadWrite"],
|
|
5226
|
-
["clipboard-write", "clipboardReadWrite"],
|
|
5227
5217
|
["clipboard-sanitized-write", "clipboardSanitizedWrite"],
|
|
5218
|
+
["clipboard-write", "clipboardReadWrite"],
|
|
5219
|
+
["geolocation", "geolocation"],
|
|
5220
|
+
["gyroscope", "sensors"],
|
|
5221
|
+
["idle-detection", "idleDetection"],
|
|
5222
|
+
["keyboard-lock", "keyboardLock"],
|
|
5223
|
+
["magnetometer", "sensors"],
|
|
5224
|
+
["microphone", "audioCapture"],
|
|
5225
|
+
["midi", "midi"],
|
|
5226
|
+
["notifications", "notifications"],
|
|
5228
5227
|
["payment-handler", "paymentHandler"],
|
|
5229
5228
|
["persistent-storage", "durableStorage"],
|
|
5230
|
-
["
|
|
5229
|
+
["pointer-lock", "pointerLock"],
|
|
5231
5230
|
// chrome-specific permissions we have.
|
|
5232
5231
|
["midi-sysex", "midiSysex"]
|
|
5233
5232
|
]);
|
|
@@ -6703,7 +6702,7 @@
|
|
|
6703
6702
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6704
6703
|
* can be passed as-is and a
|
|
6705
6704
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6706
|
-
* allows
|
|
6705
|
+
* allows querying by
|
|
6707
6706
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6708
6707
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6709
6708
|
* and
|
|
@@ -6730,7 +6729,7 @@
|
|
|
6730
6729
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6731
6730
|
* can be passed as-is and a
|
|
6732
6731
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6733
|
-
* allows
|
|
6732
|
+
* allows querying by
|
|
6734
6733
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6735
6734
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6736
6735
|
* and
|
|
@@ -6864,7 +6863,7 @@
|
|
|
6864
6863
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6865
6864
|
* can be passed as-is and a
|
|
6866
6865
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6867
|
-
* allows
|
|
6866
|
+
* allows querying by
|
|
6868
6867
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6869
6868
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6870
6869
|
* and
|
|
@@ -6937,7 +6936,7 @@
|
|
|
6937
6936
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
6938
6937
|
* can be passed as-is and a
|
|
6939
6938
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
6940
|
-
* allows
|
|
6939
|
+
* allows querying by
|
|
6941
6940
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
6942
6941
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
6943
6942
|
* and
|
|
@@ -7559,7 +7558,7 @@
|
|
|
7559
7558
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7560
7559
|
* can be passed as-is and a
|
|
7561
7560
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7562
|
-
* allows
|
|
7561
|
+
* allows querying by
|
|
7563
7562
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7564
7563
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7565
7564
|
* and
|
|
@@ -7586,7 +7585,7 @@
|
|
|
7586
7585
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7587
7586
|
* can be passed as-is and a
|
|
7588
7587
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7589
|
-
* allows
|
|
7588
|
+
* allows querying by
|
|
7590
7589
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7591
7590
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7592
7591
|
* and
|
|
@@ -7620,7 +7619,7 @@
|
|
|
7620
7619
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7621
7620
|
* can be passed as-is and a
|
|
7622
7621
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7623
|
-
* allows
|
|
7622
|
+
* allows querying by
|
|
7624
7623
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7625
7624
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7626
7625
|
* and
|
|
@@ -7659,7 +7658,7 @@
|
|
|
7659
7658
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7660
7659
|
* can be passed as-is and a
|
|
7661
7660
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7662
|
-
* allows
|
|
7661
|
+
* allows querying by
|
|
7663
7662
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7664
7663
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7665
7664
|
* and
|
|
@@ -7691,7 +7690,7 @@
|
|
|
7691
7690
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7692
7691
|
* can be passed as-is and a
|
|
7693
7692
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7694
|
-
* allows
|
|
7693
|
+
* allows querying by
|
|
7695
7694
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7696
7695
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7697
7696
|
* and
|
|
@@ -7729,7 +7728,7 @@
|
|
|
7729
7728
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7730
7729
|
* can be passed as-is and a
|
|
7731
7730
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7732
|
-
* allows
|
|
7731
|
+
* allows querying by
|
|
7733
7732
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7734
7733
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7735
7734
|
* and
|
|
@@ -7781,7 +7780,7 @@
|
|
|
7781
7780
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
7782
7781
|
* can be passed as-is and a
|
|
7783
7782
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
7784
|
-
* allows
|
|
7783
|
+
* allows querying by
|
|
7785
7784
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
7786
7785
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
7787
7786
|
* and
|
|
@@ -8399,7 +8398,7 @@
|
|
|
8399
8398
|
}
|
|
8400
8399
|
};
|
|
8401
8400
|
|
|
8402
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/
|
|
8401
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js
|
|
8403
8402
|
init_dirname();
|
|
8404
8403
|
init_buffer2();
|
|
8405
8404
|
|
|
@@ -8525,7 +8524,7 @@
|
|
|
8525
8524
|
}
|
|
8526
8525
|
};
|
|
8527
8526
|
|
|
8528
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/
|
|
8527
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js
|
|
8529
8528
|
var CdpCDPSession = class extends CDPSession {
|
|
8530
8529
|
#sessionId;
|
|
8531
8530
|
#targetType;
|
|
@@ -8534,6 +8533,7 @@
|
|
|
8534
8533
|
#parentSessionId;
|
|
8535
8534
|
#target;
|
|
8536
8535
|
#rawErrors = false;
|
|
8536
|
+
#detached = false;
|
|
8537
8537
|
/**
|
|
8538
8538
|
* @internal
|
|
8539
8539
|
*/
|
|
@@ -8550,7 +8550,7 @@
|
|
|
8550
8550
|
*
|
|
8551
8551
|
* @internal
|
|
8552
8552
|
*/
|
|
8553
|
-
|
|
8553
|
+
setTarget(target) {
|
|
8554
8554
|
this.#target = target;
|
|
8555
8555
|
}
|
|
8556
8556
|
/**
|
|
@@ -8558,13 +8558,16 @@
|
|
|
8558
8558
|
*
|
|
8559
8559
|
* @internal
|
|
8560
8560
|
*/
|
|
8561
|
-
|
|
8561
|
+
target() {
|
|
8562
8562
|
assert(this.#target, "Target must exist");
|
|
8563
8563
|
return this.#target;
|
|
8564
8564
|
}
|
|
8565
8565
|
connection() {
|
|
8566
8566
|
return this.#connection;
|
|
8567
8567
|
}
|
|
8568
|
+
get #closed() {
|
|
8569
|
+
return this.#connection._closed || this.#detached;
|
|
8570
|
+
}
|
|
8568
8571
|
parentSession() {
|
|
8569
8572
|
if (!this.#parentSessionId) {
|
|
8570
8573
|
return this;
|
|
@@ -8573,7 +8576,7 @@
|
|
|
8573
8576
|
return parent ?? void 0;
|
|
8574
8577
|
}
|
|
8575
8578
|
send(method, params, options) {
|
|
8576
|
-
if (
|
|
8579
|
+
if (this.#closed) {
|
|
8577
8580
|
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
8578
8581
|
}
|
|
8579
8582
|
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
@@ -8581,7 +8584,7 @@
|
|
|
8581
8584
|
/**
|
|
8582
8585
|
* @internal
|
|
8583
8586
|
*/
|
|
8584
|
-
|
|
8587
|
+
onMessage(object) {
|
|
8585
8588
|
if (object.id) {
|
|
8586
8589
|
if (object.error) {
|
|
8587
8590
|
if (this.#rawErrors) {
|
|
@@ -8602,19 +8605,20 @@
|
|
|
8602
8605
|
* won't emit any events and can't be used to send messages.
|
|
8603
8606
|
*/
|
|
8604
8607
|
async detach() {
|
|
8605
|
-
if (
|
|
8608
|
+
if (this.#closed) {
|
|
8606
8609
|
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
8607
8610
|
}
|
|
8608
8611
|
await this.#connection.send("Target.detachFromTarget", {
|
|
8609
8612
|
sessionId: this.#sessionId
|
|
8610
8613
|
});
|
|
8614
|
+
this.#detached = true;
|
|
8611
8615
|
}
|
|
8612
8616
|
/**
|
|
8613
8617
|
* @internal
|
|
8614
8618
|
*/
|
|
8615
|
-
|
|
8619
|
+
onClosed() {
|
|
8616
8620
|
this.#callbacks.clear();
|
|
8617
|
-
this.#
|
|
8621
|
+
this.#detached = true;
|
|
8618
8622
|
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
8619
8623
|
}
|
|
8620
8624
|
/**
|
|
@@ -8741,7 +8745,7 @@
|
|
|
8741
8745
|
} else if (object.method === "Target.detachedFromTarget") {
|
|
8742
8746
|
const session = this.#sessions.get(object.params.sessionId);
|
|
8743
8747
|
if (session) {
|
|
8744
|
-
session.
|
|
8748
|
+
session.onClosed();
|
|
8745
8749
|
this.#sessions.delete(object.params.sessionId);
|
|
8746
8750
|
this.emit(CDPSessionEvent.SessionDetached, session);
|
|
8747
8751
|
const parentSession = this.#sessions.get(object.sessionId);
|
|
@@ -8753,7 +8757,7 @@
|
|
|
8753
8757
|
if (object.sessionId) {
|
|
8754
8758
|
const session = this.#sessions.get(object.sessionId);
|
|
8755
8759
|
if (session) {
|
|
8756
|
-
session.
|
|
8760
|
+
session.onMessage(object);
|
|
8757
8761
|
}
|
|
8758
8762
|
} else if (object.id) {
|
|
8759
8763
|
if (object.error) {
|
|
@@ -8778,7 +8782,7 @@
|
|
|
8778
8782
|
this.#transport.onclose = void 0;
|
|
8779
8783
|
this.#callbacks.clear();
|
|
8780
8784
|
for (const session of this.#sessions.values()) {
|
|
8781
|
-
session.
|
|
8785
|
+
session.onClosed();
|
|
8782
8786
|
}
|
|
8783
8787
|
this.#sessions.clear();
|
|
8784
8788
|
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
@@ -10957,7 +10961,7 @@
|
|
|
10957
10961
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
10958
10962
|
* can be passed as-is and a
|
|
10959
10963
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
10960
|
-
* allows
|
|
10964
|
+
* allows querying by
|
|
10961
10965
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
10962
10966
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
10963
10967
|
* and
|
|
@@ -10983,7 +10987,7 @@
|
|
|
10983
10987
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
10984
10988
|
* can be passed as-is and a
|
|
10985
10989
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
10986
|
-
* allows
|
|
10990
|
+
* allows querying by
|
|
10987
10991
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
10988
10992
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
10989
10993
|
* and
|
|
@@ -11019,7 +11023,7 @@
|
|
|
11019
11023
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
11020
11024
|
* can be passed as-is and a
|
|
11021
11025
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
11022
|
-
* allows
|
|
11026
|
+
* allows querying by
|
|
11023
11027
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
11024
11028
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
11025
11029
|
* and
|
|
@@ -11058,7 +11062,7 @@
|
|
|
11058
11062
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
11059
11063
|
* can be passed as-is and a
|
|
11060
11064
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
11061
|
-
* allows
|
|
11065
|
+
* allows querying by
|
|
11062
11066
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
11063
11067
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
11064
11068
|
* and
|
|
@@ -11616,7 +11620,7 @@
|
|
|
11616
11620
|
var DeviceRequestPromptManager = class {
|
|
11617
11621
|
#client;
|
|
11618
11622
|
#timeoutSettings;
|
|
11619
|
-
#
|
|
11623
|
+
#deviceRequestPromptDeferreds = /* @__PURE__ */ new Set();
|
|
11620
11624
|
/**
|
|
11621
11625
|
* @internal
|
|
11622
11626
|
*/
|
|
@@ -11636,7 +11640,7 @@
|
|
|
11636
11640
|
*/
|
|
11637
11641
|
async waitForDevicePrompt(options = {}) {
|
|
11638
11642
|
assert(this.#client !== null, "Cannot wait for device prompt through detached session!");
|
|
11639
|
-
const needsEnable = this.#
|
|
11643
|
+
const needsEnable = this.#deviceRequestPromptDeferreds.size === 0;
|
|
11640
11644
|
let enablePromise;
|
|
11641
11645
|
if (needsEnable) {
|
|
11642
11646
|
enablePromise = this.#client.send("DeviceAccess.enable");
|
|
@@ -11651,7 +11655,7 @@
|
|
|
11651
11655
|
deferred.reject(options.signal?.reason);
|
|
11652
11656
|
}, { once: true });
|
|
11653
11657
|
}
|
|
11654
|
-
this.#
|
|
11658
|
+
this.#deviceRequestPromptDeferreds.add(deferred);
|
|
11655
11659
|
try {
|
|
11656
11660
|
const [result] = await Promise.all([
|
|
11657
11661
|
deferred.valueOrThrow(),
|
|
@@ -11659,22 +11663,22 @@
|
|
|
11659
11663
|
]);
|
|
11660
11664
|
return result;
|
|
11661
11665
|
} finally {
|
|
11662
|
-
this.#
|
|
11666
|
+
this.#deviceRequestPromptDeferreds.delete(deferred);
|
|
11663
11667
|
}
|
|
11664
11668
|
}
|
|
11665
11669
|
/**
|
|
11666
11670
|
* @internal
|
|
11667
11671
|
*/
|
|
11668
11672
|
#onDeviceRequestPrompted(event) {
|
|
11669
|
-
if (!this.#
|
|
11673
|
+
if (!this.#deviceRequestPromptDeferreds.size) {
|
|
11670
11674
|
return;
|
|
11671
11675
|
}
|
|
11672
11676
|
assert(this.#client !== null);
|
|
11673
11677
|
const devicePrompt = new DeviceRequestPrompt(this.#client, this.#timeoutSettings, event);
|
|
11674
|
-
for (const promise of this.#
|
|
11678
|
+
for (const promise of this.#deviceRequestPromptDeferreds) {
|
|
11675
11679
|
promise.resolve(devicePrompt);
|
|
11676
11680
|
}
|
|
11677
|
-
this.#
|
|
11681
|
+
this.#deviceRequestPromptDeferreds.clear();
|
|
11678
11682
|
}
|
|
11679
11683
|
};
|
|
11680
11684
|
|
|
@@ -12024,7 +12028,7 @@
|
|
|
12024
12028
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12025
12029
|
* can be passed as-is and a
|
|
12026
12030
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12027
|
-
* allows
|
|
12031
|
+
* allows querying by
|
|
12028
12032
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12029
12033
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12030
12034
|
* and
|
|
@@ -12049,7 +12053,7 @@
|
|
|
12049
12053
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12050
12054
|
* can be passed as-is and a
|
|
12051
12055
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12052
|
-
* allows
|
|
12056
|
+
* allows querying by
|
|
12053
12057
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12054
12058
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12055
12059
|
* and
|
|
@@ -12109,7 +12113,7 @@
|
|
|
12109
12113
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12110
12114
|
* can be passed as-is and a
|
|
12111
12115
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12112
|
-
* allows
|
|
12116
|
+
* allows querying by
|
|
12113
12117
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12114
12118
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12115
12119
|
* and
|
|
@@ -12172,7 +12176,7 @@
|
|
|
12172
12176
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
|
|
12173
12177
|
* can be passed as-is and a
|
|
12174
12178
|
* {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
|
|
12175
|
-
* allows
|
|
12179
|
+
* allows querying by
|
|
12176
12180
|
* {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
|
|
12177
12181
|
* {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
|
|
12178
12182
|
* and
|
|
@@ -15547,7 +15551,7 @@ ${sourceUrlComment}
|
|
|
15547
15551
|
failed: "Failed"
|
|
15548
15552
|
};
|
|
15549
15553
|
function handleError(error) {
|
|
15550
|
-
if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
|
|
15554
|
+
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.
|
|
15551
15555
|
error.originalMessage.includes("invalid argument")) {
|
|
15552
15556
|
throw error;
|
|
15553
15557
|
}
|
|
@@ -16548,6 +16552,10 @@ ${sourceUrlComment}
|
|
|
16548
16552
|
if (!mainFrame) {
|
|
16549
16553
|
return;
|
|
16550
16554
|
}
|
|
16555
|
+
if (this.client.connection()?._closed) {
|
|
16556
|
+
this.#removeFramesRecursively(mainFrame);
|
|
16557
|
+
return;
|
|
16558
|
+
}
|
|
16551
16559
|
for (const child of mainFrame.childFrames()) {
|
|
16552
16560
|
this.#removeFramesRecursively(child);
|
|
16553
16561
|
}
|
|
@@ -16574,9 +16582,9 @@ ${sourceUrlComment}
|
|
|
16574
16582
|
assert(this.#client instanceof CdpCDPSession, "CDPSession is not an instance of CDPSessionImpl.");
|
|
16575
16583
|
const frame = this._frameTree.getMainFrame();
|
|
16576
16584
|
if (frame) {
|
|
16577
|
-
this.#frameNavigatedReceived.add(this.#client.
|
|
16585
|
+
this.#frameNavigatedReceived.add(this.#client.target()._targetId);
|
|
16578
16586
|
this._frameTree.removeFrame(frame);
|
|
16579
|
-
frame.updateId(this.#client.
|
|
16587
|
+
frame.updateId(this.#client.target()._targetId);
|
|
16580
16588
|
this._frameTree.addFrame(frame);
|
|
16581
16589
|
frame.updateClient(client);
|
|
16582
16590
|
}
|
|
@@ -18202,7 +18210,7 @@ ${sourceUrlComment}
|
|
|
18202
18210
|
this.#primaryTargetClient = client;
|
|
18203
18211
|
this.#tabTargetClient = client.parentSession();
|
|
18204
18212
|
assert(this.#tabTargetClient, "Tab target session is not defined.");
|
|
18205
|
-
this.#tabTarget = this.#tabTargetClient.
|
|
18213
|
+
this.#tabTarget = this.#tabTargetClient.target();
|
|
18206
18214
|
assert(this.#tabTarget, "Tab target is not defined.");
|
|
18207
18215
|
this.#primaryTarget = target;
|
|
18208
18216
|
this.#targetManager = target._targetManager();
|
|
@@ -18278,7 +18286,7 @@ ${sourceUrlComment}
|
|
|
18278
18286
|
async #onActivation(newSession) {
|
|
18279
18287
|
this.#primaryTargetClient = newSession;
|
|
18280
18288
|
assert(this.#primaryTargetClient instanceof CdpCDPSession, "CDPSession is not instance of CDPSessionImpl");
|
|
18281
|
-
this.#primaryTarget = this.#primaryTargetClient.
|
|
18289
|
+
this.#primaryTarget = this.#primaryTargetClient.target();
|
|
18282
18290
|
assert(this.#primaryTarget, "Missing target on swap");
|
|
18283
18291
|
this.#keyboard.updateClient(newSession);
|
|
18284
18292
|
this.#mouse.updateClient(newSession);
|
|
@@ -18291,7 +18299,7 @@ ${sourceUrlComment}
|
|
|
18291
18299
|
}
|
|
18292
18300
|
async #onSecondaryTarget(session) {
|
|
18293
18301
|
assert(session instanceof CdpCDPSession);
|
|
18294
|
-
if (session.
|
|
18302
|
+
if (session.target()._subtype() !== "prerender") {
|
|
18295
18303
|
return;
|
|
18296
18304
|
}
|
|
18297
18305
|
this.#frameManager.registerSpeculativeSession(session).catch(debugError);
|
|
@@ -18331,9 +18339,9 @@ ${sourceUrlComment}
|
|
|
18331
18339
|
};
|
|
18332
18340
|
#onAttachedToTarget = (session) => {
|
|
18333
18341
|
assert(session instanceof CdpCDPSession);
|
|
18334
|
-
this.#frameManager.onAttachedToTarget(session.
|
|
18335
|
-
if (session.
|
|
18336
|
-
const worker = new CdpWebWorker(session, session.
|
|
18342
|
+
this.#frameManager.onAttachedToTarget(session.target());
|
|
18343
|
+
if (session.target()._getTargetInfo().type === "worker") {
|
|
18344
|
+
const worker = new CdpWebWorker(session, session.target().url(), session.target()._targetId, session.target().type(), this.#addConsoleMessage.bind(this), this.#handleException.bind(this));
|
|
18337
18345
|
this.#workers.set(session.id(), worker);
|
|
18338
18346
|
this.emit("workercreated", worker);
|
|
18339
18347
|
}
|
|
@@ -19144,7 +19152,7 @@ ${sourceUrlComment}
|
|
|
19144
19152
|
this._targetId = targetInfo.targetId;
|
|
19145
19153
|
this.#sessionFactory = sessionFactory;
|
|
19146
19154
|
if (this.#session && this.#session instanceof CdpCDPSession) {
|
|
19147
|
-
this.#session.
|
|
19155
|
+
this.#session.setTarget(this);
|
|
19148
19156
|
}
|
|
19149
19157
|
}
|
|
19150
19158
|
async asPage() {
|
|
@@ -19182,7 +19190,7 @@ ${sourceUrlComment}
|
|
|
19182
19190
|
throw new Error("sessionFactory is not initialized");
|
|
19183
19191
|
}
|
|
19184
19192
|
return this.#sessionFactory(false).then((session) => {
|
|
19185
|
-
session.
|
|
19193
|
+
session.setTarget(this);
|
|
19186
19194
|
return session;
|
|
19187
19195
|
});
|
|
19188
19196
|
}
|
|
@@ -19553,14 +19561,14 @@ ${sourceUrlComment}
|
|
|
19553
19561
|
}
|
|
19554
19562
|
this.#setupAttachmentListeners(session);
|
|
19555
19563
|
if (isExistingTarget) {
|
|
19556
|
-
session.
|
|
19564
|
+
session.setTarget(target);
|
|
19557
19565
|
this.#attachedTargetsBySessionId.set(session.id(), this.#attachedTargetsByTargetId.get(targetInfo.targetId));
|
|
19558
19566
|
} else {
|
|
19559
19567
|
target._initialize();
|
|
19560
19568
|
this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
|
|
19561
19569
|
this.#attachedTargetsBySessionId.set(session.id(), target);
|
|
19562
19570
|
}
|
|
19563
|
-
const parentTarget = parentSession instanceof CDPSession ? parentSession.
|
|
19571
|
+
const parentTarget = parentSession instanceof CDPSession ? parentSession.target() : null;
|
|
19564
19572
|
parentTarget?._addChildTarget(target);
|
|
19565
19573
|
parentSession.emit(CDPSessionEvent.Ready, session);
|
|
19566
19574
|
this.#targetsIdsForInit.delete(target._targetId);
|
|
@@ -19593,7 +19601,7 @@ ${sourceUrlComment}
|
|
|
19593
19601
|
return;
|
|
19594
19602
|
}
|
|
19595
19603
|
if (parentSession instanceof CDPSession) {
|
|
19596
|
-
parentSession.
|
|
19604
|
+
parentSession.target()._removeChildTarget(target);
|
|
19597
19605
|
}
|
|
19598
19606
|
this.#attachedTargetsByTargetId.delete(target._targetId);
|
|
19599
19607
|
this.emit("targetGone", target);
|
|
@@ -20069,7 +20077,7 @@ puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:
|
|
|
20069
20077
|
* SPDX-License-Identifier: Apache-2.0
|
|
20070
20078
|
*)
|
|
20071
20079
|
|
|
20072
|
-
puppeteer-core/lib/esm/puppeteer/cdp/
|
|
20080
|
+
puppeteer-core/lib/esm/puppeteer/cdp/CdpSession.js:
|
|
20073
20081
|
(**
|
|
20074
20082
|
* @license
|
|
20075
20083
|
* Copyright 2017 Google Inc.
|