@ai-ecoverse/slicc-browsers 1.34.0 → 1.35.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/README.md +2 -2
- package/guard-vectors.json +1 -1
- package/package.json +1 -1
- 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/guard-vectors.json
CHANGED
package/package.json
CHANGED
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 {
|