@ai-ecoverse/slicc-browsers 1.28.3 → 1.28.4
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/guard-vectors.json +1 -1
- package/package.json +3 -3
- package/sign-in-hold.mjs +48 -13
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.28.
|
|
3
|
+
"version": "1.28.4",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"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"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@ai-ecoverse/slicc-cdp": "2.1.
|
|
93
|
-
"@ai-ecoverse/slicc-shared-web": "2.16.
|
|
92
|
+
"@ai-ecoverse/slicc-cdp": "2.1.4",
|
|
93
|
+
"@ai-ecoverse/slicc-shared-web": "2.16.1",
|
|
94
94
|
"@biomejs/biome": "2.6.7",
|
|
95
95
|
"ajv": "8.20.0",
|
|
96
96
|
"ajv-formats": "3.0.1",
|
package/sign-in-hold.mjs
CHANGED
|
@@ -516,6 +516,44 @@ function matchPopup(info, known, openerId, heldUrl, control) {
|
|
|
516
516
|
return url === heldUrl || url.startsWith('about:blank#') || url.includes('/held');
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
+
function exactPopups(infos, known, openerId, markerUrl) {
|
|
520
|
+
return infos.filter(
|
|
521
|
+
(info) =>
|
|
522
|
+
info.type === 'page' &&
|
|
523
|
+
!known.has(info.targetId) &&
|
|
524
|
+
info.url === markerUrl &&
|
|
525
|
+
info.openerId === openerId
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
async function askedPopup(reader, { known, openerId, markerUrl, budget, notes }) {
|
|
530
|
+
let matched = 0;
|
|
531
|
+
let failed = null;
|
|
532
|
+
const popup = await until(async () => {
|
|
533
|
+
const listed = await outcome(reader.send('Target.getTargets', {}));
|
|
534
|
+
if (!listed.ok) {
|
|
535
|
+
failed = String(listed.error?.message ?? listed.error);
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
failed = null;
|
|
539
|
+
const found = exactPopups(listed.result?.targetInfos ?? [], known, openerId, markerUrl);
|
|
540
|
+
matched = found.length;
|
|
541
|
+
return matched === 1 ? found[0] : null;
|
|
542
|
+
}, budget);
|
|
543
|
+
note(notes, 'sign-in-hold.ask-cleanup', {
|
|
544
|
+
markerUrl,
|
|
545
|
+
openerId,
|
|
546
|
+
matched,
|
|
547
|
+
failed,
|
|
548
|
+
targetId: popup?.targetId ?? null,
|
|
549
|
+
});
|
|
550
|
+
if (popup) return { popup };
|
|
551
|
+
const why = failed
|
|
552
|
+
? `Target.getTargets failed: ${failed}`
|
|
553
|
+
: `${matched} page targets at ${markerUrl} opened by ${openerId}`;
|
|
554
|
+
return { reason: `popup not identified exactly (${why}), nothing closed` };
|
|
555
|
+
}
|
|
556
|
+
|
|
519
557
|
async function moveHeldPopup(reader, raw, heldUrl, budget, internalSessions) {
|
|
520
558
|
if (raw.url === heldUrl) return raw;
|
|
521
559
|
const attached = await outcome(
|
|
@@ -591,23 +629,20 @@ async function heldPopup({
|
|
|
591
629
|
notes,
|
|
592
630
|
});
|
|
593
631
|
if (askedHold.incomplete) {
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
},
|
|
604
|
-
Math.min(budget, 1000)
|
|
605
|
-
);
|
|
632
|
+
const found = await askedPopup(reader, {
|
|
633
|
+
known,
|
|
634
|
+
openerId,
|
|
635
|
+
markerUrl: `about:blank#${MARK_PREFIX}${marker}`,
|
|
636
|
+
budget: Math.min(budget, 1000),
|
|
637
|
+
notes,
|
|
638
|
+
});
|
|
639
|
+
if (!found.popup)
|
|
640
|
+
return { live: false, incomplete: `${askedHold.incomplete}; ${found.reason}` };
|
|
606
641
|
return {
|
|
607
642
|
live: false,
|
|
608
643
|
incomplete: askedHold.incomplete,
|
|
609
644
|
openerId,
|
|
610
|
-
|
|
645
|
+
targetId: found.popup.targetId,
|
|
611
646
|
};
|
|
612
647
|
}
|
|
613
648
|
holdAnswer = askedHold.answer;
|