Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
13 lines
820 B
JavaScript
13 lines
820 B
JavaScript
// Runs inside the view's frame as a real inline script, so the page's CSP applies to it (DevTools evaluate would not).
|
|
(async () => {
|
|
const r = [];
|
|
// Wait for a new task: while a DevTools call is still on the stack, Chromium lets eval through whatever the CSP says.
|
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
try { eval("1"); r.push("eval(): ALLOWED"); } catch (e) { r.push("eval(): " + e.name); }
|
|
try { await fetch(location.ancestorOrigins[0] + "/sandbox.html"); r.push("fetch from the sandbox origin ('self'): ALLOWED"); }
|
|
catch (e) { r.push("fetch from the sandbox origin ('self'): " + e.name); }
|
|
try { await fetch("https://api.example.com/stock"); r.push("fetch undeclared origin: ALLOWED"); }
|
|
catch (e) { r.push("fetch undeclared origin: " + e.name); }
|
|
window.__probes = r;
|
|
})();
|