@ai-ecoverse/slicc-browsers 1.28.0 → 1.28.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 +340 -32
- package/guard-runner.mjs +2 -0
- package/guard-vectors.json +14 -4
- package/package.json +2 -2
- package/sign-in-hold.mjs +20 -2
package/extension-frame.mjs
CHANGED
|
@@ -916,23 +916,189 @@ async function driveCaptures(client, page, missing) {
|
|
|
916
916
|
return { archive, pdf, cast, begin };
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
-
|
|
919
|
+
const CAST_STALL = 'cast stalled: no frame after insertion and paint was not confirmed';
|
|
920
|
+
const CAST_ACK_INCOMPLETE = 'cast ack incomplete: frames received but not all acked';
|
|
921
|
+
const CAST_ACK_UNANSWERED = 'cast ack unanswered';
|
|
922
|
+
const CAST_NEVER_STREAMED = 'cast never streamed before the insertion';
|
|
923
|
+
const CAST_NO_OBSERVER = 'no unguarded observer to confirm the paint';
|
|
924
|
+
const CAST_PAINT_INCOMPLETE = 'cannot confirm paint';
|
|
925
|
+
const CAST_PAINT_MS = 500;
|
|
926
|
+
const CAST_FLOOR_MS = 1500;
|
|
927
|
+
const CAST_LATENCY_FACTOR = 3;
|
|
928
|
+
const CAST_ACK_MS = 1000;
|
|
929
|
+
const CAST_TICK = `(() => {
|
|
930
|
+
const root = document.documentElement;
|
|
931
|
+
const n = Number(root.dataset.sliccCastTick || '0') + 1;
|
|
932
|
+
root.dataset.sliccCastTick = String(n);
|
|
933
|
+
root.style.setProperty('--slicc-cast-tick', String(n));
|
|
934
|
+
root.style.outline = n % 2 === 0 ? '1px solid transparent' : '0 solid transparent';
|
|
935
|
+
return new Promise((resolve) => {
|
|
936
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve(n)));
|
|
937
|
+
});
|
|
938
|
+
})()`;
|
|
939
|
+
|
|
940
|
+
function castWaitMs(frameMs, castControls) {
|
|
941
|
+
if (!(frameMs > 0)) return 0;
|
|
942
|
+
const floor = frameMs >= 1000 ? CAST_FLOOR_MS : frameMs;
|
|
943
|
+
const controlMs = castControls?.repaintToFrameMs;
|
|
944
|
+
if (typeof controlMs === 'number' && controlMs >= 0)
|
|
945
|
+
return Math.max(floor, Math.ceil(controlMs * CAST_LATENCY_FACTOR));
|
|
946
|
+
return Math.max(floor, frameMs);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function castFrameEvents(client, page, from = 0) {
|
|
950
|
+
return (client.events ?? [])
|
|
951
|
+
.slice(from)
|
|
952
|
+
.filter((event) => event.method === 'Page.screencastFrame' && event.sessionId === page);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
function castExplicitStop(client, page, state, from = 0) {
|
|
956
|
+
return (
|
|
957
|
+
state.ackRefused ||
|
|
958
|
+
(client.events ?? [])
|
|
959
|
+
.slice(from)
|
|
960
|
+
.some(
|
|
961
|
+
(event) =>
|
|
962
|
+
(event.method === 'Inspector.detached' &&
|
|
963
|
+
event.sessionId === page &&
|
|
964
|
+
event.params?.reason) ||
|
|
965
|
+
(event.method === 'Target.detachedFromTarget' && event.params?.sessionId === page)
|
|
966
|
+
)
|
|
967
|
+
);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
async function ackCastFrames(client, page, state) {
|
|
971
|
+
const events = client.events ?? [];
|
|
972
|
+
for (let i = 0; i < events.length; i++) {
|
|
973
|
+
const event = events[i];
|
|
974
|
+
if (event.method !== 'Page.screencastFrame' || event.sessionId !== page) continue;
|
|
975
|
+
const sessionId = event.params?.sessionId;
|
|
976
|
+
if (typeof sessionId !== 'number' || state.ackAttempted.has(i)) continue;
|
|
977
|
+
state.ackAttempted.add(i);
|
|
978
|
+
state.framesReceived += 1;
|
|
979
|
+
let out;
|
|
980
|
+
try {
|
|
981
|
+
out = await Promise.race([
|
|
982
|
+
outcome(client.send('Page.screencastFrameAck', { sessionId }, page)),
|
|
983
|
+
pause(CAST_ACK_MS).then(() => null),
|
|
984
|
+
]);
|
|
985
|
+
} catch {
|
|
986
|
+
out = null;
|
|
987
|
+
}
|
|
988
|
+
if (out == null) {
|
|
989
|
+
state.ackUnanswered = true;
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
if (out.ok) {
|
|
993
|
+
state.acked.add(i);
|
|
994
|
+
state.framesAcked += 1;
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
if (presentish(out) === PRESENT) {
|
|
998
|
+
state.acked.add(i);
|
|
999
|
+
state.framesAcked += 1;
|
|
1000
|
+
state.ackRefused = true;
|
|
1001
|
+
continue;
|
|
1002
|
+
}
|
|
1003
|
+
state.ackUnanswered = true;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
async function provokeCastPaint(reader, observer, state) {
|
|
1008
|
+
if (!reader || !observer) {
|
|
1009
|
+
state.paintConfirmed = false;
|
|
1010
|
+
state.paintObserverMissing = true;
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
let timedOut = false;
|
|
1014
|
+
try {
|
|
1015
|
+
await Promise.race([
|
|
1016
|
+
observe(reader, observer, CAST_TICK),
|
|
1017
|
+
pause(CAST_PAINT_MS).then(() => {
|
|
1018
|
+
timedOut = true;
|
|
1019
|
+
throw new Error('cast paint timed out');
|
|
1020
|
+
}),
|
|
1021
|
+
]);
|
|
1022
|
+
state.paintConfirmed = true;
|
|
1023
|
+
state.paintAt ??= Date.now();
|
|
1024
|
+
} catch {
|
|
1025
|
+
if (timedOut) state.paintUnconfirmed = true;
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function noteCastLatency(state, frames) {
|
|
1031
|
+
if (state.paintAt == null || state.repaintToFrameMs != null || frames.length === 0) return;
|
|
1032
|
+
state.repaintToFrameMs = Math.max(0, Date.now() - state.paintAt);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
async function waitCastWindow(client, page, state, leakFrom, waitMs, frameMs) {
|
|
1036
|
+
const until = Date.now() + waitMs;
|
|
1037
|
+
let frames = [];
|
|
1038
|
+
do {
|
|
1039
|
+
await provokeCastPaint(state.reader, state.observer, state);
|
|
1040
|
+
await ackCastFrames(client, page, state);
|
|
1041
|
+
frames = castFrameEvents(client, page, leakFrom);
|
|
1042
|
+
noteCastLatency(state, frames);
|
|
1043
|
+
if (frames.length > 0 || castExplicitStop(client, page, state, leakFrom)) break;
|
|
1044
|
+
await pause(25);
|
|
1045
|
+
} while (Date.now() < until);
|
|
1046
|
+
await ackCastFrames(client, page, state);
|
|
1047
|
+
frames = castFrameEvents(client, page, leakFrom);
|
|
1048
|
+
noteCastLatency(state, frames);
|
|
1049
|
+
if (
|
|
1050
|
+
frames.length === 0 &&
|
|
1051
|
+
!castExplicitStop(client, page, state, leakFrom) &&
|
|
1052
|
+
state.paintConfirmed
|
|
1053
|
+
) {
|
|
1054
|
+
const drainMs =
|
|
1055
|
+
frameMs >= 1000 ? Math.max(waitMs, CAST_FLOOR_MS) : Math.max(waitMs, frameMs > 0 ? 100 : 50);
|
|
1056
|
+
const drainUntil = Date.now() + drainMs;
|
|
1057
|
+
while (Date.now() < drainUntil) {
|
|
1058
|
+
await provokeCastPaint(state.reader, state.observer, state);
|
|
1059
|
+
await ackCastFrames(client, page, state);
|
|
1060
|
+
frames = castFrameEvents(client, page, leakFrom);
|
|
1061
|
+
if (frames.length > 0) break;
|
|
1062
|
+
await pause(25);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
await ackCastFrames(client, page, state);
|
|
1066
|
+
frames = castFrameEvents(client, page, leakFrom);
|
|
1067
|
+
noteCastLatency(state, frames);
|
|
1068
|
+
return frames;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
async function driveCast(
|
|
1072
|
+
client,
|
|
1073
|
+
page,
|
|
1074
|
+
frameMs,
|
|
1075
|
+
reader,
|
|
1076
|
+
observer,
|
|
1077
|
+
{ notes, castControls, side } = {}
|
|
1078
|
+
) {
|
|
920
1079
|
const start = await outcome(
|
|
921
1080
|
client.send('Page.startScreencast', { format: 'png', everyNthFrame: 1 }, page)
|
|
922
1081
|
);
|
|
923
|
-
const
|
|
1082
|
+
const state = {
|
|
1083
|
+
acked: new Set(),
|
|
1084
|
+
ackAttempted: new Set(),
|
|
1085
|
+
paintConfirmed: false,
|
|
1086
|
+
paintObserverMissing: false,
|
|
1087
|
+
paintUnconfirmed: false,
|
|
1088
|
+
paintAt: undefined,
|
|
1089
|
+
repaintToFrameMs: undefined,
|
|
1090
|
+
ackRefused: false,
|
|
1091
|
+
ackUnanswered: false,
|
|
1092
|
+
framesReceived: 0,
|
|
1093
|
+
framesAcked: 0,
|
|
1094
|
+
reader,
|
|
1095
|
+
observer,
|
|
1096
|
+
};
|
|
924
1097
|
let leakFrom;
|
|
1098
|
+
let framesBefore = 0;
|
|
925
1099
|
let pumping = start.ok;
|
|
926
1100
|
let stopped = false;
|
|
927
|
-
const
|
|
928
|
-
for (const event of client.events ?? []) {
|
|
929
|
-
if (event.method !== 'Page.screencastFrame' || event.sessionId !== page) continue;
|
|
930
|
-
const id = event.params?.sessionId;
|
|
931
|
-
if (typeof id !== 'number' || acked.has(id)) continue;
|
|
932
|
-
acked.add(id);
|
|
933
|
-
await outcome(client.send('Page.screencastFrameAck', { sessionId: id }, page));
|
|
934
|
-
}
|
|
935
|
-
};
|
|
1101
|
+
const waitMs = castWaitMs(frameMs, castControls);
|
|
936
1102
|
const halt = async () => {
|
|
937
1103
|
pumping = false;
|
|
938
1104
|
await pump;
|
|
@@ -945,7 +1111,7 @@ async function driveCast(client, page, frameMs) {
|
|
|
945
1111
|
start.ok && frameMs > 0
|
|
946
1112
|
? (async () => {
|
|
947
1113
|
while (pumping) {
|
|
948
|
-
await
|
|
1114
|
+
await ackCastFrames(client, page, state);
|
|
949
1115
|
await pause(25);
|
|
950
1116
|
}
|
|
951
1117
|
})()
|
|
@@ -953,41 +1119,97 @@ async function driveCast(client, page, frameMs) {
|
|
|
953
1119
|
return {
|
|
954
1120
|
castBefore: start.ok,
|
|
955
1121
|
castBeforeRefusal: presentish(start),
|
|
1122
|
+
async waitForFrame(ms = waitMs) {
|
|
1123
|
+
if (!start.ok) return false;
|
|
1124
|
+
const until = Date.now() + ms;
|
|
1125
|
+
do {
|
|
1126
|
+
await ackCastFrames(client, page, state);
|
|
1127
|
+
if (castFrameEvents(client, page).length > 0) return true;
|
|
1128
|
+
await provokeCastPaint(reader, observer, state);
|
|
1129
|
+
await pause(25);
|
|
1130
|
+
} while (Date.now() < until);
|
|
1131
|
+
await ackCastFrames(client, page, state);
|
|
1132
|
+
return castFrameEvents(client, page).length > 0;
|
|
1133
|
+
},
|
|
956
1134
|
async markInserted() {
|
|
957
|
-
await
|
|
1135
|
+
await ackCastFrames(client, page, state);
|
|
1136
|
+
framesBefore = castFrameEvents(client, page).length;
|
|
958
1137
|
leakFrom = client.events?.length ?? 0;
|
|
1138
|
+
state.paintConfirmed = false;
|
|
1139
|
+
state.paintUnconfirmed = false;
|
|
1140
|
+
state.paintAt = undefined;
|
|
1141
|
+
state.repaintToFrameMs = undefined;
|
|
1142
|
+
state.ackRefused = false;
|
|
959
1143
|
},
|
|
960
1144
|
async afterEmbed({ inserted }) {
|
|
961
1145
|
pumping = false;
|
|
962
1146
|
await pump;
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1147
|
+
const tally = () => ({
|
|
1148
|
+
framesReceived: state.framesReceived,
|
|
1149
|
+
framesAcked: state.framesAcked,
|
|
1150
|
+
ackUnanswered: state.ackUnanswered,
|
|
1151
|
+
paintObserverMissing: state.paintObserverMissing,
|
|
1152
|
+
paintUnconfirmed: state.paintUnconfirmed,
|
|
1153
|
+
waitMs,
|
|
1154
|
+
repaintToFrameMs: state.repaintToFrameMs,
|
|
1155
|
+
});
|
|
1156
|
+
if (!start.ok)
|
|
1157
|
+
return {
|
|
1158
|
+
castFramesBefore: 0,
|
|
1159
|
+
castFramesAfter: 0,
|
|
1160
|
+
castInserted: Boolean(inserted),
|
|
1161
|
+
castStopped: false,
|
|
1162
|
+
castStoppedExplicit: false,
|
|
1163
|
+
paintConfirmed: false,
|
|
1164
|
+
...tally(),
|
|
1165
|
+
};
|
|
966
1166
|
if (!inserted) {
|
|
967
1167
|
await halt();
|
|
968
|
-
return {
|
|
1168
|
+
return {
|
|
1169
|
+
castFramesBefore: framesBefore,
|
|
1170
|
+
castFramesAfter: 0,
|
|
1171
|
+
castInserted: false,
|
|
1172
|
+
castStopped: false,
|
|
1173
|
+
castStoppedExplicit: false,
|
|
1174
|
+
paintConfirmed: false,
|
|
1175
|
+
...tally(),
|
|
1176
|
+
};
|
|
969
1177
|
}
|
|
970
1178
|
if (leakFrom == null) {
|
|
971
|
-
await
|
|
1179
|
+
await ackCastFrames(client, page, state);
|
|
1180
|
+
framesBefore = castFrameEvents(client, page).length;
|
|
972
1181
|
leakFrom = client.events?.length ?? 0;
|
|
1182
|
+
state.paintConfirmed = false;
|
|
1183
|
+
state.paintUnconfirmed = false;
|
|
1184
|
+
state.paintAt = undefined;
|
|
1185
|
+
state.repaintToFrameMs = undefined;
|
|
1186
|
+
state.ackRefused = false;
|
|
973
1187
|
}
|
|
974
|
-
await
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
.
|
|
978
|
-
|
|
1188
|
+
const frames = await waitCastWindow(client, page, state, leakFrom, waitMs, frameMs);
|
|
1189
|
+
const stoppedExplicit = castExplicitStop(client, page, state, leakFrom);
|
|
1190
|
+
if (side === 'control' && typeof state.repaintToFrameMs === 'number' && castControls)
|
|
1191
|
+
castControls.repaintToFrameMs = state.repaintToFrameMs;
|
|
1192
|
+
notes?.push(
|
|
1193
|
+
`cast acked ${state.framesAcked} of ${state.framesReceived} frames; wait ${waitMs}ms` +
|
|
1194
|
+
(state.repaintToFrameMs != null ? `; repaint-to-frame ${state.repaintToFrameMs}ms` : '')
|
|
1195
|
+
);
|
|
979
1196
|
await halt();
|
|
980
1197
|
return {
|
|
981
1198
|
castLeak: frames.length > 0,
|
|
1199
|
+
castFramesBefore: framesBefore,
|
|
982
1200
|
castFramesAfter: frames.length,
|
|
983
1201
|
castInserted: true,
|
|
1202
|
+
castStopped: stoppedExplicit || (frames.length === 0 && state.paintConfirmed),
|
|
1203
|
+
castStoppedExplicit: stoppedExplicit,
|
|
1204
|
+
paintConfirmed: state.paintConfirmed,
|
|
1205
|
+
...tally(),
|
|
984
1206
|
};
|
|
985
1207
|
},
|
|
986
1208
|
stop: halt,
|
|
987
1209
|
};
|
|
988
1210
|
}
|
|
989
1211
|
|
|
990
|
-
async function beginCast(client, session, targetId, frameMs) {
|
|
1212
|
+
async function beginCast(client, session, targetId, frameMs, reader, observer, extras) {
|
|
991
1213
|
const attachEarly = await outcome(
|
|
992
1214
|
client.send('Target.attachToTarget', { targetId, flatten: true })
|
|
993
1215
|
);
|
|
@@ -999,7 +1221,7 @@ async function beginCast(client, session, targetId, frameMs) {
|
|
|
999
1221
|
return {
|
|
1000
1222
|
page,
|
|
1001
1223
|
pageAttached: attachEarly.ok,
|
|
1002
|
-
castDrive: await driveCast(client, page, frameMs),
|
|
1224
|
+
castDrive: await driveCast(client, page, frameMs, reader, observer, extras),
|
|
1003
1225
|
};
|
|
1004
1226
|
}
|
|
1005
1227
|
|
|
@@ -1014,14 +1236,93 @@ function finishCast(castDrive, embedded) {
|
|
|
1014
1236
|
return castDrive.afterEmbed({ inserted: Boolean(embedded) });
|
|
1015
1237
|
}
|
|
1016
1238
|
|
|
1017
|
-
function
|
|
1018
|
-
if (!castDrive) return;
|
|
1239
|
+
function noteCastFields(result, castDrive, castAfter) {
|
|
1019
1240
|
result.castBefore = castDrive.castBefore;
|
|
1020
1241
|
result.castBeforeRefusal = castDrive.castBeforeRefusal;
|
|
1021
|
-
result.
|
|
1022
|
-
result.castFramesAfter = castAfter.castFramesAfter;
|
|
1023
|
-
|
|
1024
|
-
|
|
1242
|
+
result.castFramesBefore = castAfter.castFramesBefore ?? 0;
|
|
1243
|
+
result.castFramesAfter = castAfter.castFramesAfter ?? 0;
|
|
1244
|
+
result.castFramesReceived = castAfter.framesReceived ?? 0;
|
|
1245
|
+
result.castFramesAcked = castAfter.framesAcked ?? 0;
|
|
1246
|
+
result.castWaitMs = castAfter.waitMs ?? 0;
|
|
1247
|
+
if (castAfter.repaintToFrameMs != null) result.castRepaintToFrameMs = castAfter.repaintToFrameMs;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
function castAckMissing(castAfter, missing) {
|
|
1251
|
+
if (castAfter.ackUnanswered) {
|
|
1252
|
+
missing.push(CAST_ACK_UNANSWERED);
|
|
1253
|
+
return true;
|
|
1254
|
+
}
|
|
1255
|
+
if ((castAfter.framesReceived ?? 0) > (castAfter.framesAcked ?? 0)) {
|
|
1256
|
+
missing.push(CAST_ACK_INCOMPLETE);
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function castRefusedStart(result, castDrive) {
|
|
1263
|
+
return Boolean(result.castRefusal) || Boolean(castDrive.castBeforeRefusal);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
function applyCastResult(result, castDrive, castAfter, side, missing) {
|
|
1267
|
+
if (!castDrive) return;
|
|
1268
|
+
noteCastFields(result, castDrive, castAfter);
|
|
1269
|
+
const inserted = Boolean(castAfter.castInserted);
|
|
1270
|
+
const leaked = Boolean(castAfter.castLeak);
|
|
1271
|
+
const stopped = Boolean(castAfter.castStopped);
|
|
1272
|
+
const stoppedExplicit = Boolean(castAfter.castStoppedExplicit);
|
|
1273
|
+
if (!castDrive.castBefore) {
|
|
1274
|
+
result.castLeak = false;
|
|
1275
|
+
result.castStopped = castRefusedStart(result, castDrive);
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
if (!inserted) {
|
|
1279
|
+
result.castLeak = false;
|
|
1280
|
+
result.castStopped = false;
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
if (side === 'control') {
|
|
1284
|
+
if (!(result.castFramesBefore > 0)) {
|
|
1285
|
+
missing.push('control screencast produced no frames before the extension frame appeared');
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
if (!leaked) {
|
|
1289
|
+
missing.push('control screencast produced no frames after the extension frame appeared');
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
if (castAckMissing(castAfter, missing)) return;
|
|
1293
|
+
result.castLeak = true;
|
|
1294
|
+
result.castStopped = false;
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
if (leaked) {
|
|
1298
|
+
result.castLeak = true;
|
|
1299
|
+
result.castStopped = false;
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
if (castAfter.paintObserverMissing) {
|
|
1303
|
+
missing.push(CAST_NO_OBSERVER);
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
if (castAckMissing(castAfter, missing)) return;
|
|
1307
|
+
if (castRefusedStart(result, castDrive) || stoppedExplicit) {
|
|
1308
|
+
result.castLeak = false;
|
|
1309
|
+
result.castStopped = true;
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
if (stopped) {
|
|
1313
|
+
if (!(result.castFramesBefore > 0)) {
|
|
1314
|
+
missing.push(CAST_NEVER_STREAMED);
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
result.castLeak = false;
|
|
1318
|
+
result.castStopped = true;
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
if (castAfter.paintUnconfirmed) {
|
|
1322
|
+
missing.push(CAST_PAINT_INCOMPLETE);
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
missing.push(CAST_STALL);
|
|
1025
1326
|
}
|
|
1026
1327
|
|
|
1027
1328
|
function classifyRevealOverlap(
|
|
@@ -1179,6 +1480,8 @@ export async function extensionFrame({
|
|
|
1179
1480
|
inputMethods: inputList = INPUT_METHODS,
|
|
1180
1481
|
side = 'guarded',
|
|
1181
1482
|
capabilities = {},
|
|
1483
|
+
notes,
|
|
1484
|
+
castControls,
|
|
1182
1485
|
}) {
|
|
1183
1486
|
const attached = await reader.send('Target.attachToTarget', { targetId, flatten: true });
|
|
1184
1487
|
const observer = attached.sessionId;
|
|
@@ -1196,10 +1499,15 @@ export async function extensionFrame({
|
|
|
1196
1499
|
await reader.send('DOM.enable', {}, observer);
|
|
1197
1500
|
await reader.send('Accessibility.enable', {}, observer);
|
|
1198
1501
|
if (mode === 'cast') {
|
|
1199
|
-
const started = await beginCast(client, session, targetId, frameMs
|
|
1502
|
+
const started = await beginCast(client, session, targetId, frameMs, reader, observer, {
|
|
1503
|
+
notes,
|
|
1504
|
+
castControls,
|
|
1505
|
+
side,
|
|
1506
|
+
});
|
|
1200
1507
|
page = started.page;
|
|
1201
1508
|
pageAttached = started.pageAttached;
|
|
1202
1509
|
castDrive = started.castDrive;
|
|
1510
|
+
await castDrive.waitForFrame(castWaitMs(frameMs, castControls));
|
|
1203
1511
|
}
|
|
1204
1512
|
const embedded = await embed(reader, observer, mode, frameURL);
|
|
1205
1513
|
await noteCastInsertion(castDrive, embedded, missing);
|
package/guard-runner.mjs
CHANGED
|
@@ -1105,6 +1105,8 @@ class Execution {
|
|
|
1105
1105
|
extensionId: this.options.extensionFrameId ?? DEFAULT_EXTENSION_WORLD_ID,
|
|
1106
1106
|
side: this.side,
|
|
1107
1107
|
capabilities: this.options.capabilities,
|
|
1108
|
+
notes: this.notes,
|
|
1109
|
+
castControls: (this.clients.castControls ??= {}),
|
|
1108
1110
|
})
|
|
1109
1111
|
);
|
|
1110
1112
|
if (step.guess) return this.guess(step.guess, session);
|
package/guard-vectors.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"setVersion": "1.28.
|
|
3
|
+
"setVersion": "1.28.2",
|
|
4
4
|
"sources": [
|
|
5
5
|
{
|
|
6
6
|
"repo": "ai-ecoverse/slicc-cli",
|
|
@@ -9070,9 +9070,18 @@
|
|
|
9070
9070
|
"equals": true,
|
|
9071
9071
|
"observer": "client"
|
|
9072
9072
|
}
|
|
9073
|
+
},
|
|
9074
|
+
"castStopped": {
|
|
9075
|
+
"means": "extension frame cast: after frames before insertion and a confirmed post-insertion paint the guard delivered no further frame (silent stop/drop), or refused an ack / detached",
|
|
9076
|
+
"check": {
|
|
9077
|
+
"result": "frame",
|
|
9078
|
+
"path": "result.castStopped",
|
|
9079
|
+
"equals": true,
|
|
9080
|
+
"observer": "client"
|
|
9081
|
+
}
|
|
9073
9082
|
}
|
|
9074
9083
|
},
|
|
9075
|
-
"live": "the observer confirms a chrome-extension: frame is in the ordinary tab after a screencast was started on the clean tab;
|
|
9084
|
+
"live": "the observer confirms a chrome-extension: frame is in the ordinary tab after a screencast was started on the clean tab; both legs ack every Page.screencastFrame event (Chrome reuses params.sessionId per cast); the control proves frames before and after a forced paint and records repaint-to-frame latency; the guarded wait is at least 3× that latency (floor 1500ms) plus a drain; any post-insertion frame fails; a silent stop needs frames before insertion plus a confirmed post-insertion paint with none after; an explicit startScreencast refusal (castBeforeRefusal or castRefusal), ack refusal, or detach still passes without pre-frames; missing acks, no observer, never-streamed without those, a paint probe that times out (cannot confirm paint), or an unconfirmed paint are incomplete",
|
|
9076
9085
|
"liveCheck": {
|
|
9077
9086
|
"result": "frame",
|
|
9078
9087
|
"path": "result.exists",
|
|
@@ -9201,9 +9210,10 @@
|
|
|
9201
9210
|
"describeNodeLeak": false,
|
|
9202
9211
|
"outerHTMLLeak": false,
|
|
9203
9212
|
"castBefore": "either",
|
|
9204
|
-
"castLeak": false
|
|
9213
|
+
"castLeak": false,
|
|
9214
|
+
"castStopped": "either"
|
|
9205
9215
|
},
|
|
9206
|
-
"designDependent": ["frameTreeLeak", "axLeak", "castBefore"]
|
|
9216
|
+
"designDependent": ["frameTreeLeak", "axLeak", "castBefore", "castStopped"]
|
|
9207
9217
|
},
|
|
9208
9218
|
{
|
|
9209
9219
|
"id": "C1.script-nav",
|
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.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",
|
|
@@ -89,7 +89,7 @@
|
|
|
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": "1.
|
|
92
|
+
"@ai-ecoverse/slicc-cdp": "2.1.0",
|
|
93
93
|
"@ai-ecoverse/slicc-shared-web": "2.16.0",
|
|
94
94
|
"@biomejs/biome": "2.6.7",
|
|
95
95
|
"ajv": "8.20.0",
|
package/sign-in-hold.mjs
CHANGED
|
@@ -168,7 +168,6 @@ async function listHttp(client, notes) {
|
|
|
168
168
|
});
|
|
169
169
|
return {
|
|
170
170
|
ok: false,
|
|
171
|
-
missing: true,
|
|
172
171
|
error: { message: String(error?.message ?? error) },
|
|
173
172
|
};
|
|
174
173
|
}
|
|
@@ -591,7 +590,26 @@ async function heldPopup({
|
|
|
591
590
|
hostLabel: hostLabelOf(openerOrigin ?? ordinary),
|
|
592
591
|
notes,
|
|
593
592
|
});
|
|
594
|
-
if (askedHold.incomplete)
|
|
593
|
+
if (askedHold.incomplete) {
|
|
594
|
+
const popup = await until(
|
|
595
|
+
async () => {
|
|
596
|
+
const listed = await outcome(reader.send('Target.getTargets', {}));
|
|
597
|
+
if (!listed.ok) return null;
|
|
598
|
+
return (
|
|
599
|
+
(listed.result?.targetInfos ?? []).find((info) =>
|
|
600
|
+
matchPopup(info, known, openerId, heldUrl, control)
|
|
601
|
+
) ?? null
|
|
602
|
+
);
|
|
603
|
+
},
|
|
604
|
+
Math.min(budget, 1000)
|
|
605
|
+
);
|
|
606
|
+
return {
|
|
607
|
+
live: false,
|
|
608
|
+
incomplete: askedHold.incomplete,
|
|
609
|
+
openerId,
|
|
610
|
+
...(popup?.targetId ? { targetId: popup.targetId } : {}),
|
|
611
|
+
};
|
|
612
|
+
}
|
|
595
613
|
holdAnswer = askedHold.answer;
|
|
596
614
|
}
|
|
597
615
|
note(notes, 'sign-in-hold.hold', {
|