← Commit history

Raise a pup window by resolving its hwnd and calling desktop_bring_to_front, instead of relying on CDP setWindowBounds plus bringToFront which never raises an Edge window from the bottom of the z-order

John Lauer ·e7fd25a5fe ·3mo ago ·parent e61982b
4 files changed +28−6
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.65",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.65/adom-bridge-puppeteer-v1.9.65.zip",-  "sha256": "5b79d09f19b5362430593e0c5eab95da4ae68c4bf0c74893a73dfa2801faeb0d",-  "size": 305536,+  "version": "1.9.66",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.66/adom-bridge-puppeteer-v1.9.66.zip",+  "sha256": "94a5c88882c635de8df81ec3b5a6a530253a0fa6a6692b4666c12d73f8391328",+  "size": 306062,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.65+1.9.66
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.65",+  "version": "1.9.66",   "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.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+22
@@ -2700,6 +2700,28 @@ async function osRaiseSessionWindow(session, sessionId) {     try { await session.page.bringToFront(); } catch (e) {}     session._foreground = true;     if (process.platform !== 'win32') return;+    // v1.9.66 — RAISE BY HWND. The CDP-only path above (setWindowBounds + bringToFront) happens to+    // surface a CHROME window, but it does NOT raise an EDGE one: bringToFront activates the TAB+    // inside the window, and setWindowBounds repositions without changing z-order, so a window pup+    // deliberately parked at the BOTTOM of the z-order stays buried. Measured on ConfRoomROG (which+    // is pinned to Edge because Edge was cached as its verified default): raise returned ok:true,+    // the log said "raise GRANTED", and the screen did not change — the user's "I click and no+    // window comes up".+    // The old PID fallback was removed for a good reason (a detached launch's process() is null, and+    // _detachedPid raised the LAUNCHER's window, i.e. the WRONG one). The fix is to name the window+    // exactly: resolve THIS session's hwnd by its "(session: <id>)" title, then have AD foreground+    // that specific hwnd. Precise, browser-agnostic, and no PID guessing.+    try {+      const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 }));+      const hwnd = fw && fw.best && fw.best.hwnd;+      if (hwnd) {+        await chrome.adCommand('desktop_bring_to_front', { hwnd }, { timeoutMs: 6000 });+        console.log(`[foreground] "${sessionId}" raised by hwnd=${hwnd}`);+      } else {+        console.log(`[foreground] "${sessionId}" could not resolve an hwnd to raise`);+      }+    } catch (e) { console.log(`[foreground] "${sessionId}" hwnd raise threw: ${e.message}`); }+    return;     // v1.9.30: resolve the PID EXACTLY like the proven browser_raise_os_window handler does:     // browser.process() ONLY. For a DETACHED launch (every Windows pup browser) process() is null,     // so the PS SetForegroundWindow step is SKIPPED and the CDP place+maximize+bringToFront above