@ai-ecoverse/slicc-browsers 1.25.0 → 1.26.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 +1 -0
- package/fixture-server.mjs +11 -0
- package/guard-runner.mjs +30 -1
- package/guard-vectors.json +561 -5
- package/package.json +3 -2
- package/protected-parent-iframes.mjs +370 -88
- package/schema/guard-vectors.schema.json +28 -1
- package/sign-in-hold.mjs +703 -0
|
@@ -681,11 +681,103 @@ function liveNestPlan(pageUrl, innerKind, innerHint) {
|
|
|
681
681
|
page.searchParams.set('live', '1');
|
|
682
682
|
return {
|
|
683
683
|
liveUrl: page.toString(),
|
|
684
|
+
midUrl: midRaw,
|
|
684
685
|
innerHint: innerHint || (innerKind === 'srcdoc' ? 'about:srcdoc' : ''),
|
|
685
686
|
midNeedle,
|
|
686
687
|
};
|
|
687
688
|
}
|
|
688
689
|
|
|
690
|
+
function sameSiteOrigin(left, right) {
|
|
691
|
+
try {
|
|
692
|
+
return Boolean(left && right && new URL(left).origin === new URL(right).origin);
|
|
693
|
+
} catch {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
function midUrlMatch(candidate, midUrls) {
|
|
699
|
+
if (!candidate) return false;
|
|
700
|
+
for (const mid of midUrls ?? []) {
|
|
701
|
+
if (!mid) continue;
|
|
702
|
+
if (candidate === mid) return true;
|
|
703
|
+
try {
|
|
704
|
+
const a = new URL(candidate);
|
|
705
|
+
const b = new URL(mid);
|
|
706
|
+
if (a.origin === b.origin && a.pathname === b.pathname) return true;
|
|
707
|
+
} catch {
|
|
708
|
+
if (candidate.startsWith(mid) || mid.startsWith(candidate)) return true;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function blockedNetworkFail(event, network) {
|
|
715
|
+
const url = network.get(event.params?.requestId);
|
|
716
|
+
if (
|
|
717
|
+
!url ||
|
|
718
|
+
!(event.params?.blockedReason || event.params?.errorText === 'net::ERR_BLOCKED_BY_CLIENT')
|
|
719
|
+
)
|
|
720
|
+
return null;
|
|
721
|
+
return {
|
|
722
|
+
url,
|
|
723
|
+
errorText: event.params?.errorText ?? null,
|
|
724
|
+
blockedReason: event.params?.blockedReason ?? null,
|
|
725
|
+
via: 'Network.loadingFailed',
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function blockedFetchFail(event, fetchDocs) {
|
|
730
|
+
const url = fetchDocs.get(event.params?.requestId);
|
|
731
|
+
if (!url || (event.params?.errorReason && event.params.errorReason !== 'BlockedByClient'))
|
|
732
|
+
return null;
|
|
733
|
+
return {
|
|
734
|
+
url,
|
|
735
|
+
errorText: event.params?.errorReason ?? 'BlockedByClient',
|
|
736
|
+
blockedReason: 'Fetch',
|
|
737
|
+
via: 'Fetch.failRequest',
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function trackMidDocument(event, midUrls, network, fetchDocs) {
|
|
742
|
+
if (event.method === 'Network.requestWillBeSent') {
|
|
743
|
+
const url = event.params?.request?.url;
|
|
744
|
+
if (event.params?.type === 'Document' && midUrlMatch(url, midUrls))
|
|
745
|
+
network.set(event.params.requestId, url);
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
if (event.method === 'Fetch.requestPaused') {
|
|
749
|
+
const url = event.params?.request?.url;
|
|
750
|
+
if (event.params?.resourceType === 'Document' && midUrlMatch(url, midUrls))
|
|
751
|
+
fetchDocs.set(event.params.requestId, url);
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
if (event.method === 'Network.loadingFailed') return blockedNetworkFail(event, network);
|
|
755
|
+
if (event.method === 'Fetch.failRequest') return blockedFetchFail(event, fetchDocs);
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function liveMidBlocked(events, from, midUrls) {
|
|
760
|
+
if (!midUrls?.length) return null;
|
|
761
|
+
const network = new Map();
|
|
762
|
+
const fetchDocs = new Map();
|
|
763
|
+
for (const event of (events ?? []).slice(from)) {
|
|
764
|
+
const hit = trackMidDocument(event, midUrls, network, fetchDocs);
|
|
765
|
+
if (hit) return hit;
|
|
766
|
+
}
|
|
767
|
+
return null;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function liveMissingReason(pageUrl, midHint, raw) {
|
|
771
|
+
if (!raw.midTargetId && midHint && sameSiteOrigin(pageUrl, midHint))
|
|
772
|
+
return "grandchild missing in raw leg after post-attach navigation: mid host is same-site with {ordinary} (no mid target); seven's host should be cross-site from {ordinary} like {cross}";
|
|
773
|
+
return 'grandchild missing in raw leg after post-attach navigation';
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
async function armReaderNetwork(reader, sessionIds) {
|
|
777
|
+
for (const sessionId of [...new Set((sessionIds ?? []).filter(Boolean))])
|
|
778
|
+
await outcome(reader.send('Network.enable', {}, sessionId));
|
|
779
|
+
}
|
|
780
|
+
|
|
689
781
|
function stampedMidLive(midUrl, innerKind, innerHint) {
|
|
690
782
|
const stamp = `live-${Date.now().toString(36)}`;
|
|
691
783
|
try {
|
|
@@ -727,9 +819,12 @@ async function waitChildUnderMid(
|
|
|
727
819
|
budget,
|
|
728
820
|
internalSessions,
|
|
729
821
|
beforeIds,
|
|
730
|
-
midNeedle = null
|
|
822
|
+
midNeedle = null,
|
|
823
|
+
blockCheck = null
|
|
731
824
|
) {
|
|
732
825
|
return until(async () => {
|
|
826
|
+
const blocked = blockCheck?.();
|
|
827
|
+
if (blocked) return { blocked };
|
|
733
828
|
return hitFromGrandchildTarget(
|
|
734
829
|
reader,
|
|
735
830
|
midAttached,
|
|
@@ -999,11 +1094,14 @@ async function waitGrandchild(
|
|
|
999
1094
|
pageId,
|
|
1000
1095
|
internalSessions,
|
|
1001
1096
|
midNeedle = null,
|
|
1002
|
-
beforeIds = null
|
|
1097
|
+
beforeIds = null,
|
|
1098
|
+
blockCheck = null
|
|
1003
1099
|
) {
|
|
1004
1100
|
let midAttached;
|
|
1005
1101
|
await outcome(reader.send('Target.setDiscoverTargets', { discover: true }));
|
|
1006
1102
|
const found = await until(async () => {
|
|
1103
|
+
const blocked = blockCheck?.();
|
|
1104
|
+
if (blocked) return { blocked };
|
|
1007
1105
|
const tree = await readTree(reader, sessionId);
|
|
1008
1106
|
const hit = findGrandchild(tree, midHint, innerHint);
|
|
1009
1107
|
if (hit) return { tree, hit, via: 'top' };
|
|
@@ -1042,6 +1140,7 @@ async function waitGrandchild(
|
|
|
1042
1140
|
midNeedle
|
|
1043
1141
|
);
|
|
1044
1142
|
}, budget);
|
|
1143
|
+
if (found?.blocked) return found;
|
|
1045
1144
|
if (found) {
|
|
1046
1145
|
const branch =
|
|
1047
1146
|
found.via === 'top'
|
|
@@ -1505,6 +1604,8 @@ async function liveViaMidSession({
|
|
|
1505
1604
|
internalSessions,
|
|
1506
1605
|
beforeIds,
|
|
1507
1606
|
preferMidLive,
|
|
1607
|
+
eventStart,
|
|
1608
|
+
midUrls,
|
|
1508
1609
|
}) {
|
|
1509
1610
|
if (!preferMidLive || !raw.midTargetId) return null;
|
|
1510
1611
|
const midAttached = await attachIframeTarget(
|
|
@@ -1519,6 +1620,8 @@ async function liveViaMidSession({
|
|
|
1519
1620
|
innerKind ?? (innerHint === 'about:srcdoc' ? 'srcdoc' : 'ordinary'),
|
|
1520
1621
|
innerHint
|
|
1521
1622
|
);
|
|
1623
|
+
midUrls.push(stamp.midUrl);
|
|
1624
|
+
await armReaderNetwork(reader, [midAttached.sessionId]);
|
|
1522
1625
|
note(notes, 'protected-parent.page-live-nav', {
|
|
1523
1626
|
via: 'mid-session',
|
|
1524
1627
|
url: stamp.midUrl,
|
|
@@ -1529,7 +1632,10 @@ async function liveViaMidSession({
|
|
|
1529
1632
|
const navigated = await outcome(
|
|
1530
1633
|
reader.send('Page.navigate', { url: stamp.midUrl }, midAttached.sessionId)
|
|
1531
1634
|
);
|
|
1532
|
-
if (!answered(navigated) || !navigated.ok)
|
|
1635
|
+
if (!answered(navigated) || !navigated.ok) {
|
|
1636
|
+
const blocked = liveMidBlocked(reader.events, eventStart, midUrls);
|
|
1637
|
+
return blocked ? { blocked } : null;
|
|
1638
|
+
}
|
|
1533
1639
|
const childBudget = budget < 2000 ? budget : Math.max(budget, 8000);
|
|
1534
1640
|
const found = await waitChildUnderMid(
|
|
1535
1641
|
reader,
|
|
@@ -1538,14 +1644,106 @@ async function liveViaMidSession({
|
|
|
1538
1644
|
childBudget,
|
|
1539
1645
|
internalSessions,
|
|
1540
1646
|
beforeIds,
|
|
1541
|
-
stamp.midNeedle
|
|
1647
|
+
stamp.midNeedle,
|
|
1648
|
+
() => liveMidBlocked(reader.events, eventStart, midUrls)
|
|
1542
1649
|
);
|
|
1543
|
-
if (
|
|
1650
|
+
if (found?.blocked) return found;
|
|
1651
|
+
if (!found) {
|
|
1652
|
+
const blocked = liveMidBlocked(reader.events, eventStart, midUrls);
|
|
1653
|
+
return blocked ? { blocked } : null;
|
|
1654
|
+
}
|
|
1544
1655
|
const branch = found.via === 'mid-target' ? 'mid-target' : 'grandchild-target';
|
|
1545
1656
|
note(notes, 'protected-parent.page-branch', { branch, via: found.via, live: 'mid-session' });
|
|
1546
1657
|
return found;
|
|
1547
1658
|
}
|
|
1548
1659
|
|
|
1660
|
+
function acceptLiveBlocked(raw, notes, blocked) {
|
|
1661
|
+
raw.liveBlocked = blocked;
|
|
1662
|
+
note(notes, 'protected-parent.page-live-blocked', blocked);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
function protectLiveChannels(result, skipEvaluate = false) {
|
|
1666
|
+
result.resourceTree ??= false;
|
|
1667
|
+
result.frameEvents ??= false;
|
|
1668
|
+
if (!skipEvaluate) result.contextEvaluate ??= false;
|
|
1669
|
+
result.midFrameAttached ??= false;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
async function samplePreLiveChannels({
|
|
1673
|
+
client,
|
|
1674
|
+
sessionId,
|
|
1675
|
+
childSessions,
|
|
1676
|
+
clientEventStart,
|
|
1677
|
+
raw,
|
|
1678
|
+
contexts,
|
|
1679
|
+
resourceArm,
|
|
1680
|
+
evaluateArm,
|
|
1681
|
+
result,
|
|
1682
|
+
skipEvaluate = false,
|
|
1683
|
+
}) {
|
|
1684
|
+
const sessions = [sessionId, ...childSessions];
|
|
1685
|
+
await sampleResources(client, sessions, resourceArm, result, raw);
|
|
1686
|
+
const events = (client.events ?? []).slice(clientEventStart);
|
|
1687
|
+
result.frameEvents = events.some((event) => frameEventHit(event, raw))
|
|
1688
|
+
? true
|
|
1689
|
+
: (result.frameEvents ?? false);
|
|
1690
|
+
result.midFrameAttached = events.some((event) => midFrameAttachedHit(event, raw))
|
|
1691
|
+
? true
|
|
1692
|
+
: (result.midFrameAttached ?? false);
|
|
1693
|
+
if (!skipEvaluate && contexts.length)
|
|
1694
|
+
await evaluateContexts(client, sessions, contexts, evaluateArm, result);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
async function liveViaTopSession({
|
|
1698
|
+
reader,
|
|
1699
|
+
readerSessionId,
|
|
1700
|
+
targetId,
|
|
1701
|
+
pageUrl,
|
|
1702
|
+
midHint,
|
|
1703
|
+
innerHint,
|
|
1704
|
+
innerKind,
|
|
1705
|
+
liveBudget,
|
|
1706
|
+
notes,
|
|
1707
|
+
internalSessions,
|
|
1708
|
+
beforeIds,
|
|
1709
|
+
eventStart,
|
|
1710
|
+
midUrls,
|
|
1711
|
+
missing,
|
|
1712
|
+
}) {
|
|
1713
|
+
const plan = liveNestPlan(
|
|
1714
|
+
pageUrl,
|
|
1715
|
+
innerKind ?? (innerHint === 'about:srcdoc' ? 'srcdoc' : 'ordinary'),
|
|
1716
|
+
innerHint
|
|
1717
|
+
);
|
|
1718
|
+
if (plan.midUrl) midUrls.push(plan.midUrl);
|
|
1719
|
+
note(notes, 'protected-parent.page-live-nav', {
|
|
1720
|
+
via: 'top-session',
|
|
1721
|
+
url: plan.liveUrl,
|
|
1722
|
+
innerHint: plan.innerHint,
|
|
1723
|
+
midNeedle: plan.midNeedle,
|
|
1724
|
+
beforeTargetIds: [...beforeIds],
|
|
1725
|
+
});
|
|
1726
|
+
const navigated = await outcome(
|
|
1727
|
+
reader.send('Page.navigate', { url: plan.liveUrl }, readerSessionId)
|
|
1728
|
+
);
|
|
1729
|
+
if (!answered(navigated)) missing.push('unguarded Page.navigate unanswered after attach');
|
|
1730
|
+
else if (!navigated.ok)
|
|
1731
|
+
missing.push(`unguarded Page.navigate failed: ${navigated.error?.message ?? navigated.error}`);
|
|
1732
|
+
return waitGrandchild(
|
|
1733
|
+
reader,
|
|
1734
|
+
readerSessionId,
|
|
1735
|
+
midHint,
|
|
1736
|
+
plan.innerHint || innerHint,
|
|
1737
|
+
liveBudget,
|
|
1738
|
+
notes,
|
|
1739
|
+
targetId,
|
|
1740
|
+
internalSessions,
|
|
1741
|
+
plan.midNeedle,
|
|
1742
|
+
beforeIds,
|
|
1743
|
+
() => liveMidBlocked(reader.events, eventStart, midUrls)
|
|
1744
|
+
);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1549
1747
|
async function liveGrandchild({
|
|
1550
1748
|
reader,
|
|
1551
1749
|
readerSessionId,
|
|
@@ -1573,6 +1771,9 @@ async function liveGrandchild({
|
|
|
1573
1771
|
});
|
|
1574
1772
|
const beforeIds = new Set(before.targets.map((info) => info.targetId).filter(Boolean));
|
|
1575
1773
|
const liveBudget = budget < 2000 ? budget : Math.max(budget, 8000);
|
|
1774
|
+
const eventStart = reader.events?.length ?? 0;
|
|
1775
|
+
const midUrls = [];
|
|
1776
|
+
await armReaderNetwork(reader, [readerSessionId, ...(readerSessions ?? [])]);
|
|
1576
1777
|
let liveRaw = await liveViaMidSession({
|
|
1577
1778
|
reader,
|
|
1578
1779
|
raw,
|
|
@@ -1583,49 +1784,43 @@ async function liveGrandchild({
|
|
|
1583
1784
|
internalSessions,
|
|
1584
1785
|
beforeIds,
|
|
1585
1786
|
preferMidLive,
|
|
1787
|
+
eventStart,
|
|
1788
|
+
midUrls,
|
|
1586
1789
|
});
|
|
1587
|
-
if (
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
);
|
|
1593
|
-
note(notes, 'protected-parent.page-live-nav', {
|
|
1594
|
-
via: 'top-session',
|
|
1595
|
-
url: plan.liveUrl,
|
|
1596
|
-
innerHint: plan.innerHint,
|
|
1597
|
-
midNeedle: plan.midNeedle,
|
|
1598
|
-
beforeTargetIds: [...beforeIds],
|
|
1599
|
-
});
|
|
1600
|
-
const navigated = await outcome(
|
|
1601
|
-
reader.send('Page.navigate', { url: plan.liveUrl }, readerSessionId)
|
|
1602
|
-
);
|
|
1603
|
-
if (!answered(navigated)) missing.push('unguarded Page.navigate unanswered after attach');
|
|
1604
|
-
else if (!navigated.ok)
|
|
1605
|
-
missing.push(
|
|
1606
|
-
`unguarded Page.navigate failed: ${navigated.error?.message ?? navigated.error}`
|
|
1607
|
-
);
|
|
1608
|
-
liveRaw = await waitGrandchild(
|
|
1790
|
+
if (liveRaw?.blocked) {
|
|
1791
|
+
acceptLiveBlocked(raw, notes, liveRaw.blocked);
|
|
1792
|
+
liveRaw = null;
|
|
1793
|
+
} else if (!liveRaw) {
|
|
1794
|
+
liveRaw = await liveViaTopSession({
|
|
1609
1795
|
reader,
|
|
1610
1796
|
readerSessionId,
|
|
1797
|
+
targetId,
|
|
1798
|
+
pageUrl,
|
|
1611
1799
|
midHint,
|
|
1612
|
-
|
|
1800
|
+
innerHint,
|
|
1801
|
+
innerKind,
|
|
1613
1802
|
liveBudget,
|
|
1614
1803
|
notes,
|
|
1615
|
-
targetId,
|
|
1616
1804
|
internalSessions,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1805
|
+
beforeIds,
|
|
1806
|
+
eventStart,
|
|
1807
|
+
midUrls,
|
|
1808
|
+
missing,
|
|
1809
|
+
});
|
|
1810
|
+
if (liveRaw?.blocked) {
|
|
1811
|
+
acceptLiveBlocked(raw, notes, liveRaw.blocked);
|
|
1812
|
+
liveRaw = null;
|
|
1813
|
+
}
|
|
1620
1814
|
}
|
|
1621
1815
|
const after = await listTargetSnapshot(reader);
|
|
1622
1816
|
note(notes, 'protected-parent.page-targets-after', {
|
|
1623
1817
|
unanswered: after.unanswered,
|
|
1624
1818
|
targets: after.targets,
|
|
1625
1819
|
foundLive: Boolean(liveRaw),
|
|
1820
|
+
liveBlocked: Boolean(raw.liveBlocked),
|
|
1626
1821
|
});
|
|
1627
1822
|
if (!liveRaw) {
|
|
1628
|
-
missing.push(
|
|
1823
|
+
if (!raw.liveBlocked) missing.push(liveMissingReason(pageUrl, midHint, raw));
|
|
1629
1824
|
return contexts;
|
|
1630
1825
|
}
|
|
1631
1826
|
adoptLiveRaw(raw, liveRaw);
|
|
@@ -1865,6 +2060,18 @@ async function measurePageClient({
|
|
|
1865
2060
|
result.contextCreated = (client.events ?? [])
|
|
1866
2061
|
.slice(clientEventStart)
|
|
1867
2062
|
.some((event) => contextHit(event, raw));
|
|
2063
|
+
await samplePreLiveChannels({
|
|
2064
|
+
client,
|
|
2065
|
+
sessionId,
|
|
2066
|
+
childSessions,
|
|
2067
|
+
clientEventStart,
|
|
2068
|
+
raw,
|
|
2069
|
+
contexts,
|
|
2070
|
+
resourceArm,
|
|
2071
|
+
evaluateArm,
|
|
2072
|
+
result,
|
|
2073
|
+
skipEvaluate: innerKind === 'srcdoc',
|
|
2074
|
+
});
|
|
1868
2075
|
let liveContexts = await liveGrandchild({
|
|
1869
2076
|
reader,
|
|
1870
2077
|
readerSessionId,
|
|
@@ -1893,44 +2100,110 @@ async function measurePageClient({
|
|
|
1893
2100
|
result
|
|
1894
2101
|
);
|
|
1895
2102
|
if (missing.length) return abortPageClient(client, sessionId, notes, missing, result);
|
|
1896
|
-
await
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2103
|
+
liveContexts = await continueAfterLive({
|
|
2104
|
+
client,
|
|
2105
|
+
reader,
|
|
2106
|
+
readerSessionId,
|
|
2107
|
+
sessionId,
|
|
2108
|
+
clientEventStart,
|
|
2109
|
+
pageUrl,
|
|
2110
|
+
targetId,
|
|
2111
|
+
midHint,
|
|
2112
|
+
innerHint,
|
|
2113
|
+
innerKind,
|
|
2114
|
+
raw,
|
|
2115
|
+
contexts,
|
|
2116
|
+
liveContexts,
|
|
2117
|
+
childSessions,
|
|
2118
|
+
internalSessions,
|
|
2119
|
+
treeArm,
|
|
2120
|
+
resourceArm,
|
|
2121
|
+
evaluateArm,
|
|
2122
|
+
result,
|
|
2123
|
+
missing,
|
|
2124
|
+
notes,
|
|
2125
|
+
budget,
|
|
2126
|
+
});
|
|
2127
|
+
if (missing.length) return { ...result, incomplete: missing.join('; ') };
|
|
2128
|
+
return result;
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
async function continueAfterLive({
|
|
2132
|
+
client,
|
|
2133
|
+
reader,
|
|
2134
|
+
readerSessionId,
|
|
2135
|
+
sessionId,
|
|
2136
|
+
clientEventStart,
|
|
2137
|
+
pageUrl,
|
|
2138
|
+
targetId,
|
|
2139
|
+
midHint,
|
|
2140
|
+
innerHint,
|
|
2141
|
+
innerKind,
|
|
2142
|
+
raw,
|
|
2143
|
+
contexts,
|
|
2144
|
+
liveContexts,
|
|
2145
|
+
childSessions,
|
|
2146
|
+
internalSessions,
|
|
2147
|
+
treeArm,
|
|
2148
|
+
resourceArm,
|
|
2149
|
+
evaluateArm,
|
|
2150
|
+
result,
|
|
2151
|
+
missing,
|
|
2152
|
+
notes,
|
|
2153
|
+
budget,
|
|
2154
|
+
}) {
|
|
2155
|
+
const skipEvaluate = innerKind === 'srcdoc';
|
|
2156
|
+
if (raw.liveBlocked) {
|
|
2157
|
+
protectLiveChannels(result, skipEvaluate);
|
|
2158
|
+
if (!liveContexts.length) liveContexts = contexts;
|
|
2159
|
+
} else {
|
|
2160
|
+
await probeRawGrandchildTarget(client, raw, childSessions, internalSessions, result, missing);
|
|
2161
|
+
if (raw.midTargetId || raw.grandchildTargetId) {
|
|
2162
|
+
const remasured = await remasureLiveGrandchild({
|
|
2163
|
+
reader,
|
|
2164
|
+
readerSessionId,
|
|
2165
|
+
pageUrl,
|
|
2166
|
+
targetId,
|
|
2167
|
+
midHint,
|
|
2168
|
+
innerHint,
|
|
2169
|
+
innerKind,
|
|
1924
2170
|
raw,
|
|
1925
|
-
|
|
2171
|
+
budget,
|
|
2172
|
+
notes,
|
|
1926
2173
|
internalSessions,
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
2174
|
+
});
|
|
2175
|
+
if (remasured) {
|
|
2176
|
+
adoptLiveRaw(raw, remasured);
|
|
2177
|
+
note(notes, 'protected-parent.page-live-raw', {
|
|
2178
|
+
midFrameId: remasured.hit.midFrameId,
|
|
2179
|
+
frameId: remasured.hit.frameId,
|
|
2180
|
+
url: remasured.hit.url,
|
|
2181
|
+
via: remasured.via,
|
|
2182
|
+
remasure: true,
|
|
2183
|
+
});
|
|
2184
|
+
await adoptLiveClientSessions(
|
|
2185
|
+
client,
|
|
2186
|
+
sessionId,
|
|
2187
|
+
clientEventStart,
|
|
2188
|
+
raw,
|
|
2189
|
+
childSessions,
|
|
2190
|
+
internalSessions,
|
|
2191
|
+
missing,
|
|
2192
|
+
result
|
|
2193
|
+
);
|
|
2194
|
+
if (!missing.length)
|
|
2195
|
+
await probeRawGrandchildTarget(
|
|
2196
|
+
client,
|
|
2197
|
+
raw,
|
|
2198
|
+
childSessions,
|
|
2199
|
+
internalSessions,
|
|
2200
|
+
result,
|
|
2201
|
+
missing
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
1932
2204
|
}
|
|
1933
2205
|
}
|
|
2206
|
+
if (missing.length) return liveContexts;
|
|
1934
2207
|
const clientContexts = await rawContexts(
|
|
1935
2208
|
client,
|
|
1936
2209
|
[sessionId, ...childSessions],
|
|
@@ -1954,9 +2227,9 @@ async function measurePageClient({
|
|
|
1954
2227
|
result,
|
|
1955
2228
|
missing,
|
|
1956
2229
|
budget,
|
|
1957
|
-
skipEvaluate
|
|
2230
|
+
skipEvaluate,
|
|
1958
2231
|
});
|
|
1959
|
-
if (missing.length) return
|
|
2232
|
+
if (missing.length) return liveContexts;
|
|
1960
2233
|
await finishPageClient(
|
|
1961
2234
|
client,
|
|
1962
2235
|
sessionId,
|
|
@@ -1971,10 +2244,33 @@ async function measurePageClient({
|
|
|
1971
2244
|
notes,
|
|
1972
2245
|
childSessions,
|
|
1973
2246
|
windowMs,
|
|
1974
|
-
|
|
2247
|
+
skipEvaluate
|
|
2248
|
+
);
|
|
2249
|
+
return liveContexts;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
function settlePageContexts(liveContexts, raw, evaluateArm, result, missing, skipEvaluate) {
|
|
2253
|
+
if (!liveContexts.length) {
|
|
2254
|
+
if (raw.liveBlocked) {
|
|
2255
|
+
protectLiveChannels(result, skipEvaluate);
|
|
2256
|
+
result.contextCreated ??= false;
|
|
2257
|
+
return;
|
|
2258
|
+
}
|
|
2259
|
+
missing.push('grandchild execution context missing in raw leg');
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
result.contextCreated ??= false;
|
|
2263
|
+
if (skipEvaluate) return;
|
|
2264
|
+
settleArm(
|
|
2265
|
+
result,
|
|
2266
|
+
'contextEvaluate',
|
|
2267
|
+
evaluateArm.unanswered,
|
|
2268
|
+
evaluateArm.unansweredId
|
|
2269
|
+
? `Runtime.evaluate unanswered (${evaluateArm.unansweredId})`
|
|
2270
|
+
: 'Runtime.evaluate unanswered',
|
|
2271
|
+
missing,
|
|
2272
|
+
{ contextEvaluate: false }
|
|
1975
2273
|
);
|
|
1976
|
-
if (missing.length) return { ...result, incomplete: missing.join('; ') };
|
|
1977
|
-
return result;
|
|
1978
2274
|
}
|
|
1979
2275
|
|
|
1980
2276
|
function finishPageClient(
|
|
@@ -2015,22 +2311,7 @@ function finishPageClient(
|
|
|
2015
2311
|
result.childAttach ??= false;
|
|
2016
2312
|
result.targetEvents ??= false;
|
|
2017
2313
|
result.childEnableRefused ??= false;
|
|
2018
|
-
|
|
2019
|
-
else {
|
|
2020
|
-
result.contextCreated ??= false;
|
|
2021
|
-
if (!skipEvaluate) {
|
|
2022
|
-
settleArm(
|
|
2023
|
-
result,
|
|
2024
|
-
'contextEvaluate',
|
|
2025
|
-
evaluateArm.unanswered,
|
|
2026
|
-
evaluateArm.unansweredId
|
|
2027
|
-
? `Runtime.evaluate unanswered (${evaluateArm.unansweredId})`
|
|
2028
|
-
: 'Runtime.evaluate unanswered',
|
|
2029
|
-
missing,
|
|
2030
|
-
{ contextEvaluate: false }
|
|
2031
|
-
);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2314
|
+
settlePageContexts(liveContexts, raw, evaluateArm, result, missing, skipEvaluate);
|
|
2034
2315
|
note(notes, 'protected-parent.page-client', {
|
|
2035
2316
|
frameTree: result.frameTree ?? 'unmeasured',
|
|
2036
2317
|
resourceTree: result.resourceTree ?? 'unmeasured',
|
|
@@ -2044,6 +2325,7 @@ function finishPageClient(
|
|
|
2044
2325
|
childEnableRefused: result.childEnableRefused ?? false,
|
|
2045
2326
|
attachRefused: result.attachRefused ?? false,
|
|
2046
2327
|
grandchildTargetId: raw.grandchildTargetId ?? null,
|
|
2328
|
+
liveBlocked: raw.liveBlocked ?? null,
|
|
2047
2329
|
windowMs,
|
|
2048
2330
|
childSessions: [...childSessions],
|
|
2049
2331
|
firstTreeOk: treeArm.out?.ok,
|
|
@@ -154,6 +154,10 @@
|
|
|
154
154
|
"closeProtected": {
|
|
155
155
|
"type": "string",
|
|
156
156
|
"minLength": 1
|
|
157
|
+
},
|
|
158
|
+
"signInHold": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 1
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
},
|
|
@@ -192,7 +196,8 @@
|
|
|
192
196
|
"forwardAudit",
|
|
193
197
|
"stockSetup",
|
|
194
198
|
"syntheticAutoAttach",
|
|
195
|
-
"closeProtected"
|
|
199
|
+
"closeProtected",
|
|
200
|
+
"signInHold"
|
|
196
201
|
]
|
|
197
202
|
},
|
|
198
203
|
"requires": {
|
|
@@ -586,6 +591,28 @@
|
|
|
586
591
|
}
|
|
587
592
|
}
|
|
588
593
|
},
|
|
594
|
+
{
|
|
595
|
+
"type": "object",
|
|
596
|
+
"additionalProperties": false,
|
|
597
|
+
"required": ["signInHold", "as"],
|
|
598
|
+
"properties": {
|
|
599
|
+
"signInHold": {
|
|
600
|
+
"enum": [
|
|
601
|
+
"held-popup",
|
|
602
|
+
"callback",
|
|
603
|
+
"callback-encoded",
|
|
604
|
+
"callback-origin",
|
|
605
|
+
"ordinary-popup"
|
|
606
|
+
]
|
|
607
|
+
},
|
|
608
|
+
"as": {
|
|
609
|
+
"$ref": "#/$defs/name"
|
|
610
|
+
},
|
|
611
|
+
"requires": {
|
|
612
|
+
"$ref": "#/$defs/requires"
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
},
|
|
589
616
|
{
|
|
590
617
|
"type": "object",
|
|
591
618
|
"additionalProperties": false,
|