@ai-ecoverse/slicc-browsers 1.49.0 → 1.51.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/engine.mjs CHANGED
@@ -14,8 +14,13 @@ const roles = [
14
14
  ];
15
15
  let compiled;
16
16
 
17
- function valid(op, result) {
18
- switch (op) {
17
+ const captureDecision = (v) => v === 'allow' || v === 'blank';
18
+ const record = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
19
+
20
+ function valid(request, result) {
21
+ switch (request.op) {
22
+ case 'targetClass':
23
+ case 'frameClass':
19
24
  case 'urlClass':
20
25
  return (
21
26
  typeof result?.protected === 'boolean' &&
@@ -29,6 +34,31 @@ function valid(op, result) {
29
34
  typeof result.digest === 'string' &&
30
35
  /^[0-9a-f]{16}$/.test(result.digest)
31
36
  );
37
+ case 'page':
38
+ return (
39
+ typeof result?.mixed === 'boolean' &&
40
+ record(result.frames) &&
41
+ Object.keys(result.frames).length === request.frames.length &&
42
+ request.frames.every((f) => Object.hasOwn(result.frames, f.id)) &&
43
+ Object.values(result.frames).every(
44
+ (v) =>
45
+ typeof v?.protected === 'boolean' &&
46
+ roles.includes(v.role) &&
47
+ captureDecision(v.capture)
48
+ )
49
+ );
50
+ case 'capture':
51
+ return captureDecision(result);
52
+ case 'reply':
53
+ return (
54
+ record(result) &&
55
+ ((Object.keys(result).length === 1 &&
56
+ Object.hasOwn(result, 'result') &&
57
+ record(result.result)) ||
58
+ (Object.keys(result).length === 2 &&
59
+ result.action === 'refuse' &&
60
+ typeof result.reason === 'string'))
61
+ );
32
62
  case 'refusal':
33
63
  return typeof result === 'string' && result.startsWith('slicc: refused: ');
34
64
  case 'har':
@@ -61,19 +91,20 @@ function encode(value) {
61
91
  );
62
92
  }
63
93
 
64
- function preserveTargetComparison(request) {
94
+ function preserveFailedURL(request) {
65
95
  if (
66
- request?.op !== 'target' ||
67
- typeof request.url !== 'string' ||
68
- typeof request.unreachableURL !== 'string'
96
+ !['target', 'frame', 'targetClass', 'frameClass'].includes(request?.op) ||
97
+ typeof request.url !== 'string'
69
98
  )
70
99
  return request;
100
+ const failed = request.unreachableURL ?? request.unreachableUrl;
71
101
  if (
72
- request.url !== request.unreachableURL &&
73
- request.url.toWellFormed() === request.unreachableURL.toWellFormed()
102
+ typeof failed !== 'string' ||
103
+ failed === request.url ||
104
+ failed.toWellFormed() !== request.url.toWellFormed()
74
105
  )
75
- return { ...request, unreachableURL: undefined };
76
- return request;
106
+ return request;
107
+ return { ...request, documentURL: undefined };
77
108
  }
78
109
 
79
110
  function binding(module, config) {
@@ -91,15 +122,15 @@ function binding(module, config) {
91
122
  instance ??= create();
92
123
  const wire =
93
124
  request.op === 'batch' && Array.isArray(request.calls)
94
- ? { ...request, calls: request.calls.map(preserveTargetComparison) }
95
- : preserveTargetComparison(request);
125
+ ? { ...request, calls: request.calls.map(preserveFailedURL) }
126
+ : preserveFailedURL(request);
96
127
  const result = exchange(instance, 'engine_call', encode(wire));
97
128
  const ok =
98
129
  request.op === 'batch'
99
130
  ? Array.isArray(result) &&
100
131
  result.length === request.calls.length &&
101
- result.every((v, i) => valid(request.calls[i].op, v))
102
- : valid(request.op, result);
132
+ result.every((v, i) => valid(request.calls[i], v))
133
+ : valid(request, result);
103
134
  if (!ok) throw new Error(`invalid engine result for ${request.op}`);
104
135
  return result;
105
136
  } catch (error) {
@@ -112,11 +143,18 @@ function binding(module, config) {
112
143
  urlReadOnly: (url) => call({ op: 'url', url, readOnly: true }),
113
144
  urlClass: (url) => call({ op: 'urlClass', url }),
114
145
  target: (facts) => call({ ...facts, op: 'target' }),
146
+ page: (facts) => call({ ...facts, op: 'page' }),
147
+ capture: (facts) => call({ ...facts, op: 'capture' }),
148
+ reply: (facts) => call({ ...facts, op: 'reply' }),
149
+ frame: (facts) => call({ ...facts, op: 'frame' }),
150
+ targetClass: (facts) => call({ ...facts, op: 'targetClass' }),
151
+ frameClass: (facts) => call({ ...facts, op: 'frameClass' }),
115
152
  kept: (url) => call({ op: 'kept', url }),
116
153
  keptTarget: (facts) => call({ ...facts, op: 'keptTarget' }),
117
154
  unparseable: (url) => call({ op: 'unparseable', url }),
118
155
  cookieDomain: (domain) => call({ op: 'cookieDomain', domain }),
119
156
  storageKey: (key) => call({ op: 'storageKey', key }),
157
+ foreignWorld: (origin) => call({ op: 'foreignWorld', origin }),
120
158
  extensionFrame: (url) => call({ op: 'extensionFrame', url }),
121
159
  har: (url) => call({ op: 'har', url }),
122
160
  zoneHost: (host) => call({ op: 'zoneHost', host }),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.49.0",
3
+ "setVersion": "1.51.0",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
@@ -2065,9 +2065,9 @@
2065
2065
  "reload": true,
2066
2066
  "blank": true,
2067
2067
  "restored": true,
2068
- "evaluateRefused": true,
2069
- "attachRefused": true,
2070
- "closeRefused": true,
2068
+ "evaluateRefused": false,
2069
+ "attachRefused": false,
2070
+ "closeRefused": false,
2071
2071
  "closed": true,
2072
2072
  "stickyError": true,
2073
2073
  "attachRedacted": true,
@@ -2279,9 +2279,9 @@
2279
2279
  "reload": true,
2280
2280
  "blank": true,
2281
2281
  "restored": true,
2282
- "evaluateRefused": true,
2283
- "attachRefused": true,
2284
- "closeRefused": true,
2282
+ "evaluateRefused": false,
2283
+ "attachRefused": false,
2284
+ "closeRefused": false,
2285
2285
  "closed": true,
2286
2286
  "stickyError": true,
2287
2287
  "attachRedacted": true,
@@ -2493,9 +2493,9 @@
2493
2493
  "reload": true,
2494
2494
  "blank": true,
2495
2495
  "restored": true,
2496
- "evaluateRefused": true,
2497
- "attachRefused": true,
2498
- "closeRefused": true,
2496
+ "evaluateRefused": false,
2497
+ "attachRefused": false,
2498
+ "closeRefused": false,
2499
2499
  "closed": true,
2500
2500
  "stickyError": true,
2501
2501
  "attachRedacted": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.49.0",
3
+ "version": "1.51.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",
@@ -26,6 +26,8 @@
26
26
  "./catalog.json": "./catalog.json",
27
27
  "./corpus.json": "./corpus.json",
28
28
  "./protected.json": "./protected.json",
29
+ "./engine-vectors.json": "./engine-vectors.json",
30
+ "./schema/engine-vectors.schema.json": "./schema/engine-vectors.schema.json",
29
31
  "./debugger-stage1.json": "./debugger-stage1.json",
30
32
  "./protected.mjs": "./protected.mjs",
31
33
  "./engine": "./engine.mjs",
@@ -51,6 +53,7 @@
51
53
  "catalog.json",
52
54
  "corpus.json",
53
55
  "protected.json",
56
+ "engine-vectors.json",
54
57
  "debugger-stage1.json",
55
58
  "protected.mjs",
56
59
  "engine.mjs",
@@ -86,7 +89,7 @@
86
89
  "validate": "node scripts/validate.mjs",
87
90
  "lint": "export PATH=\"$HOME/.cargo/bin:$PATH\" && if [ \"$(uname -s)\" = Darwin ]; then echo 'Skipping byte comparison on macOS; Linux CI owns the wasm bytes.'; else git ls-files --error-unmatch engine/engine.wasm engine/engine-wasm.mjs > /dev/null && npm run engine && git diff --exit-code -- engine/engine.wasm engine/engine-wasm.mjs protected.mjs; fi && node scripts/protected-bundle.mjs --check && 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 --all --check && cargo clippy --workspace --locked --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features --locked && cargo check --target wasm32-wasip1 --features serde --locked && cargo check --target wasm32-wasip1 --all-features --locked",
88
91
  "format": "biome check --write . && gofmt -w . && cargo fmt --all",
89
- "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/protected-zones.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.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-redirect-through.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-trusted-emulation.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-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-ordinary-idp-cookies.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/engine.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.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-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-cookie-plant-deletion.test.mjs test/integration/guard-cookie-plant-attach.test.mjs test/integration/guard-cookie-plant-attach-retry.test.mjs test/integration/guard-cookie-plant-open-commit.test.mjs test/integration/guard-cookie-plant-legacy-setup.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-error-page-enable.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-bfcache-ownership-probe.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-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-key.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-raw-cdp.test.mjs test/integration/guard-error-legs.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-preview.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs test/integration/guard-browser-storage.test.mjs test/integration/guard-control-premises.test.mjs test/integration/guard-control-probe-failure.test.mjs test/integration/guard-kept-origins.test.mjs",
92
+ "test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/protected-zones.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.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-redirect-through.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-trusted-emulation.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-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-ordinary-idp-cookies.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/engine.test.mjs test/integration/engine-page.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.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-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-cookie-plant-deletion.test.mjs test/integration/guard-cookie-plant-attach.test.mjs test/integration/guard-cookie-plant-attach-retry.test.mjs test/integration/guard-cookie-plant-open-commit.test.mjs test/integration/guard-cookie-plant-legacy-setup.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-error-page-enable.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-bfcache-ownership-probe.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-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-key.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-raw-cdp.test.mjs test/integration/guard-error-legs.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-preview.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs test/integration/guard-browser-storage.test.mjs test/integration/guard-control-premises.test.mjs test/integration/guard-control-probe-failure.test.mjs test/integration/guard-kept-origins.test.mjs",
90
93
  "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 ./...",
91
94
  "build": "export PATH=\"$HOME/.cargo/bin:$PATH\" && go build ./... && cargo build --locked --all-features && cargo build --locked --target wasm32-wasip1 --all-features && npm pack --dry-run",
92
95
  "prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
@@ -100,6 +100,16 @@ async function framedEvaluate(reader, sessionId, pageUrl, budget, sessions) {
100
100
  );
101
101
  const iframeSession = attached.result.sessionId;
102
102
  sessions.push(iframeSession);
103
+ await reader.send(
104
+ 'Target.setAutoAttach',
105
+ {
106
+ autoAttach: true,
107
+ waitForDebuggerOnStart: false,
108
+ flatten: true,
109
+ filter: [{ type: 'worker' }, { exclude: true }],
110
+ },
111
+ iframeSession
112
+ );
103
113
  await outcome(reader.send('Runtime.runIfWaitingForDebugger', {}, iframeSession));
104
114
  await outcome(reader.send('Page.enable', {}, iframeSession));
105
115
  await outcome(reader.send('Runtime.enable', {}, iframeSession));