← Commit history

Hotfix for the frozen-window regression John hit within the hour: revert the titleTag default to off (the v2.0.19 flip re-armed the documented title-observer ping-pong that pegs renderers and froze hd-publish-1.0.0), harden the opt-in observer to only ever watch a real title node instead of the whole document subtree on titleless pages, and make takeover:true on one-shot verbs act without stealing ownership so a sanctioned repair reload does not lock the original thread out of its own window

John Lauer ·05ef140d16 ·2mo ago ·parent 9dd76c4
4 files changed +25−16
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.19",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.19/adom-bridge-puppeteer-v2.0.19.zip",-  "sha256": "527b75452b4882dbcb535499937d305e99493ead35117f6e54199c1736076a2b",-  "size": 644821,+  "version": "2.0.20",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.20/adom-bridge-puppeteer-v2.0.20.zip",+  "sha256": "fcb510a333cabb72f80f3fce34e794d7e4bf17bd6788a82e37c365002cf02c14",+  "size": 645225,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.19+2.0.20
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "2.0.19",+  "version": "2.0.20",   "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. pup_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. pup_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, pup_alert_window posts a native toast whose click focuses the window, pup_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-bridge",   "author": "Adom Inc.",
src/server.js+19−10
@@ -614,8 +614,12 @@ function attachTab(session, sessionId, page, { makeActive = true, opener = 'user         // it would instantly remove the TRANSIENT tag pup adds to resolve the window's hwnd, forcing         // ambiguous geometry (two same-profile windows share a rect => same hwnd, John's dup-hwnd bug).         if (!tagOn) return true;-        const t = document.querySelector('title') || document.head || document.documentElement;-        if (!t) return false;+        // v2.0.20: ONLY a real <title> node. The old head/documentElement fallback observed the+        // ENTIRE document subtree on titleless pages (raw JSON/API views), firing ensure() on every+        // DOM mutation — a renderer-pegging cost on exactly the pages least able to afford it. A+        // titleless page keeps its once-stamped tag; continuous enforcement is not worth a freeze.+        const t = document.querySelector('title');+        if (!t) return true;         // v1.9.185 minimal-touch: in MINIMAL mode we stamp the title ONCE and do NOT install a         // MutationObserver. On a heavy SPA (Google Slides/Sheets rewrite document.title constantly)         // this observer re-fired on every one of those writes, each time writing the title BACK —@@ -3065,11 +3069,12 @@ function pupSettings() {   // default. titleTag = the "(ai-thread: X)" resolution suffix (pup resolves transiently while the   // window is off-screen when this is off, so titles stay clean and window-finding still works);   // titlePrefix = the "<thread> · " cosmetic prefix at the start.-  // v2.0.19 (John: "is there a better way to convey which pup window is owned by which-  // ai-thread?"): titleTag default ON — the "(ai-thread: X)" title suffix is what the taskbar-  // hover and Alt-Tab show, so ownership is readable without opening the window. (It also makes-  // title-based hwnd resolution deterministic.) titlePrefix stays off.-  D.titleTag = 'on'; D.titlePrefix = 'off';+  // v2.0.20 HOTFIX: titleTag default BACK OFF. The v2.0.19 flip re-armed the title-observer+  // ping-pong the code has always warned about (SPA rewrites title -> observer re-tags -> loop+  // pegs the renderer + floods CDP) and froze a live window within the hour (hd-publish-1.0.0,+  // captureScreenshot Internal error). Ownership visibility stays via the jump-list header name+  // and the in-window owner chip; the title tag remains an OPT-IN.+  D.titleTag = 'off'; D.titlePrefix = 'off';   if (_pupSettings.autoLogin === 'off' && !chosen.autoLogin) _pupSettings.autoLogin = 'on';   // v1.9.260 (John: "2s feels too fast cuz i can't read"): readable default. A stored 2000 was the   // old default, not a choice made in the dialog (it shipped hours ago) - migrate it up once.@@ -10521,9 +10526,13 @@ const server = http.createServer(async (req, res) => {           const _owner = _gs && (_gs.owner || _gs._ownerThread);           if (_gs && _owner && _owner !== _callerThread) {             if (args.takeover) {-              console.log(`[takeover] "${args.sessionId}": thread "${_callerThread}" TOOK OVER from "${_owner}" via ${command} (takeover:true — sanctioned only when the user asked)`);-              _gs._takenOverFrom = _owner; _gs._takenOverAt = Date.now();-              _gs.owner = _callerThread; _gs._ownerThread = _callerThread;+              // v2.0.20: ownership TRANSFERS only on an open_window claim. A one-shot sanctioned+              // action (reload/navigate/close to repair or hand off) must not steal the window —+              // v2.0.19 reassigned on every takeover, so a repair reload would have locked the+              // original owner out of its own window. The action is still logged with both names.+              console.log(`[takeover] "${args.sessionId}": thread "${_callerThread}" acted on "${_owner}"'s window via ${command} (takeover:true — sanctioned only when the user asked${command === 'pup_open_window' ? '; ownership TRANSFERRED' : '; ownership unchanged'})`);+              _gs._lastTakeoverBy = _callerThread; _gs._takenOverAt = Date.now();+              if (command === 'pup_open_window') { _gs._takenOverFrom = _owner; _gs.owner = _callerThread; _gs._ownerThread = _callerThread; }             } else {               console.log(`[own] REFUSED ${command} on "${args.sessionId}" — owner "${_owner}", caller "${_callerThread}"`);               let _curUrl = null; try { _curUrl = _gs.page?.url() || null; } catch (e) {}