← Commit history

v2.0.523 (insiders): Proven on AdomLapper: extension lane on the adom-you profile with nbe loaded and connected to the native host, four distinct toolbar icons, window at the full work area, thread tile with the favicon badge at overlaySize, progress bar during commands, no attention tint, 19 of 20 vendor sites loading in one window.

John Lauer ·888aea7ba4 ·1mo ago ·parent a07e4bc
1 file changed +26−4
src/extension/worker.js+26−4
@@ -10,15 +10,23 @@ const CANDIDATE_PORTS = [64230, 8851]; // hardcoded candidates — which is why the extension never called home on ConfRoomROG (pup-bridge#109). let _pkgPort = null; let _pkgLane = '';   // only the extension-DRIVE browser gets a lane token in port.json+let _pkgRead = false;   // ONLY a successful read may be memoized async function packagedPort() {-  if (_pkgPort !== null) return _pkgPort;+  // 2.0.511: the memo used to be `if (_pkgPort !== null)`, and the catch set _pkgPort = 0. So a single+  // failed first read (it races service-worker startup, and sweepBadges can trigger it before the drive+  // loop does) poisoned the memo for the worker's ENTIRE life: 0 is !== null, so it never retried, and+  // _pkgLane stayed '' — which pupExtPoll treats as "not the drive browser" and returns. The extension+  // loaded, the window was fine, and the control channel was silent forever (AdomLapper, 2026-09-13:+  // lastPollMsAgo never set while the lane window sat there correctly sized and stamped).+  if (_pkgRead) return _pkgPort;   try {     const r = await fetch(chrome.runtime.getURL('port.json'), { cache: 'no-store' });     const j = await r.json();     _pkgPort = (j && j.port) || 0;     _pkgLane = (j && j.lane) || '';-  } catch (e) { _pkgPort = 0; }-  return _pkgPort;+    _pkgRead = true;+  } catch (e) { /* leave the memo UNSET so the next tick retries */ }+  return _pkgPort === null ? 0 : _pkgPort; }  async function findPort() {@@ -144,6 +152,20 @@ async function pupExtPoll() {   pupExtDiag.tries++;   pupExtDiag.pkg = await packagedPort();   const found = await findPort();+  // 2.0.512: say hello BEFORE the lane gate. This lane deliberately runs with no CDP debug port, so when+  // its extension goes quiet there is no way to look inside it: today the window launched, loaded all its+  // extensions, sized and stamped correctly, and the channel was silent with nothing anywhere saying why.+  // The hello is fire-and-forget and carries what pup cannot otherwise learn - the lane token this browser+  // actually holds - so a mismatch shows up in the log instead of as silence.+  if (found) {+    try {+      fetch(`http://127.0.0.1:${found.port}/exthello`, {+        method: 'POST', headers: { 'Content-Type': 'application/json' },+        body: JSON.stringify({ lane: _pkgLane, pkg: _pkgPort, read: _pkgRead, worker: chrome.runtime.getURL('worker.js'), tries: pupExtDiag.tries }),+        signal: AbortSignal.timeout(1500),+      }).catch(() => {});+    } catch (e) {}+  }   // Only the extension-driven browser serves this channel. A normal pup window loads the same extension   // and must NEVER answer another thread's ext commands.   if (!_pkgLane) return;@@ -208,7 +230,7 @@ async function pupExtPoll() {       out = { id: cmd.id, ok: true, tabId: t.id, dataUrl: dataUrl };     } else if (cmd.action === 'tabs') {       const tabs = await chrome.tabs.query({});-      out = { id: cmd.id, ok: true, tabs: tabs.map((t) => ({ tabId: t.id, url: t.url, title: t.title, active: !!t.active, windowId: t.windowId })) };+      out = { id: cmd.id, ok: true, tabs: tabs.map((t) => ({ tabId: t.id, url: t.url, title: t.title, active: !!t.active, windowId: t.windowId, favIconUrl: t.favIconUrl || null })) };     } else if (cmd.action === 'close') {       if (cmd.tabId) await chrome.tabs.remove(cmd.tabId);       else if (cmd.windowId) await chrome.windows.remove(cmd.windowId);