@ai-ecoverse/slicc-browsers 1.30.1 → 1.30.2
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/extension-frame.mjs +78 -18
- package/guard-vectors.json +1 -1
- package/package.json +2 -2
package/extension-frame.mjs
CHANGED
|
@@ -141,11 +141,53 @@ async function clickAt(client, _reader, session, _observer, x, y) {
|
|
|
141
141
|
return { out: down.ok ? up : down, ok: down.ok && up.ok };
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
const CLICK_MS = 1000;
|
|
145
|
+
const CLICK_ARM = `(() => {
|
|
146
|
+
delete document.body.dataset.clicked;
|
|
147
|
+
const target = document.getElementById("c9-click") ?? document;
|
|
148
|
+
globalThis.__sliccC9Click = new Promise((resolve) =>
|
|
149
|
+
target.addEventListener("click", () => resolve(true), { once: true })
|
|
150
|
+
);
|
|
151
|
+
return true;
|
|
152
|
+
})()`;
|
|
153
|
+
const CLICK_WAIT = `Promise.race([
|
|
154
|
+
globalThis.__sliccC9Click ?? Promise.resolve(false),
|
|
155
|
+
new Promise((resolve) => setTimeout(resolve, ${CLICK_MS}, false)),
|
|
156
|
+
]).then((hit) => hit === true || document.body.dataset.clicked === "yes")`;
|
|
157
|
+
|
|
158
|
+
async function click(client, reader, session, observer, { side, missing, name = 'click' } = {}) {
|
|
159
|
+
await observe(reader, observer, CLICK_ARM);
|
|
146
160
|
const pressed = await clickAt(client, reader, session, observer, 20, 20);
|
|
147
|
-
const
|
|
148
|
-
|
|
161
|
+
const measured = side === 'control' && Array.isArray(missing);
|
|
162
|
+
if (!pressed.ok) {
|
|
163
|
+
if (!measured || protectedRefusal(pressed.out)) return { out: pressed.out, ok: false };
|
|
164
|
+
missing.push(`${name}: ${refusal(pressed.out) || 'transport error'}`);
|
|
165
|
+
return { out: pressed.out, ok: 'incomplete' };
|
|
166
|
+
}
|
|
167
|
+
let timer;
|
|
168
|
+
const waited = await Promise.race([
|
|
169
|
+
outcome(
|
|
170
|
+
reader.send(
|
|
171
|
+
'Runtime.evaluate',
|
|
172
|
+
{ expression: CLICK_WAIT, awaitPromise: true, returnByValue: true },
|
|
173
|
+
observer
|
|
174
|
+
)
|
|
175
|
+
),
|
|
176
|
+
new Promise((resolve) => {
|
|
177
|
+
timer = setTimeout(resolve, CLICK_MS * 2, null);
|
|
178
|
+
}),
|
|
179
|
+
]).finally(() => clearTimeout(timer));
|
|
180
|
+
if (waited?.ok && !waited.result.exceptionDetails && waited.result.result?.value === true)
|
|
181
|
+
return { out: pressed.out, ok: true };
|
|
182
|
+
if (!measured) return { out: pressed.out, ok: false };
|
|
183
|
+
const why =
|
|
184
|
+
waited == null
|
|
185
|
+
? 'no answer'
|
|
186
|
+
: !waited.ok
|
|
187
|
+
? refusal(waited)
|
|
188
|
+
: (waited.result.exceptionDetails?.text ?? `not delivered within ${CLICK_MS}ms`);
|
|
189
|
+
missing.push(`${name}: ${why}`);
|
|
190
|
+
return { out: pressed.out, ok: 'incomplete' };
|
|
149
191
|
}
|
|
150
192
|
|
|
151
193
|
async function key(client, reader, session, observer, beforeSend, requireTyped = true) {
|
|
@@ -835,7 +877,14 @@ async function driveInput(client, reader, page, observer, inputList, mode, frame
|
|
|
835
877
|
const f = ${frameLookup};
|
|
836
878
|
if (!f) return null;
|
|
837
879
|
const r = f.getBoundingClientRect();
|
|
838
|
-
|
|
880
|
+
let left = r.left;
|
|
881
|
+
let top = r.top;
|
|
882
|
+
for (let w = f.ownerDocument?.defaultView; w && w !== window && w.frameElement; w = w.parent) {
|
|
883
|
+
const o = w.frameElement.getBoundingClientRect();
|
|
884
|
+
left += o.left + w.frameElement.clientLeft;
|
|
885
|
+
top += o.top + w.frameElement.clientTop;
|
|
886
|
+
}
|
|
887
|
+
return { x: left + r.width / 2, y: top + r.height / 2, w: r.width, h: r.height };
|
|
839
888
|
})()`
|
|
840
889
|
);
|
|
841
890
|
const point = clearPoint(box);
|
|
@@ -858,11 +907,7 @@ async function driveInput(client, reader, page, observer, inputList, mode, frame
|
|
|
858
907
|
box && box.h > 0 ? box.y : 10
|
|
859
908
|
);
|
|
860
909
|
await refocus();
|
|
861
|
-
const
|
|
862
|
-
client.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Tab', code: 'Tab' }, page)
|
|
863
|
-
);
|
|
864
|
-
await refocus();
|
|
865
|
-
const pressed = await click(client, reader, page, observer);
|
|
910
|
+
const pressed = await click(client, reader, page, observer, { side, missing });
|
|
866
911
|
await refocus();
|
|
867
912
|
const typed = await key(client, reader, page, observer, refocus, mode !== 'focused');
|
|
868
913
|
await refocus();
|
|
@@ -878,6 +923,10 @@ async function driveInput(client, reader, page, observer, inputList, mode, frame
|
|
|
878
923
|
mode
|
|
879
924
|
);
|
|
880
925
|
await refocus();
|
|
926
|
+
const tab = await outcome(
|
|
927
|
+
client.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Tab', code: 'Tab' }, page)
|
|
928
|
+
);
|
|
929
|
+
await refocus();
|
|
881
930
|
const focusedKey = await outcome(
|
|
882
931
|
client.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'a', code: 'KeyA' }, page)
|
|
883
932
|
);
|
|
@@ -1350,9 +1399,15 @@ async function finishReveal(
|
|
|
1350
1399
|
page,
|
|
1351
1400
|
observer,
|
|
1352
1401
|
frameMs,
|
|
1353
|
-
{ ok, text, overlap, revealRacePass }
|
|
1402
|
+
{ ok, text, overlap, revealRacePass },
|
|
1403
|
+
side,
|
|
1404
|
+
missing
|
|
1354
1405
|
) {
|
|
1355
|
-
const revealedPress = await click(client, reader, page, observer
|
|
1406
|
+
const revealedPress = await click(client, reader, page, observer, {
|
|
1407
|
+
side,
|
|
1408
|
+
missing,
|
|
1409
|
+
name: 'revealedClick',
|
|
1410
|
+
});
|
|
1356
1411
|
await style(reader, observer, 'hidden', frameMs);
|
|
1357
1412
|
const rehidden = await shot(client, page);
|
|
1358
1413
|
return {
|
|
@@ -1412,15 +1467,20 @@ export async function driveReveal(client, reader, page, observer, frameMs, missi
|
|
|
1412
1467
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1413
1468
|
last = await attemptRevealCapture(client, reader, page, observer, side);
|
|
1414
1469
|
if (last.overlap !== 'unknown')
|
|
1415
|
-
return finishReveal(client, reader, page, observer, frameMs, last);
|
|
1470
|
+
return finishReveal(client, reader, page, observer, frameMs, last, side, missing);
|
|
1416
1471
|
if (attempt < maxAttempts) await style(reader, observer, 'hidden', frameMs);
|
|
1417
1472
|
}
|
|
1418
1473
|
missing.push(`reveal/capture overlap unproven (${maxAttempts} attempts)`);
|
|
1419
|
-
return finishReveal(
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1474
|
+
return finishReveal(
|
|
1475
|
+
client,
|
|
1476
|
+
reader,
|
|
1477
|
+
page,
|
|
1478
|
+
observer,
|
|
1479
|
+
frameMs,
|
|
1480
|
+
{ ...last, overlap: 'unknown', revealRacePass: false },
|
|
1481
|
+
side,
|
|
1482
|
+
missing
|
|
1483
|
+
);
|
|
1424
1484
|
}
|
|
1425
1485
|
|
|
1426
1486
|
function frameObservations({ pageAttached, origin, read, leaks, picture, input, captures }) {
|
package/guard-vectors.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.2",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"validate": "node scripts/validate.mjs",
|
|
80
80
|
"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",
|
|
81
81
|
"format": "biome check --write . && gofmt -w . && cargo fmt",
|
|
82
|
-
"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/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-credential-export.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/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-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-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.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-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-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-idp.test.mjs test/integration/guard-sweep-others.test.mjs",
|
|
82
|
+
"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/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-credential-export.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/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-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-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-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.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-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-idp.test.mjs test/integration/guard-sweep-others.test.mjs",
|
|
83
83
|
"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 ./...",
|
|
84
84
|
"build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
85
85
|
"prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
|