@ai-ecoverse/slicc-browsers 1.11.0 → 1.12.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
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,18 +68,18 @@
68
68
  "trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
69
69
  "release": "semantic-release",
70
70
  "test:guard": "npm run test:guard-integration && npm run test:guard-sweep",
71
- "test:guard-integration": "node --test --test-concurrency=2 test/integration/guard-lifecycle.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-error-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/self-contained.test.mjs",
71
+ "test:guard-integration": "node --test --test-concurrency=2 test/integration/guard-lifecycle.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-error-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/self-contained.test.mjs",
72
72
  "test:guard-sweep": "node scripts/test-guards.mjs",
73
73
  "test:gates": "node --test test/integration/gates.test.mjs",
74
74
  "test:guard-target": "node --test test/integration/guard-runner.test.mjs",
75
75
  "test:unit:guard": "node --experimental-test-coverage --test --test-coverage-include=guard-runner.mjs --test-coverage-include=fixture-server.mjs --test-coverage-lines=100 test/unit/guard-*.test.mjs"
76
76
  },
77
77
  "devDependencies": {
78
- "@ai-ecoverse/slicc-shared-web": "1.28.0",
78
+ "@ai-ecoverse/slicc-shared-web": "1.29.1",
79
79
  "@biomejs/biome": "2.5.15",
80
80
  "ajv": "8.20.0",
81
81
  "ajv-formats": "3.0.1",
82
- "lefthook": "2.2.1",
82
+ "lefthook": "2.2.2",
83
83
  "playwright-core": "1.64.1",
84
84
  "semantic-release": "25.0.9"
85
85
  }
@@ -46,15 +46,27 @@ async function lockChecks({ client, session, targetId, result }) {
46
46
  async function redaction({ client, targetId, failedURL, protectedOrigin, start, result }) {
47
47
  const info = await outcome(client.send('Target.getTargetInfo', { targetId }));
48
48
  const list = await outcome(client.send('Target.getTargets'));
49
+ const before = client.events.length;
50
+ const again = await outcome(client.send('Target.attachToTarget', { targetId, flatten: true }));
49
51
  const origin = new URL(failedURL).origin;
50
- result.infoRedacted =
51
- info.ok && info.result.targetInfo.url === origin && info.result.targetInfo.title === origin;
52
- result.listRedacted =
53
- list.ok &&
54
- list.result.targetInfos.some(
55
- (i) => i.targetId === targetId && i.url === origin && i.title === origin
56
- );
52
+ const only = (i) => i?.url === origin && i.title === origin;
53
+ const listed = list.ok ? list.result.targetInfos.find((i) => i.targetId === targetId) : undefined;
57
54
  await pause(100);
55
+ const attachedInfo = client.events
56
+ .slice(before)
57
+ .find(
58
+ (e) =>
59
+ e.method === 'Target.attachedToTarget' && e.params.sessionId === again.result?.sessionId
60
+ )?.params.targetInfo;
61
+ if (again.ok)
62
+ await outcome(client.send('Target.detachFromTarget', { sessionId: again.result.sessionId }));
63
+ result.infoRedacted = info.ok && only(info.result.targetInfo);
64
+ result.listRedacted = only(listed);
65
+ result.attachRedacted = only(attachedInfo);
66
+ result.fullURL =
67
+ info.result?.targetInfo?.url === failedURL &&
68
+ listed?.url === failedURL &&
69
+ attachedInfo?.url === failedURL;
58
70
  const targetEvents = client.events
59
71
  .slice(start)
60
72
  .filter(
@@ -63,12 +75,15 @@ async function redaction({ client, targetId, failedURL, protectedOrigin, start,
63
75
  e.params.targetInfo.url.includes(new URL(protectedOrigin).host)
64
76
  );
65
77
  result.eventsRedacted =
66
- targetEvents.length > 0 &&
67
- targetEvents.every(
68
- (e) => e.params.targetInfo.url === origin && e.params.targetInfo.title === origin
69
- );
78
+ targetEvents.length > 0 && targetEvents.every((e) => only(e.params.targetInfo));
70
79
  }
71
80
 
81
+ const secrets = {
82
+ all: (tag) => `/doc/path-secret-${tag}?query-secret=${tag}#fragment-secret-${tag}`,
83
+ query: (tag) => `/doc?query-secret=${tag}`,
84
+ fragment: (tag) => `/doc#fragment-secret-${tag}`,
85
+ };
86
+
72
87
  export async function protectedErrorPage({
73
88
  client,
74
89
  reader,
@@ -78,9 +93,10 @@ export async function protectedErrorPage({
78
93
  mode,
79
94
  side,
80
95
  internalSessions = new Set(),
96
+ secret = 'all',
81
97
  }) {
82
98
  const initial = `${protectedOrigin}/doc?n=${tag}-history`;
83
- const failedURL = `${protectedOrigin}/doc/path-secret-${tag}?query-secret=${tag}#fragment-secret-${tag}`;
99
+ const failedURL = `${protectedOrigin}${secrets[secret](tag)}`;
84
100
  const result = {};
85
101
  const start = client.events.length;
86
102
  const { targetId } = await reader.send('Target.createTarget', { url: initial, background: true });
@@ -197,7 +213,7 @@ export async function protectedErrorPage({
197
213
  const beforeRestore = reader.events.length;
198
214
  await reader.send(
199
215
  'Runtime.evaluate',
200
- { expression: `history.go(${index - currentIndex})` },
216
+ { expression: `setTimeout(() => history.go(${index - currentIndex}), 0)` },
201
217
  observer
202
218
  );
203
219
  result.restored = await until(() =>
@@ -433,6 +433,7 @@
433
433
  "required": ["errorPage", "as"],
434
434
  "properties": {
435
435
  "errorPage": { "enum": ["recover", "restore", "sticky"] },
436
+ "secret": { "enum": ["all", "query", "fragment"] },
436
437
  "requires": { "$ref": "#/$defs/requires" },
437
438
  "as": { "$ref": "#/$defs/name" }
438
439
  }