Trim comments and docs to what the code needs

AI Assisted
This commit is contained in:
Seth committed 2026-12-05 13:19:59 -08:00
1 parent eba3c3bf0c
commit 0bd721fc27
33 files changed
+292 -392

No files matched your search

+10 -15
View File
@@ -1,10 +1,8 @@
// Web console page tests: the page as the macOS app's frame has it. WebKit
// gives that frame no cookie, so the console signs it in by a path prefix
// (`/f/<key>/`, routes.mjs) and the page runs under it. Every request the page
// makes there must stay under the prefix: one that leaves it gets a 403, and
// only in the macOS app. This file opens the page that way in a browser
// context with no cookie, uses the parts that fetch, and fails on any request
// that left the prefix or was refused. Run with:
// Web console page tests: the page as the macOS app's frame has it, signed in
// by the path prefix `/f/<key>/` (routes.mjs) with no cookie. A request that
// leaves the prefix gets a 403, and only in the macOS app. This opens the page
// that way, uses the parts that fetch, and fails on any request that left the
// prefix or was refused. Run with:
// node --test scripts/test-web-console-page-frame.mjs
import crypto from "node:crypto";
@@ -20,11 +18,9 @@ const suite = pageSuite(test);
const LOOKS_FILE = path.join(HOME, "looks.json");
// The server takes the app's frame mode only on macOS, with the app's page as
// the embed ancestor. On any other OS this makes the server alone believe it
// runs on macOS (the CLI that starts it is left as it is), so CI's Linux run
// checks the same thing. The whole server sees darwin, not only frameKey():
// every macOS branch in it runs here too.
// Frame mode needs macOS and the app's page as the embed ancestor. This makes
// only the server (not the CLI that starts it) see darwin, so CI's Linux run
// checks it too; every macOS branch in the server runs, not only frameKey().
const FAKE_MAC =
"data:text/javascript," +
encodeURIComponent('if (/server\\.mjs$/.test(process.argv[1] || "")) Object.defineProperty(process, "platform", { value: "darwin" });');
@@ -76,9 +72,8 @@ test("under the frame's prefix, with no cookie, the dashboard draws, its stream
await until(() => streamed, 10000);
assert.ok(streamed, "the event stream connected under the prefix");
// A step that waits on a request the server refused times out; the
// requests that left the prefix or were refused are the reason, so they
// are reported first.
// A step waiting on a refused request times out; the finally block reports
// the requests that left the prefix or were refused instead, as the cause.
try {
// The Notebook: its tab list and note come from the server.
await page.click("#btn-notepad");