@ai-ecoverse/slicc-browsers 1.18.16 → 1.18.18

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.18.16",
3
+ "setVersion": "1.18.18",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
@@ -1200,7 +1200,7 @@
1200
1200
  }
1201
1201
  },
1202
1202
  "eventsRedacted": {
1203
- "means": "protected error-page recover: eventsRedacted",
1203
+ "means": "protected error-page recover: every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1204
1204
  "requires": ["discovery"],
1205
1205
  "check": {
1206
1206
  "result": "errorPage",
@@ -1210,7 +1210,7 @@
1210
1210
  }
1211
1211
  },
1212
1212
  "reload": {
1213
- "means": "protected error-page recover: reload",
1213
+ "means": "protected error-page recover: Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
1214
1214
  "check": {
1215
1215
  "result": "errorPage",
1216
1216
  "path": "result.reload",
@@ -1349,7 +1349,7 @@
1349
1349
  }
1350
1350
  },
1351
1351
  "eventsRedacted": {
1352
- "means": "protected error-page recover (query): eventsRedacted",
1352
+ "means": "protected error-page recover (query): every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1353
1353
  "requires": ["discovery"],
1354
1354
  "check": {
1355
1355
  "result": "errorPage",
@@ -1359,7 +1359,7 @@
1359
1359
  }
1360
1360
  },
1361
1361
  "reload": {
1362
- "means": "protected error-page recover (query): reload",
1362
+ "means": "protected error-page recover (query): Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
1363
1363
  "check": {
1364
1364
  "result": "errorPage",
1365
1365
  "path": "result.reload",
@@ -1498,7 +1498,7 @@
1498
1498
  }
1499
1499
  },
1500
1500
  "eventsRedacted": {
1501
- "means": "protected error-page recover (fragment): eventsRedacted",
1501
+ "means": "protected error-page recover (fragment): every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1502
1502
  "requires": ["discovery"],
1503
1503
  "check": {
1504
1504
  "result": "errorPage",
@@ -1508,7 +1508,7 @@
1508
1508
  }
1509
1509
  },
1510
1510
  "reload": {
1511
- "means": "protected error-page recover (fragment): reload",
1511
+ "means": "protected error-page recover (fragment): Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
1512
1512
  "check": {
1513
1513
  "result": "errorPage",
1514
1514
  "path": "result.reload",
@@ -1646,7 +1646,7 @@
1646
1646
  }
1647
1647
  },
1648
1648
  "eventsRedacted": {
1649
- "means": "protected error-page restore: eventsRedacted",
1649
+ "means": "protected error-page restore: every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1650
1650
  "requires": ["discovery"],
1651
1651
  "check": {
1652
1652
  "result": "errorPage",
@@ -1656,7 +1656,7 @@
1656
1656
  }
1657
1657
  },
1658
1658
  "reload": {
1659
- "means": "protected error-page restore: reload",
1659
+ "means": "protected error-page restore: Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
1660
1660
  "check": {
1661
1661
  "result": "errorPage",
1662
1662
  "path": "result.reload",
@@ -1827,7 +1827,7 @@
1827
1827
  }
1828
1828
  },
1829
1829
  "eventsRedacted": {
1830
- "means": "protected error-page sticky: eventsRedacted",
1830
+ "means": "protected error-page sticky: every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
1831
1831
  "requires": ["discovery"],
1832
1832
  "check": {
1833
1833
  "result": "errorPage",
@@ -1837,7 +1837,7 @@
1837
1837
  }
1838
1838
  },
1839
1839
  "reload": {
1840
- "means": "protected error-page sticky: reload",
1840
+ "means": "protected error-page sticky: Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
1841
1841
  "check": {
1842
1842
  "result": "errorPage",
1843
1843
  "path": "result.reload",
@@ -2020,7 +2020,7 @@
2020
2020
  }
2021
2021
  },
2022
2022
  "eventsRedacted": {
2023
- "means": "protected error-page sticky (query): eventsRedacted",
2023
+ "means": "protected error-page sticky (query): every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2024
2024
  "requires": ["discovery"],
2025
2025
  "check": {
2026
2026
  "result": "errorPage",
@@ -2030,7 +2030,7 @@
2030
2030
  }
2031
2031
  },
2032
2032
  "reload": {
2033
- "means": "protected error-page sticky (query): reload",
2033
+ "means": "protected error-page sticky (query): Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
2034
2034
  "check": {
2035
2035
  "result": "errorPage",
2036
2036
  "path": "result.reload",
@@ -2213,7 +2213,7 @@
2213
2213
  }
2214
2214
  },
