@ai-ecoverse/slicc-browsers 1.28.1 → 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.
@@ -921,6 +921,7 @@ const CAST_ACK_INCOMPLETE = 'cast ack incomplete: frames received but not all ac
921
921
  const CAST_ACK_UNANSWERED = 'cast ack unanswered';
922
922
  const CAST_NEVER_STREAMED = 'cast never streamed before the insertion';
923
923
  const CAST_NO_OBSERVER = 'no unguarded observer to confirm the paint';
924
+ const CAST_PAINT_INCOMPLETE = 'cannot confirm paint';
924
925
  const CAST_PAINT_MS = 500;
925
926
  const CAST_FLOOR_MS = 1500;
926
927
  const CAST_LATENCY_FACTOR = 3;
@@ -967,16 +968,18 @@ function castExplicitStop(client, page, state, from = 0) {
967
968
  }
968
969
 
969
970
  async function ackCastFrames(client, page, state) {
970
- for (const event of client.events ?? []) {
971
+ const events = client.events ?? [];
972
+ for (let i = 0; i < events.length; i++) {
973
+ const event = events[i];
971
974
  if (event.method !== 'Page.screencastFrame' || event.sessionId !== page) continue;
972
- const id = event.params?.sessionId;
973
- if (typeof id !== 'number' || state.ackAttempted.has(id)) continue;
974
- state.ackAttempted.add(id);
975
+ const sessionId = event.params?.sessionId;
976
+ if (typeof sessionId !== 'number' || state.ackAttempted.has(i)) continue;
977
+ state.ackAttempted.add(i);
975
978
  state.framesReceived += 1;
976
979
  let out;
977
980
  try {
978
981
  out = await Promise.race([
979
- outcome(client.send('Page.screencastFrameAck', { sessionId: id }, page)),
982
+ outcome(client.send('Page.screencastFrameAck', { sessionId }, page)),
980
983
  pause(CAST_ACK_MS).then(() => null),
981
984
  ]);
982
985
  } catch {
@@ -987,12 +990,12 @@ async function ackCastFrames(client, page, state) {
987
990
  continue;
988
991
  }
989
992
  if (out.ok) {
990
- state.acked.add(id);
993
+ state.acked.add(i);
991
994
  state.framesAcked += 1;
992
995
  continue;
993
996
  }
994
997
  if (presentish(out) === PRESENT) {
995
- state.acked.add(id);
998
+ state.acked.add(i);
996
999
  state.framesAcked += 1;
997
1000
  state.ackRefused = true;
998
1001
  continue;
@@ -1007,16 +1010,19 @@ async function provokeCastPaint(reader, observer, state) {
1007
1010
  state.paintObserverMissing = true;
1008
1011
  return;
1009
1012
  }
1013
+ let timedOut = false;
1010
1014
  try {
1011
1015
  await Promise.race([
1012
1016
  observe(reader, observer, CAST_TICK),
1013
1017
  pause(CAST_PAINT_MS).then(() => {
1018
+ timedOut = true;
1014
1019
  throw new Error('cast paint timed out');
1015
1020
  }),
1016
1021
  ]);
1017
1022
  state.paintConfirmed = true;
1018
1023
  state.paintAt ??= Date.now();
1019
1024
  } catch {
1025
+ if (timedOut) state.paintUnconfirmed = true;
1020
1026
  return;
1021
1027
  }
1022
1028
  }
@@ -1078,6 +1084,7 @@ async function driveCast(
1078
1084
  ackAttempted: new Set(),
1079
1085
  paintConfirmed: false,
1080
1086
  paintObserverMissing: false,
1087
+ paintUnconfirmed: false,
1081
1088
  paintAt: undefined,
1082
1089
  repaintToFrameMs: undefined,
1083
1090
  ackRefused: false,
@@ -1129,6 +1136,7 @@ async function driveCast(
1129
1136
  framesBefore = castFrameEvents(client, page).length;
1130
1137
  leakFrom = client.events?.length ?? 0;
1131
1138
  state.paintConfirmed = false;
1139
+ state.paintUnconfirmed = false;
1132
1140
  state.paintAt = undefined;
1133
1141
  state.repaintToFrameMs = undefined;
1134
1142
  state.ackRefused = false;
@@ -1141,6 +1149,7 @@ async function driveCast(
1141
1149
  framesAcked: state.framesAcked,
1142
1150
  ackUnanswered: state.ackUnanswered,
1143
1151
  paintObserverMissing: state.paintObserverMissing,
1152
+ paintUnconfirmed: state.paintUnconfirmed,
1144
1153
  waitMs,
1145
1154
  repaintToFrameMs: state.repaintToFrameMs,
1146
1155
  });
@@ -1171,6 +1180,7 @@ async function driveCast(
1171
1180
  framesBefore = castFrameEvents(client, page).length;
1172
1181
  leakFrom = client.events?.length ?? 0;
1173
1182
  state.paintConfirmed = false;
1183
+ state.paintUnconfirmed = false;
1174
1184
  state.paintAt = undefined;
1175
1185
  state.repaintToFrameMs = undefined;
1176
1186
  state.ackRefused = false;
@@ -1308,6 +1318,10 @@ function applyCastResult(result, castDrive, castAfter, side, missing) {
1308
1318
  result.castStopped = true;
1309
1319
  return;
1310
1320
  }
1321
+ if (castAfter.paintUnconfirmed) {
1322
+ missing.push(CAST_PAINT_INCOMPLETE);
1323
+ return;
1324
+ }
1311
1325
  missing.push(CAST_STALL);
1312
1326
  }
1313
1327
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.28.1",
3
+ "setVersion": "1.28.2",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
@@ -9081,7 +9081,7 @@
9081
9081
  }
9082
9082
  }
9083
9083
  },
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; 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, or an unconfirmed paint are incomplete",
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",
9085
9085
  "liveCheck": {
9086
9086
  "result": "frame",
9087
9087
  "path": "result.exists",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.28.1",
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.54.2",
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) return { live: false, incomplete: askedHold.incomplete, openerId };
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', {