aboutsummaryrefslogtreecommitdiff
path: root/package.json
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-11-10 19:17:57 +0200
committerIgor Soarez <igor@soarez.org>2026-11-10 19:22:56 +0200
commitcf47a164991bf5588fd2b41ce244f55d900c1167 (patch)
treed2fffa70d1fce92be5aaa2124ed77a6be2e0c3c0 /package.json
parentb8b63ea4d1bad9c4bbac6b05b03cce5f2cfa3f94 (diff)
extension: snapshot sandboxed pages over CDP, never return empty text
On a page served with CSP `sandbox` and no allow-scripts, such as raw.githubusercontent.com, chrome.scripting.executeScript runs nothing and resolves with a null result instead of throwing. The access-denied CDP fallback never ran, page.snapshot returned undefined, and chrome_snapshot answered with {type: "text"} and no text, because JSON.stringify(undefined) is undefined. Pi saved that block in the session, and every later turn failed in token estimation with "Cannot read properties of undefined (reading 'length')", whatever the provider. When scripting resolves without an envelope, snapshot and inspect now redo the injection and the call over CDP Runtime.evaluate, which such pages still allow, and raise an error if that also returns nothing. On the pi side, safeJson always returns a string, and an empty snapshot or inspect result is a tool error rather than a text block without text. sandboxed-snapshot.test.mjs drives page.snapshot and page.inspect through a page that runs no extension script. It fails on b8b63ea.
Diffstat (limited to 'package.json')
-rw-r--r--package.json2
1 files changed, 1 insertions, 1 deletions
diff --git a/package.json b/package.json
index cc7ef4c..7f7e204 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "pi-chrome",
"version": "0.15.57",
"scripts": {
- "test": "node test-suite/unit/csp-eval.test.mjs && node test-suite/unit/automation-target.test.mjs && node test-suite/unit/session-cleanup.test.mjs && node test-suite/unit/background-policy.test.mjs && node test-suite/unit/input-reliability.test.mjs && node test-suite/unit/chrome-command.test.mjs && node test-suite/unit/bridge-resilience.test.mjs && node test-suite/unit/cdp-passthrough.test.mjs && node test-suite/unit/type-evidence.test.mjs && node test-suite/unit/hidden-input.test.mjs && node test-suite/unit/console-capture.test.mjs && node test-suite/unit/prompt-section.test.mjs && node test-suite/unit/upload-guard.test.mjs && node test-suite/unit/grant-scope.test.mjs && node test-suite/unit/leave-site-prompt.test.mjs && node test-suite/unit/shared-window.test.mjs && node test-suite/unit/overlay.test.mjs",
+ "test": "node test-suite/unit/csp-eval.test.mjs && node test-suite/unit/automation-target.test.mjs && node test-suite/unit/session-cleanup.test.mjs && node test-suite/unit/background-policy.test.mjs && node test-suite/unit/input-reliability.test.mjs && node test-suite/unit/chrome-command.test.mjs && node test-suite/unit/bridge-resilience.test.mjs && node test-suite/unit/cdp-passthrough.test.mjs && node test-suite/unit/type-evidence.test.mjs && node test-suite/unit/hidden-input.test.mjs && node test-suite/unit/console-capture.test.mjs && node test-suite/unit/prompt-section.test.mjs && node test-suite/unit/upload-guard.test.mjs && node test-suite/unit/grant-scope.test.mjs && node test-suite/unit/leave-site-prompt.test.mjs && node test-suite/unit/shared-window.test.mjs && node test-suite/unit/overlay.test.mjs && node test-suite/unit/sandboxed-snapshot.test.mjs",
"version": "node scripts/sync-manifest-version.js",
"prepublishOnly": "node scripts/sync-manifest-version.js"
},