@ai-ecoverse/slicc-browsers 1.34.0 → 1.35.1
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/README.md +2 -2
- package/cookie-plant.mjs +56 -2
- package/guard-vectors.json +1 -1
- package/package.json +3 -3
- package/sign-in-hold.mjs +31 -7
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ Everything except `./fixture` runs in a browser as well as in Node. `protected.m
|
|
|
93
93
|
|
|
94
94
|
`catalog.json` holds everything a program needs to know about browsers:
|
|
95
95
|
|
|
96
|
-
- **Browsers.** Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, **in priority order**.
|
|
96
|
+
- **Browsers.** Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, **in priority order**.
|
|
97
97
|
- **Electron apps**: known apps by bundle id, and the ones that block remote debugging.
|
|
98
98
|
- **Ranking**: endpoints with a seven tab come first, then other running endpoints, then installed Chrome, other installed Chromium browsers, Electron apps, and SLICC six's profile last. Browsers older than Chromium 116 are left out.
|
|
99
99
|
- **Discovery**: `DevToolsActivePort` files, the ports to probe, the process scan, and how endpoints are named, normalized and merged.
|
|
@@ -249,7 +249,7 @@ You supply:
|
|
|
249
249
|
| `jsonList` | expose `/json/list` (`client.jsonList` / `devtoolsHttp`); missing → not-supported, or incomplete if declared |
|
|
250
250
|
| `requestInterception`, `fetchInterception`, `legacyInterception` | response interception |
|
|
251
251
|
|
|
252
|
-
`signInHold` may implement `client.signInHold.ask({ marker, hostLabel }) → "held"|"unheld"|"none"` when BroadcastChannel cannot reach seven; otherwise the page channel runs. The raw observer waits for a committed document, then reads the fixture mark.
|
|
252
|
+
`signInHold` may implement `client.signInHold.ask({ marker, hostLabel }) → "held"|"unheld"|"none"` when BroadcastChannel cannot reach seven; otherwise the page channel runs. With `ask`, an optional `prepare({ marker, hostLabel })` runs on the guarded leg before the popup opens, and `ask`, after the open, gets its result as `baseline`; if `prepare` throws or stalls, the row is incomplete. The raw observer waits for a committed document, then reads the fixture mark.
|
|
253
253
|
|
|
254
254
|
### Reading the result
|
|
255
255
|
|
package/cookie-plant.mjs
CHANGED
|
@@ -915,6 +915,38 @@ function plantedOf(jar) {
|
|
|
915
915
|
return true;
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
+
const clearMissed = 'the deleted cookie was still in the jar when the re-read bound ran out';
|
|
919
|
+
|
|
920
|
+
function clearSettle(budget) {
|
|
921
|
+
const ms = Number(budget);
|
|
922
|
+
const scale = Number.isFinite(ms) && ms > 0 ? Math.min(ms / 5000, 1) : 0.1;
|
|
923
|
+
return { boundMs: Math.round(2000 * scale), stepMs: Math.max(Math.round(250 * scale), 10) };
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
async function settleCleared(handle, cookie, first, budget) {
|
|
927
|
+
const { boundMs, stepMs } = clearSettle(budget);
|
|
928
|
+
const startedAt = Date.now();
|
|
929
|
+
const state = { jar: first, tries: 1, done: false };
|
|
930
|
+
const reread = async () => {
|
|
931
|
+
const jar = await readJarWithCanary(handle, cookie);
|
|
932
|
+
if (state.done) return true;
|
|
933
|
+
state.jar = jar;
|
|
934
|
+
state.tries += 1;
|
|
935
|
+
return plantedOf(jar) !== true;
|
|
936
|
+
};
|
|
937
|
+
if (plantedOf(first) === true) await waitFor(reread, boundMs, stepMs, true);
|
|
938
|
+
state.done = true;
|
|
939
|
+
return {
|
|
940
|
+
jar: state.jar,
|
|
941
|
+
settle: {
|
|
942
|
+
tries: state.tries,
|
|
943
|
+
settleElapsedMs: Date.now() - startedAt,
|
|
944
|
+
settleBoundMs: boundMs,
|
|
945
|
+
settleStepMs: stepMs,
|
|
946
|
+
},
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
|
|
918
950
|
async function triggerFetch(client, sessionId, url) {
|
|
919
951
|
return outcome(
|
|
920
952
|
client.send(
|
|
@@ -3741,26 +3773,45 @@ function controlAttacks(ctx) {
|
|
|
3741
3773
|
});
|
|
3742
3774
|
return { ...attempt, cleared: 'incomplete' };
|
|
3743
3775
|
}
|
|
3744
|
-
const
|
|
3776
|
+
const deleted = {
|
|
3745
3777
|
name: ctx.names.delete,
|
|
3746
3778
|
domain: deleteOnOrdinary.domain,
|
|
3747
3779
|
path: deleteOnOrdinary.path,
|
|
3748
|
-
}
|
|
3780
|
+
};
|
|
3781
|
+
const first = await readJarWithCanary(handle, deleted);
|
|
3782
|
+
const { jar: after, settle } = await settleCleared(handle, deleted, first, ctx.budget);
|
|
3749
3783
|
const afterPlanted = plantedOf(after);
|
|
3750
3784
|
if (afterPlanted === 'incomplete') {
|
|
3751
3785
|
note(ctx.notes, 'cookie-plant.deletion.cleared', {
|
|
3752
3786
|
cleared: 'incomplete',
|
|
3753
3787
|
incomplete: 'after jar unreadable',
|
|
3754
3788
|
...jarAuditFields(handle, after),
|
|
3789
|
+
...settle,
|
|
3755
3790
|
...timingOf(handle),
|
|
3756
3791
|
});
|
|
3757
3792
|
return { ...attempt, cleared: 'incomplete' };
|
|
3758
3793
|
}
|
|
3794
|
+
if (afterPlanted === true && ctx.control) {
|
|
3795
|
+
note(ctx.notes, 'cookie-plant.deletion.cleared', {
|
|
3796
|
+
cleared: 'incomplete',
|
|
3797
|
+
incomplete: clearMissed,
|
|
3798
|
+
seedVia: seeded?.via,
|
|
3799
|
+
...jarAuditFields(handle, after),
|
|
3800
|
+
...settle,
|
|
3801
|
+
...timingOf(handle),
|
|
3802
|
+
});
|
|
3803
|
+
return {
|
|
3804
|
+
...attempt,
|
|
3805
|
+
cleared: 'incomplete',
|
|
3806
|
+
premiseMissed: `deletionCleared: ${clearMissed}`,
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3759
3809
|
const cleared = afterPlanted === false;
|
|
3760
3810
|
note(ctx.notes, 'cookie-plant.deletion.cleared', {
|
|
3761
3811
|
cleared,
|
|
3762
3812
|
seedVia: seeded?.via,
|
|
3763
3813
|
...jarAuditFields(handle, after),
|
|
3814
|
+
...settle,
|
|
3764
3815
|
...timingOf(handle),
|
|
3765
3816
|
});
|
|
3766
3817
|
return { ...attempt, cleared };
|
|
@@ -4347,6 +4398,7 @@ export async function cookiePlant({
|
|
|
4347
4398
|
legStartedAt: Date.now(),
|
|
4348
4399
|
firstIncomplete: { noted: false },
|
|
4349
4400
|
guardedProtected: !control && !credential,
|
|
4401
|
+
control: Boolean(control),
|
|
4350
4402
|
blockedMarkers: Array.isArray(blockedMarkers) ? blockedMarkers : [],
|
|
4351
4403
|
proofTag: tag,
|
|
4352
4404
|
rawDoors: {},
|
|
@@ -4399,6 +4451,7 @@ function doorPremiseMissed(door) {
|
|
|
4399
4451
|
}
|
|
4400
4452
|
|
|
4401
4453
|
function finishCookiePlant({ control, credential, fetch, legacy, evidenceIncomplete, results }) {
|
|
4454
|
+
const skips = Object.values(results).flatMap((attempt) => attempt?.premiseMissed ?? []);
|
|
4402
4455
|
return Object.assign(
|
|
4403
4456
|
{
|
|
4404
4457
|
live: true,
|
|
@@ -4409,6 +4462,7 @@ function finishCookiePlant({ control, credential, fetch, legacy, evidenceIncompl
|
|
|
4409
4462
|
...(evidenceIncomplete && !control
|
|
4410
4463
|
? { incomplete: 'protected plant evidence incomplete' }
|
|
4411
4464
|
: {}),
|
|
4465
|
+
...(skips.length ? { skips } : {}),
|
|
4412
4466
|
},
|
|
4413
4467
|
...Object.entries(results).map(([name, attempt]) => flattenAttempt(name, attempt))
|
|
4414
4468
|
);
|
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.
|
|
3
|
+
"version": "1.35.1",
|
|
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-cookie-plant-raw-leg.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-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-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 test/integration/guard-control-premises.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-cookie-plant-raw-leg.test.mjs test/integration/guard-cookie-plant-deletion.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-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-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 test/integration/guard-control-premises.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\"",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"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=extension-frame.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=protected-parent-iframes.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"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@ai-ecoverse/slicc-cdp": "2.1.
|
|
93
|
+
"@ai-ecoverse/slicc-cdp": "2.1.19",
|
|
94
94
|
"@ai-ecoverse/slicc-shared-web": "2.17.0",
|
|
95
95
|
"@biomejs/biome": "2.6.8",
|
|
96
96
|
"ajv": "8.20.0",
|
package/sign-in-hold.mjs
CHANGED
|
@@ -477,14 +477,38 @@ function hostLabelOf(origin) {
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
async function
|
|
480
|
+
async function prepareHold(client, { useAsk, marker, hostLabel, notes, budget }) {
|
|
481
|
+
const hold = client?.signInHold;
|
|
482
|
+
if (!useAsk || typeof hold.prepare !== 'function') return undefined;
|
|
483
|
+
note(notes, 'sign-in-hold.prepare', { via: 'signInHold.prepare', marker, hostLabel });
|
|
484
|
+
const ms = Math.min(budget, 6000);
|
|
485
|
+
let timer;
|
|
486
|
+
try {
|
|
487
|
+
const baseline = await Promise.race([
|
|
488
|
+
Promise.resolve(hold.prepare({ marker, hostLabel })),
|
|
489
|
+
new Promise((_, reject) => {
|
|
490
|
+
timer = setTimeout(() => reject(new Error(`timed out after ${ms}ms`)), ms);
|
|
491
|
+
}),
|
|
492
|
+
]);
|
|
493
|
+
return { baseline };
|
|
494
|
+
} catch (error) {
|
|
495
|
+
return { incomplete: `signInHold.prepare: ${error?.message ?? error}` };
|
|
496
|
+
} finally {
|
|
497
|
+
if (timer) clearTimeout(timer);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async function askHold(client, { marker, hostLabel, notes, prepared }) {
|
|
481
502
|
const hold = client?.signInHold;
|
|
482
503
|
if (typeof hold?.ask !== 'function') return { used: false };
|
|
483
504
|
note(notes, 'sign-in-hold.ask', { via: 'signInHold.ask', marker, hostLabel });
|
|
505
|
+
const asked = prepared
|
|
506
|
+
? { marker, hostLabel, baseline: prepared.baseline }
|
|
507
|
+
: { marker, hostLabel };
|
|
484
508
|
let timer;
|
|
485
509
|
try {
|
|
486
510
|
const answer = await Promise.race([
|
|
487
|
-
Promise.resolve(hold.ask(
|
|
511
|
+
Promise.resolve(hold.ask(asked)),
|
|
488
512
|
new Promise((_, reject) => {
|
|
489
513
|
timer = setTimeout(() => {
|
|
490
514
|
const error = new Error('signInHold.ask timed out');
|
|
@@ -602,6 +626,9 @@ async function heldPopup({
|
|
|
602
626
|
const before = await outcome(reader.send('Target.getTargets', {}));
|
|
603
627
|
const known = new Set((before.result?.targetInfos ?? []).map((info) => info.targetId));
|
|
604
628
|
const useAsk = !control && typeof client?.signInHold?.ask === 'function';
|
|
629
|
+
const hostLabel = hostLabelOf(openerOrigin ?? ordinary);
|
|
630
|
+
const prepared = await prepareHold(client, { useAsk, marker, hostLabel, notes, budget });
|
|
631
|
+
if (prepared?.incomplete) return { incomplete: prepared.incomplete, openerId };
|
|
605
632
|
const asked = await outcome(
|
|
606
633
|
reader.send(
|
|
607
634
|
'Runtime.evaluate',
|
|
@@ -623,11 +650,7 @@ async function heldPopup({
|
|
|
623
650
|
let holdAnswer = asked.result?.result?.value?.answer ?? 'missing';
|
|
624
651
|
const openedPopup = asked.result?.result?.value?.opened;
|
|
625
652
|
if (useAsk) {
|
|
626
|
-
const askedHold = await askHold(client, {
|
|
627
|
-
marker,
|
|
628
|
-
hostLabel: hostLabelOf(openerOrigin ?? ordinary),
|
|
629
|
-
notes,
|
|
630
|
-
});
|
|
653
|
+
const askedHold = await askHold(client, { marker, hostLabel, notes, prepared });
|
|
631
654
|
if (askedHold.incomplete) {
|
|
632
655
|
const found = await askedPopup(reader, {
|
|
633
656
|
known,
|
|
@@ -652,6 +675,7 @@ async function heldPopup({
|
|
|
652
675
|
control: Boolean(control),
|
|
653
676
|
opened: openedPopup,
|
|
654
677
|
askHook: useAsk,
|
|
678
|
+
...(prepared ? { prepared: true } : {}),
|
|
655
679
|
});
|
|
656
680
|
if (openedPopup === false)
|
|
657
681
|
return {
|