← Commit history

v1.9.350: fix missing taskbar favicon overlay on the shared adom-you profile. The ownership guard (hwndBelongsToPup) refused every badge because the shared Chrome process pid was absent from the tracked pid set; now a pup window's unique ai-thread title tag confirms ownership and learns the owner pid onto the browser entry so sibling windows self-heal, while Edge and non-pup buttons stay protected.

John Lauer ·b4d343e667 ·2mo ago ·parent 1884978
4 files changed +57−15
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.349",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.349/adom-bridge-puppeteer-v1.9.349.zip",-  "sha256": "7ee9ca39ece6008b22a2d341baa256aa47954d9b95dd50b112a04ee66ca5cfa6",-  "size": 636748,+  "version": "1.9.350",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.350/adom-bridge-puppeteer-v1.9.350.zip",+  "sha256": "3cff610e93b706d1dc20ddc10e0bf712a05f7466b4014f49488506e2c4f17db9",+  "size": 637658,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.349+1.9.350
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.349",+  "version": "1.9.350",   "description": "Drives a browser ALREADY on the machine \u2014 installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) \u2014 launched with a FRESH isolated profile, so the common case has NO ~150 MB Chrome-for-Testing download and it never touches the user's real tabs/logins. Binds its local server to LOOPBACK (127.0.0.1) only, so no Windows Firewall 'allow Node through the firewall' prompt ever pops. Chrome for Testing is fetched only as a LAST RESORT if the machine has no Chromium browser at all. SPAWN-VERIFIED fallback: pup tries each detected browser (Chrome \u2192 Edge \u2192 CfT) and actually launches it, falling through to the next if one won't start (and handling browsers like Edge that relaunch onto another PID), so a corrupt/partial install never hard-fails an open. The browser that launches is cached as the default (persisted across restarts) so it isn't re-probed each time. On spawn the bridge SELF-WARMS: detects browsers + disk, and only if the box has no Chrome/Edge and no cached CfT does it background-fetch CfT so the first open is instant. browser_use pins a specific browser (chrome | edge | cft | auto); {browser:'chrome',install:true} downloads & installs REAL Google Chrome (user-scoped, no admin) on an Edge-only box. browser_readiness (READ-ONLY) reports which browser will be used + the full candidate list + the default + free disk. Every failure returns a specific errorCode + _hint (chrome_install_no_disk, chrome_download_network, chrome_install_permission, chrome_stable_not_detected, \u2026). Launches with FULL browser permissions by default for full debug (strictPermissions:true opts out). Headful automation: open/close windows+tabs, navigate, screenshot, eval JS, record. pup is a GENERIC, non-profile browser only \u2014 every session is a fresh isolated Chrome/Edge process, never the user's real signed-in browser; profile defaults to sessionId. To drive the user's REAL Chrome/Edge (their profile, cookies, SSO), use the Adom browser EXTENSION's nbrowser_* verbs \u2014 a separate bridge, not pup's job. macOS (v1.9.74+): full parity with mac-native mechanics \u2014 background-by-default is the app-level hide (windows stay drivable/screenshottable while hidden), raise/lower map to unhide+activate/hide, browser_alert_window posts a native toast whose click focuses the window, browser_use {browser:'chrome',install:true} installs Chrome from the official dmg, and taskbar identity/badging remains Windows-only.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+51−9
@@ -5230,10 +5230,26 @@ function pupBrowserPidSet(profileName) {       const b = be && be.browser; if (!b) continue;       if (b._detachedPid) pids.add(Number(b._detachedPid));       const pr = b.process && b.process(); if (pr && pr.pid) pids.add(Number(pr.pid));+      // v1.9.350: pids confirmed to back a pup window via its unique title tag (see hwndBelongsToPup).+      // Stored on the browser entry so they are discarded with it on browsers.delete — a recycled pid+      // can never keep passing after the process it named is gone.+      if (b._confirmedPids) for (const p of b._confirmedPids) pids.add(Number(p));     } catch (e) {}   }   return pids; }+// v1.9.350: record a pid proven (by unique pup title) to own a pup window, onto its profile's browser+// entry. Folded into pupBrowserPidSet so a shared-process profile (adom-you) self-heals after the first+// title-confirmed window, and cleared automatically when that browser entry is torn down.+function learnConfirmedPid(profileName, pid) {+  if (!profileName || !pid) return;+  try {+    const be = browsers.get(profileName);+    const b = be && be.browser; if (!b) return;+    if (!b._confirmedPids) b._confirmedPids = new Set();+    b._confirmedPids.add(Number(pid));+  } catch (e) {}+} async function hwndOwnerPid(hwnd) {   // v1.9.297 (John: "why is there no overlay on this taskbar icon?"): return the owner pid ONLY when   // the handle is a REAL top-level Chrome browser FRAME — the window that owns the taskbar button —@@ -5254,20 +5270,28 @@ async function hwndOwnerPid(hwnd) {       '  [DllImport("user32.dll")] public static extern bool IsWindow(IntPtr h);',       '  [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);',       '  [DllImport("user32.dll")] public static extern IntPtr GetAncestor(IntPtr h, uint f);',-      '  [DllImport("user32.dll")] public static extern int GetClassName(IntPtr h, StringBuilder s, int n); }',+      '  [DllImport("user32.dll")] public static extern int GetClassName(IntPtr h, StringBuilder s, int n);',+      '  [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n); }',       '"@',       `$h = [IntPtr]${Number(hwnd)}`,-      'if (-not [HPid]::IsWindow($h)) { Write-Output "0"; exit }',-      'if (-not [HPid]::IsWindowVisible($h)) { Write-Output "0"; exit }',+      'if (-not [HPid]::IsWindow($h)) { Write-Output "0|"; exit }',+      'if (-not [HPid]::IsWindowVisible($h)) { Write-Output "0|"; exit }',       // Must be the ROOT window (GA_ROOT = 2) — utility/child HWNDs resolve to a different root.-      'if ([HPid]::GetAncestor($h, 2) -ne $h) { Write-Output "0"; exit }',+      'if ([HPid]::GetAncestor($h, 2) -ne $h) { Write-Output "0|"; exit }',       // Must be a Chrome browser frame — the class that carries the taskbar button.       '$cn = New-Object System.Text.StringBuilder 64; [void][HPid]::GetClassName($h, $cn, 64)',-      'if ($cn.ToString() -ne "Chrome_WidgetWin_1") { Write-Output "0"; exit }',-      '$p = 0; [void][HPid]::GetWindowThreadProcessId($h, [ref]$p); Write-Output $p',+      'if ($cn.ToString() -ne "Chrome_WidgetWin_1") { Write-Output "0|"; exit }',+      '$p = 0; [void][HPid]::GetWindowThreadProcessId($h, [ref]$p)',+      // v1.9.350: also return the window TITLE — a pup window carries this session's unique+      // "(ai-thread: <sid>)" tag, which hwndBelongsToPup uses as a title anchor of ownership.+      '$tb = New-Object System.Text.StringBuilder 512; [void][HPid]::GetWindowText($h, $tb, 512)',+      'Write-Output ("" + $p + "|" + $tb.ToString())',     ].join(String.fromCharCode(13, 10)));     const out = (runPsHidden(sp, { timeout: 4000 }) || '').trim();-    const pid = Number(out); return Number.isFinite(pid) && pid > 0 ? pid : null;+    const bar = out.indexOf('|');+    const pid = Number(bar >= 0 ? out.slice(0, bar) : out);+    const title = bar >= 0 ? out.slice(bar + 1).trim() : '';+    return Number.isFinite(pid) && pid > 0 ? { pid, title } : null;   } catch (e) { return null; } } // Confirm an hwnd is a LIVE window owned by a pup browser process. Used as the hard gate before any@@ -5278,7 +5302,8 @@ async function hwndBelongsToPup(hwnd, session) {   // let a wrong-but-pup cached hwnd (another session's window) pass forever, so a stale/mis-resolved   // hwnd was never corrected and overlays painted on the wrong button. When a session is given, the   // pid set is scoped to its profile; a cross-profile hwnd now fails and forces a re-resolve.-  const pid = await hwndOwnerPid(hwnd);+  const info = await hwndOwnerPid(hwnd);+  const pid = info && info.pid;   if (!pid) return false;   const prof = session && session.profileName;   const own = pupBrowserPidSet(prof || undefined);@@ -5287,7 +5312,24 @@ async function hwndBelongsToPup(hwnd, session) {     const sp = path.join(require('os').tmpdir(), `_adom_ppid_${process.pid}.ps1`);     fs.writeFileSync(sp, `try { (Get-CimInstance Win32_Process -Filter "ProcessId=${pid}" -EA Stop).ParentProcessId } catch { 0 }`);     const par = Number((runPsHidden(sp, { timeout: 4000 }) || '0').trim());-    if (par && own.has(par)) return true;+    if (par && own.has(par)) { learnConfirmedPid(prof, pid); return true; }+  } catch (e) {}+  // v1.9.350 (John: "why does the taskbar pup icon have no overlay?"). The shared adom-you profile+  // runs ONE Chrome process with MANY windows, and that process's real pid is often NOT in the tracked+  // set (puppeteer's browser.process() is the dead post-fork launcher and _detachedPid can be stale),+  // so the pid + parent checks above BOTH miss and this guard REFUSED every favicon badge on that+  // profile — the exact symptom John saw (teal base tile, no overlay). A pup window's title carries+  // this session's UNIQUE tag "(ai-thread: <sid>)", which Edge / any other app can NEVER have, so a+  // title match is hard proof of pup ownership. Accept it AND LEARN the owner pid onto the browser+  // entry, so every sibling window on that shared Chrome process passes instantly afterwards+  // (self-heal). Edge stays protected: no pup title, nothing learned, still refused.+  try {+    const title = info && info.title;+    if (title && prof) {+      let sid = null;+      for (const [k, s] of sessions) { if (s === session) { sid = k; break; } }+      if (sid && title.indexOf(`(${TITLE_LABEL}: ${sid}`) >= 0) { learnConfirmedPid(prof, pid); return true; }+    }   } catch (e) {}   return false; }