Arnés de pruebas: proveer document al código extraído

El vigía de congelamiento escucha visibilitychange, y el arnés no proveía
document: la suite entera se caía al cargar. Fue mi error de proceso además
del de código: empujé el commit anterior sin mirar el resultado de la suite,
que es exactamente lo que la suite existe para impedir.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-08-23 12:14:58 -05:00
co-authored by Claude Fable 5
parent 6e5aa16c29
commit 95547bc4f3
+6 -4
View File
@@ -67,7 +67,7 @@ function escenario({ bloqueado = false, msArranque = 20, caida = false } = {}) {
const beacons = [];
const sandbox = new Function(
'window', 'setTimeout', 'setInterval', 'SpeechSynthesisUtterance',
'localStorage', 'navigator', 'Blob', 'Date',
'localStorage', 'navigator', 'Blob', 'Date', 'document',
cuerpo + '; return { anunciarTurno, _uttAncladas };'
);
const fakeDate = { now: () => t };
@@ -77,7 +77,8 @@ function escenario({ bloqueado = false, msArranque = 20, caida = false } = {}) {
{ getItem: () => '[]', setItem: () => {} },
{ sendBeacon: (u, b) => beacons.push(u) },
function Blob() {},
Object.assign(function () { return { toISOString: () => '2026-01-01T00:00:00' }; }, { now: () => t })
Object.assign(function () { return { toISOString: () => '2026-01-01T00:00:00' }; }, { now: () => t }),
{ addEventListener: () => {}, hidden: false }
);
const correr = (hastaMs) => {
let n = 0;
@@ -203,12 +204,13 @@ function escenario({ bloqueado = false, msArranque = 20, caida = false } = {}) {
};
const api = new Function(
'window', 'setTimeout', 'setInterval', 'SpeechSynthesisUtterance',
'localStorage', 'navigator', 'Blob', 'Date',
'localStorage', 'navigator', 'Blob', 'Date', 'document',
cuerpo + '; return { anunciarTurno };'
)({ speechSynthesis: synth }, st, () => {}, Utt,
{ getItem: () => '[]', setItem: () => {} },
{ sendBeacon: () => {} }, function Blob() {},
Object.assign(function () { return { toISOString: () => '2026-01-01T00:00:00' }; }, { now: () => t }));
Object.assign(function () { return { toISOString: () => '2026-01-01T00:00:00' }; }, { now: () => t }),
{ addEventListener: () => {}, hidden: false });
api.anunciarTurno('A01', 'Consultorio 2', 'maría fernanda gómez', () => {});
let n = 0;