2215
2215
  "eventsRedacted": {
2216
- "means": "protected error-page sticky (fragment): eventsRedacted",
2216
+ "means": "protected error-page sticky (fragment): every discovery event for the tab shows the failed URL's origin only, a masked or absent url, or a url off the protected host that names at most that origin, and no url or title carries the failed URL, its path, query or fragment, decoded as often as it takes; no discovery event for another or no target carries the row's tag; reporting no event for the tab also passes",
2217
2217
  "requires": ["discovery"],
2218
2218
  "check": {
2219
2219
  "result": "errorPage",
@@ -2223,7 +2223,7 @@
2223
2223
  }
2224
2224
  },
2225
2225
  "reload": {
2226
- "means": "protected error-page sticky (fragment): reload",
2226
+ "means": "protected error-page sticky (fragment): Page.reload is answered, then the observer sees the protected error page again, or on the guarded leg exactly data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E with no unreachableUrl and no protected URL in its target url, title or location; a title or location the observer can't read is incomplete",
2227
2227
  "check": {
2228
2228
  "result": "errorPage",
2229
2229
  "path": "result.reload",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.18.16",
3
+ "version": "1.18.18",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -68,7 +68,7 @@
68
68
  "validate": "node scripts/validate.mjs",
69
69
  "lint": "slicc-lint && test -z \"$(gofmt -l .)\" && go mod tidy -diff && go vet ./... && GOOS=darwin go vet ./... && GOOS=windows go vet ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features && cargo check --target wasm32-wasip1 --features serde && cargo check --target wasm32-wasip1 --all-features",
70
70
  "format": "biome check --write . && gofmt -w . && cargo fmt",
71
- "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-sweep-union.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-others.test.mjs",
71
+ "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-error-page-events.test.mjs test/integration/guard-error-page-reload.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-sweep-union.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-others.test.mjs",
72
72
  "test:unit": "mkdir -p coverage/unit && node --experimental-test-coverage --test --test-concurrency=1 --test-reporter=lcov --test-reporter-destination=coverage/unit/lcov.info test/unit/*.test.mjs && go test -race -cover ./...",
73
73
  "build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
74
74
  "prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
@@ -79,9 +79,9 @@
79
79
  "test:unit:guard": "mkdir -p coverage/unit && node --experimental-vm-modules --no-warnings --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=guard-runner.mjs --test-coverage-include=guard-driver.mjs --test-coverage-include=fixture-server.mjs --test-coverage-include=fixture-client.mjs --test-coverage-include=observer-target.mjs --test-coverage-include=frame-read.mjs --test-coverage-include=bfcache-restore.mjs --test-coverage-include=protected-error-page.mjs --test-coverage-include=unparseable-url.mjs --test-coverage-include=scripts/browser-runner.mjs --test-coverage-include=scripts/validate.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/guard.lcov test/unit/guard-*.test.mjs && slicc-diff-cover coverage/unit/guard.lcov"
80
80
  },
81
81
  "devDependencies": {
82
- "@ai-ecoverse/slicc-cdp": "1.42.1",
83
- "@ai-ecoverse/slicc-shared-web": "2.13.2",
84
- "@biomejs/biome": "2.5.15",
82
+ "@ai-ecoverse/slicc-cdp": "1.42.3",
83
+ "@ai-ecoverse/slicc-shared-web": "2.13.4",
84
+ "@biomejs/biome": "2.6.2",
85
85
  "ajv": "8.20.0",
86
86
  "ajv-formats": "3.0.1",
87
87
  "lefthook": "2.2.2",
@@ -51,15 +51,106 @@ async function lockChecks({ client, session, targetId, result }) {
51
51
  result.closeRefused = refused(await outcome(client.send('Target.closeTarget', { targetId })));
52
52
  }
53
53
 
54
- async function redaction({
55
- client,
56
- targetId,
57
- failedURL,
58
- protectedOrigin,
59
- start,
60
- result,
61
- discovery,
62
- }) {
54
+ const discoveryMethods = ['Target.targetCreated', 'Target.targetInfoChanged'];
55
+ const lower = (value) => String(value ?? '').toLowerCase();
56
+ const plain = (value) =>
57
+ lower(
58
+ String(value ?? '').replace(/%([0-9a-f]{2})/gi, (_, hex) =>
59
+ String.fromCharCode(Number.parseInt(hex, 16))
60
+ )
61
+ );
62
+ const layers = (value) => {
63
+ const out = [lower(value)];
64
+ for (let next = plain(out[0]); next !== out.at(-1); next = plain(next)) out.push(next);
65
+ return out;
66
+ };
67
+ const unschemed = (value) => value.replace(/^[a-z][a-z\d+.-]*:\/\//, '');
68
+
69
+ const encoded = (url) =>
70
+ Array.from(
71
+ new TextEncoder().encode(url),
72
+ (byte) => `%${byte.toString(16).toUpperCase().padStart(2, '0')}`
73
+ ).join('');
74
+
75
+ const triggerURL = (ordinary, url) => `${ordinary}/page?k=deferred&defer=0&to=${encoded(url)}`;
76
+
77
+ const errorPageURL = 'chrome-error://chromewebdata/';
78
+ const privateBlankURL = 'data:text/html,%3Ctitle%3Eblocked%3C%2Ftitle%3E';
79
+
80
+ function failureRules({ failedURL, tag }) {
81
+ const failed = new URL(failedURL);
82
+ const { origin, hostname } = failed;
83
+ const parts = [
84
+ failedURL,
85
+ `${failed.pathname}${failed.search}${failed.hash}`,
86
+ failed.pathname,
87
+ failed.search.slice(1),
88
+ failed.hash.slice(1),
89
+ tag,
90
+ ]
91
+ .filter((part) => part && part !== '/')
92
+ .map(plain);
93
+ const leaks = (value) => layers(value).some((form) => parts.some((part) => form.includes(part)));
94
+ const names = (value) =>
95
+ layers(value).some((form) => form.includes(hostname)) || parseURL(value)?.origin === origin;
96
+ const carries = (value) => layers(value).some((form) => form.includes(plain(tag)));
97
+ return { failed, leaks, names, carries };
98
+ }
99
+
100
+ function discoveryRules({ failedURL, tag, trigger }) {
101
+ const { failed, leaks, names, carries } = failureRules({ failedURL, tag });
102
+ const { origin, host, hostname } = failed;
103
+ const named = [hostname, host, origin];
104
+ const cleanTitle = (title) => !leaks(title) && (!names(title) || named.includes(lower(title)));
105
+ const ownTitle = ({ url, title }) =>
106
+ plain(title) !== '' && [plain(url), unschemed(plain(url))].includes(plain(title));
107
+ const onHost = (url) => {
108
+ const parsed = parseURL(url);
109
+ return parsed?.origin === origin || parsed?.hostname === hostname;
110
+ };
111
+ const cleanURL = (url) => !leaks(url) && (lower(url) === origin || !onHost(url));
112
+ const home = parseURL(trigger)?.href;
113
+ const clean = (info) => {
114
+ if (parseURL(info.url)?.href === home) return ownTitle(info) || cleanTitle(info.title);
115
+ return cleanURL(info.url) && (cleanTitle(info.title) || (ownTitle(info) && !leaks(info.title)));
116
+ };
117
+ return { clean, carries };
118
+ }
119
+
120
+ function eventsRedacted({ events, targetId, start, ...failure }) {
121
+ const { clean, carries } = discoveryRules(failure);
122
+ return events
123
+ .slice(start)
124
+ .filter((e) => discoveryMethods.includes(e.method))
125
+ .every((e) =>
126
+ e.params?.targetInfo?.targetId === targetId
127
+ ? clean(e.params.targetInfo)
128
+ : !carries(JSON.stringify(e.params ?? null))
129
+ );
130
+ }
131
+
132
+ async function privateBlank({ frame, reader, observer, targetId, failedURL, tag }) {
133
+ const { leaks, names } = failureRules({ failedURL, tag });
134
+ if (frame.url !== privateBlankURL || frame.unreachableUrl) return false;
135
+ const { targetInfo } = await reader.send('Target.getTargetInfo', { targetId });
136
+ if (targetInfo.url !== privateBlankURL) return false;
137
+ const read = async (expression) => {
138
+ const out = await outcome(
139
+ reader.send('Runtime.evaluate', { expression, returnByValue: true }, observer)
140
+ );
141
+ const value = out.result?.result?.value;
142
+ return out.ok && !out.result.exceptionDetails && typeof value === 'string' ? value : undefined;
143
+ };
144
+ const href = await read('location.href');
145
+ const title = await read('document.title');
146
+ if (href === undefined || title === undefined) return 'incomplete';
147
+ return (
148
+ href === privateBlankURL &&
149
+ ![targetInfo.title, title].some((value) => leaks(value) || names(value))
150
+ );
151
+ }
152
+
153
+ async function redaction({ client, targetId, failedURL, ordinary, tag, start, result, discovery }) {
63
154
  const info = await outcome(client.send('Target.getTargetInfo', { targetId }));
64
155
  const list = await outcome(client.send('Target.getTargets'));
65
156
  const before = client.events.length;
@@ -83,16 +174,15 @@ async function redaction({
83
174
  info.result?.targetInfo?.url === failedURL &&
84
175
  listed?.url === failedURL &&
85
176
  attachedInfo?.url === failedURL;
86
- const targetEvents = client.events
87
- .slice(start)
88
- .filter(
89
- (e) =>
90
- ['Target.targetCreated', 'Target.targetInfoChanged'].includes(e.method) &&
91
- e.params?.targetInfo?.targetId === targetId &&
92
- e.params.targetInfo.url.includes(new URL(protectedOrigin).host)
93
- );
94
177
  result.eventsRedacted = discovery
95
- ? targetEvents.length > 0 && targetEvents.every((e) => only(e.params.targetInfo))
178
+ ? eventsRedacted({
179
+ events: client.events,
180
+ targetId,
181
+ start,
182
+ failedURL,
183
+ tag,
184
+ trigger: triggerURL(ordinary, failedURL),
185
+ })
96
186
  : 'not-supported';
97
187
  }
98
188
 
@@ -120,19 +210,9 @@ async function seed(reader, observer, loaded, initial, allowed) {
120
210
  return out.ok ? out.result : `observer setup failed: ${out.error.message}`;
121
211
  }
122
212
 
123
- const encoded = (url) =>
124
- Array.from(
125
- new TextEncoder().encode(url),
126
- (byte) => `%${byte.toString(16).toUpperCase().padStart(2, '0')}`
127
- ).join('');
128
-
129
213
  async function scripted(client, session, ordinary, url) {
130
214
  const out = await outcome(
131
- client.send(
132
- 'Page.navigate',
133
- { url: `${ordinary}/page?k=deferred&defer=0&to=${encoded(url)}` },
134
- session
135
- )
215
+ client.send('Page.navigate', { url: triggerURL(ordinary, url) }, session)
136
216
  );
137
217
  return out.ok ? undefined : `client navigation failed: ${out.error.message}`;
138
218
  }
@@ -242,7 +322,7 @@ export async function protectedErrorPage({
242
322
  const { targetInfo } = await reader.send('Target.getTargetInfo', { targetId });
243
323
  evidence = { frame: f, targetInfo };
244
324
  return (
245
- f.url === 'chrome-error://chromewebdata/' &&
325
+ f.url === errorPageURL &&
246
326
  f.securityOrigin === '://' &&
247
327
  f.unreachableUrl === failedURL &&
248
328
  targetInfo.url === failedURL
@@ -259,15 +339,24 @@ export async function protectedErrorPage({
259
339
  return missing(`missing error commit ${JSON.stringify(evidence)}`);
260
340
  result.live = live;
261
341
  if (!live) return { ...result, liveWhy: commitWhy(result.diagnostics.errorCommit) };
262
- await redaction({ client, targetId, failedURL, protectedOrigin, start, result, discovery });
342
+ await redaction({ client, targetId, failedURL, ordinary, tag, start, result, discovery });
263
343
  const beforeReload = (await frame()).loaderId;
264
344
  result.reload = (await outcome(client.send('Page.reload', {}, session))).ok;
265
345
  if (result.reload) {
266
- result.reloadedError = await until(async () => {
346
+ result.reload = await until(async () => {
267
347
  const f = await frame();
268
- return f.loaderId !== beforeReload && f.unreachableUrl === failedURL;
348
+ result.reloadedError =
349
+ f.loaderId !== beforeReload && f.url === errorPageURL && f.unreachableUrl === failedURL;
350
+ result.reloadedBlank =
351
+ !result.reloadedError &&
352
+ side === 'guarded' &&
353
+ (await privateBlank({ frame: f, reader, observer, targetId, failedURL, tag }));
354
+ return result.reloadedError || result.reloadedBlank === true;
269
355
  });
270
- result.reload = result.reloadedError;
356
+ if (!result.reload && result.reloadedBlank === 'incomplete') {
357
+ result.reload = 'incomplete';
358
+ result.incomplete = 'protected-error-page: the private blank page could not be read';
359
+ }
271
360
  }
272
361
  const recovery = `${ordinary}/blank?n=${tag}-recover`;
273
362
  result.blank = (await outcome(client.send('Page.navigate', { url: recovery }, session))).ok;