@ai-ecoverse/slicc-browsers 1.18.5 → 1.18.7

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.
@@ -159,14 +159,51 @@ class Restore {
159
159
  }
160
160
 
161
161
  async trigger() {
162
+ const method = 'Page.navigateToHistoryEntry';
162
163
  const params = { entryId: this.entry.id };
163
- const out =
164
- this.mode === 'history'
165
- ? await this.call('Page.navigateToHistoryEntry', params)
166
- : await this.read('Page.navigateToHistoryEntry', params);
164
+ if (this.mode !== 'history') {
165
+ this.result.triggerPath = 'observer';
166
+ this.result.trigger = await this.read(method, params);
167
+ return;
168
+ }
169
+ const command = { id: 'history-trigger', method, params, sentAt: Date.now() };
170
+ const work = this.client.send(method, params, this.session);
171
+ void outcome(work).then((reply) => {
172
+ this.result.triggerReply = reply;
173
+ if (reply.ok && this.result.triggerPath === 'observer-after-audited-timeout') {
174
+ this.result.triggerPath = 'client-late-answer';
175
+ this.missingEvidence('history navigation answered after non-forwarding audit');
176
+ }
177
+ });
178
+ const out = await bounded(work, this.budget);
167
179
  this.result.trigger = out;
168
- if (this.mode === 'history' && refusal(out))
169
- await this.read('Page.navigateToHistoryEntry', params);
180
+ const timedOut = out.error?.message === 'no answer';
181
+ this.result.triggerPath = timedOut ? 'client-timeout' : 'client';
182
+ let refused = refusal(out);
183
+ if (timedOut && this.forwardAudit) {
184
+ const audit = await bounded(
185
+ typeof this.gate.audit === 'function'
186
+ ? Promise.resolve().then(() =>
187
+ this.gate.audit({ historyTrigger: command, probes: [], final: false })
188
+ )
189
+ : Promise.reject(new Error('forwarding audit unavailable')),
190
+ this.budget
191
+ );
192
+ this.result.triggerAudit = audit;
193
+ const decision = audit.result?.historyTrigger;
194
+ refused =
195
+ audit.ok &&
196
+ decision?.complete === true &&
197
+ decision.id === command.id &&
198
+ decision.forwarded === false &&
199
+ !(await bounded(work, 0)).ok;
200
+ }
201
+ if (refused) {
202
+ this.result.triggerPath = timedOut
203
+ ? 'observer-after-audited-timeout'
204
+ : 'observer-after-refusal';
205
+ this.result.fallback = await this.read(method, params);
206
+ }
170
207
  }
171
208
 
172
209
  async probe(method, params, current) {
@@ -243,6 +280,7 @@ class Restore {
243
280
  this.messageStart = this.client.messages?.length ?? 0;
244
281
  this.result.delay.startedAt = Date.now();
245
282
  const trigger = this.trigger();
283
+ if (this.mode === 'history') await trigger;
246
284
  const restored = await waitFor(async () => {
247
285
  const f = await this.frame();
248
286
  return f?.url === this.url && !f.unreachableUrl && (await this.state())?.persisted === true;
@@ -29,7 +29,7 @@ async function discover(reader, session, extensionId) {
29
29
  throw new Error(`extensionWorld: no content-script context for ${extensionId}`);
30
30
  }
31
31
 
32
- async function drivable(client, session, live) {
32
+ async function drivable({ client, session, live, reader, observer }) {
33
33
  const setup = await outcome(
34
34
  client.send(
35
35
  'Runtime.evaluate',
@@ -44,6 +44,7 @@ async function drivable(client, session, live) {
44
44
  const snapshot = await outcome(
45
45
  client.send('DOMSnapshot.captureSnapshot', { computedStyles: [] }, session)
46
46
  );
47
+ await outcome(reader.send('Page.bringToFront', {}, observer));
47
48
  const down = await outcome(
48
49
  client.send(
49
50
  'Input.dispatchMouseEvent',
@@ -395,7 +396,7 @@ export async function extensionWorld({
395
396
  controls,
396
397
  pauseMs,
397
398
  };
398
- if (mode === 'drivable') return await drivable(client, session, live);
399
+ if (mode === 'drivable') return await drivable(input);
399
400
  if (mode === 'debugger') return await debuggerWorld(input);
400
401
  return await selectWorld(input);
401
402
  } finally {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.18.5",
3
+ "setVersion": "1.18.7",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.18.5",
3
+ "version": "1.18.7",
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 ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings",
70
70
  "format": "biome check --write . && gofmt -w . && cargo fmt",
71
- "test": "npm run validate && 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/git-retry.test.mjs test/integration/release-line.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-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs && go test -race -count=1 ./test/integration/... && cargo test --all-features",
71
+ "test": "npm run validate && 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/git-retry.test.mjs test/integration/release-line.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-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.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 && go test -race -count=1 ./test/integration/... && cargo test --all-features",
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
  "trust": "npx fledgling sync -y --skip-publish",
@@ -83,7 +83,7 @@
83
83
  "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=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"
84
84
  },
85
85
  "devDependencies": {
86
- "@ai-ecoverse/slicc-shared-web": "2.7.8",
86
+ "@ai-ecoverse/slicc-shared-web": "2.8.4",
87
87
  "@biomejs/biome": "2.5.15",
88
88
  "ajv": "8.20.0",
89
89
  "ajv-formats": "3.0.1",
@@ -232,6 +232,7 @@ export async function protectedErrorPage({
232
232
  observer
233
233
  );
234
234
  }
235
+ await outcome(reader.send('Page.bringToFront', {}, observer));
235
236
  const unsent = await scripted(client, session, ordinary, failedURL);
236
237
  if (unsent) return missing(unsent);
237
238
  let evidence;