browserclaw 0.2.7 → 0.2.8
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/dist/index.cjs +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1387,6 +1387,12 @@ async function pressKeyViaPlaywright(opts) {
|
|
|
1387
1387
|
ensurePageState(page);
|
|
1388
1388
|
await page.keyboard.press(key, { delay: Math.max(0, Math.floor(opts.delayMs ?? 0)) });
|
|
1389
1389
|
}
|
|
1390
|
+
var InvalidBrowserNavigationUrlError = class extends Error {
|
|
1391
|
+
constructor(message) {
|
|
1392
|
+
super(message);
|
|
1393
|
+
this.name = "InvalidBrowserNavigationUrlError";
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1390
1396
|
function assertSafeOutputPath(path2, allowedRoots) {
|
|
1391
1397
|
if (!path2 || typeof path2 !== "string") {
|
|
1392
1398
|
throw new Error("Output path is required.");
|
|
@@ -1531,7 +1537,7 @@ async function navigateViaPlaywright(opts) {
|
|
|
1531
1537
|
const url = String(opts.url ?? "").trim();
|
|
1532
1538
|
if (!url) throw new Error("url is required");
|
|
1533
1539
|
if (!opts.allowInternal && await isInternalUrlResolved(url)) {
|
|
1534
|
-
throw new
|
|
1540
|
+
throw new InvalidBrowserNavigationUrlError(`Navigation to internal/loopback address blocked: "${url}". Set allowInternal: true if this is intentional.`);
|
|
1535
1541
|
}
|
|
1536
1542
|
const page = await getPageForTargetId({ cdpUrl: opts.cdpUrl, targetId: opts.targetId });
|
|
1537
1543
|
ensurePageState(page);
|
|
@@ -1556,7 +1562,7 @@ async function listPagesViaPlaywright(opts) {
|
|
|
1556
1562
|
async function createPageViaPlaywright(opts) {
|
|
1557
1563
|
const targetUrl = (opts.url ?? "").trim() || "about:blank";
|
|
1558
1564
|
if (targetUrl !== "about:blank" && !opts.allowInternal && await isInternalUrlResolved(targetUrl)) {
|
|
1559
|
-
throw new
|
|
1565
|
+
throw new InvalidBrowserNavigationUrlError(`Navigation to internal/loopback address blocked: "${targetUrl}". Set allowInternal: true if this is intentional.`);
|
|
1560
1566
|
}
|
|
1561
1567
|
const { browser } = await connectBrowser(opts.cdpUrl);
|
|
1562
1568
|
const context = browser.contexts()[0] ?? await browser.newContext();
|
|
@@ -3074,5 +3080,6 @@ var BrowserClaw = class _BrowserClaw {
|
|
|
3074
3080
|
|
|
3075
3081
|
exports.BrowserClaw = BrowserClaw;
|
|
3076
3082
|
exports.CrawlPage = CrawlPage;
|
|
3083
|
+
exports.InvalidBrowserNavigationUrlError = InvalidBrowserNavigationUrlError;
|
|
3077
3084
|
//# sourceMappingURL=index.cjs.map
|
|
3078
3085
|
//# sourceMappingURL=index.cjs.map
|