From 6d5a2d4e2e4af92dfbc1e77061bbb1d4a58c0d56 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 3 Jun 2026 22:41:20 -0400 Subject: [PATCH] zebra-spaces: trace leave click + global JS error logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fox: leave button still not working. Adding a logLine at the top of the click handler so we can see whether the click ever reaches it, and a window.onerror + unhandledrejection forwarder so any silent JS exception that broke event-handler attachment surfaces in CLIENT_LOG instead of dying in the browser console. Next test: tap leave on the phone, then check the proxy log for either 'leave-button: click fired' or a JS error line — that tells us if the click is being lost (overlay / CSS) or if the handler itself is throwing. --- web/zebra-spaces.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/zebra-spaces.html b/web/zebra-spaces.html index 3c85355..0a69770 100644 --- a/web/zebra-spaces.html +++ b/web/zebra-spaces.html @@ -817,6 +817,17 @@ function hex(buf){ const u8=buf instanceof Uint8Array?buf:new Uint8Array(buf); r function shortHex(s){ return s.slice(0,4)+'…'+s.slice(-4); } const logEl = $('log'); +/* Global error handler — runtime errors used to die silently (no + * stack trace anywhere), so a broken button just stopped working + * with no signal-server visibility. Now every uncaught exception + * AND unhandled-promise-rejection forwards to CLIENT_LOG as kind=err. */ +window.addEventListener('error', (ev) => { + try { logLine('err', 'JS error: '+ev.message+' at '+(ev.filename||'?')+':'+(ev.lineno||'?')); } catch(_){} +}); +window.addEventListener('unhandledrejection', (ev) => { + try { logLine('err', 'JS unhandled: '+(ev.reason && (ev.reason.message || ev.reason.toString()) || 'unknown')); } catch(_){} +}); + function logLine(kind, msg){ const d=document.createElement('div'); d.className='log-line '+(kind||''); d.innerHTML=''+new Date().toLocaleTimeString()+' '+msg.replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c])); @@ -4864,6 +4875,7 @@ $('btn-copy-share').addEventListener('click', async () => { * the same channel cameras/screens use so the room sees the choice */ renderGamesColumn(); $('btn-leave').addEventListener('click', async () => { + logLine('', 'leave-button: click fired'); wantConnected = false; roomMachines.call.send('LEAVE'); /* explicit leave wipes the auto-rejoin state — user said 'out' */ @@ -4932,8 +4944,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');