← Commit history

Revert the 2.0.11 placement-first open-flow experiment: it could not place the window during load because the session is not registered in the sessions map until after navigation (line 8243), so the early park had no hwnd to bottom by, failed its z-confirm, retreated off-screen, and only added a wasted park pass; restore the known-good 2.0.10 open sequence while the proper fix (earlier session/hwnd registration) is designed

John Lauer ·ee7ed097de ·2mo ago ·parent 810fec3
4 files changed +29−43
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.11",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.11/adom-bridge-puppeteer-v2.0.11.zip",-  "sha256": "653943c230b41f534048204fab3a6f7b30658cd4a832de87ce3fe2f38702b1d9",-  "size": 640037,+  "version": "2.0.12",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.12/adom-bridge-puppeteer-v2.0.12.zip",+  "sha256": "d8336009842b006397d70c27509f9a082d2805e2afef0f8000e97427c4becca7",+  "size": 639593,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.11+2.0.12
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "2.0.11",+  "version": "2.0.12",   "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+23−37
@@ -8078,17 +8078,22 @@ async function launchSession(sessionId, url, { freshProfile = false, profile, st     console.log(`Welcome page failed to load (non-fatal): ${e.message}`);   } -  // v2.0.11 (John): PLACEMENT-FIRST. The OS taskbar button appears the instant Chrome creates the-  // (off-screen) window, so under the old "defer the park until the real URL settled" order a user-  // who clicked that flashing button mid-load saw NOTHING — the window sat off-screen for the whole-  // nav. We now DEFINE and KICK OFF the park immediately below, right after the fast local welcome-  // load and BEFORE both the real-URL nav and the AUMID stamp, so the button always maps to a-  // correctly placed (background, z-bottom) window. Trade-off vs the old order: the first-  // cross-origin paint-raise is no longer hidden by off-screen-ness; the existing z-bottom-  // re-asserts (post-nav re-bottom + the +2.5s pass inside kickoffPark) correct it instead.-  // Deterministic reveal for the user beats hiding a rare, self-correcting blip.-  // Only for a freshly launched browser — a reused window is already placed, and re-parking it could-  // hide a window the user has up (kickoffPark guards on that).+  // v1.8.73: stamp the window IDENTITY at CREATE (per the AD contract: identity is per-HWND —+  // stamping only at park would leave the window reading "Google Chrome for Testing" during its+  // whole load). The welcome page just set the "(session: <id>)" title, so AD can resolve it.+  // Fire-and-forget; the park re-brands (with badge fallback) as belt-and-suspenders.+  // v1.9.185 minimal-touch: do NOT stamp a per-session AUMID. Changing a window's AppUserModelID+  // makes Windows DESTROY and RECREATE its taskbar button — the single most invasive thing pup did+  // to a window it does not own. In minimal mode the window keeps Chrome's own identity.+  if (process.platform === 'win32' && (!minimalTouch() || pupSettings().aumidIcons === 'on')) { stampPupIdentity(sessionId, { once: true }).catch(() => {}); }++  // v1.8.68: the park is DEFINED here but KICKED OFF only after the real URL's navigation has+  // SETTLED (below). Rationale: the first cross-origin paint RAISES the window; if the window+  // is already placed on-screen (even at z-bottom), the user sees a blip on top of their work+  // (the adom/wiki thread's window John caught). Parking after settle means the paint-raise+  // hits a window still OFF-SCREEN — invisible, harmless. The window's first visible moment is+  // full-size, z-bottomed, and z-confirmed. Only for a freshly launched browser (_needsPark) —+  // a reused window is already placed, and re-parking it could hide a window the user has up.   const kickoffPark = () => {     if (foreground || (process.platform !== 'win32' && process.platform !== 'darwin')) return;     try {@@ -8124,30 +8129,13 @@ async function launchSession(sessionId, url, { freshProfile = false, profile, st       }     } catch (e) {}   };-  // Kick the park off NOW (placement-first): the window is positioned on-screen at z-bottom right-  // after the fast welcome load, before the flash below and before the multi-second real-URL nav.-  kickoffPark();--  // Stamp identity now that the window is placed. Identity is per-HWND (AD contract), so stamping at-  // create keeps it from reading "Google Chrome for Testing" during load; the welcome page already-  // set the "(session: <id>)" title so AD can resolve it. Fire-and-forget; the park re-brands (badge-  // fallback) as belt-and-suspenders. minimal-touch: do NOT stamp a per-session AUMID (changing the-  // AppUserModelID makes Windows destroy+recreate the taskbar button) — the window keeps Chrome's own-  // identity in minimal mode.-  if (process.platform === 'win32' && (!minimalTouch() || pupSettings().aumidIcons === 'on')) { stampPupIdentity(sessionId, { once: true }).catch(() => {}); }   // v1.8.36: SNAPPY auto-flash. The window already exists + is backgrounded here (the   // welcome page loaded from a local file), so flash the taskbar NOW — do not wait for the   // real URL's domcontentloaded, which for heavy sites is another 1–3s. Set _flashState so   // the open handler's later scheduleAutoFlash debounces (no double flash). Fire-and-forget.   if (!foreground && !silent && process.platform === 'win32') {     // v1.9.185 minimal-touch: no taskbar flash at all (and no log noise pretending one fired).-    // v2.0.11 (John): wait for the placement-first park's first pass to land BEFORE flashing, so the-    // instant the flash pulls the user's eye to the taskbar button, clicking it reveals a window that-    // is already on-screen — never the old "click the flash, see nothing" off-screen gap.-    if (pupSettings().openFlash === 'on') {-      try { const _be = browsers.get(profileName); if (_be && _be.browser && _be.browser._bgPromise) await _be.browser._bgPromise; } catch (e) {}-      try { _flashState.set(sessionId, Date.now()); _openFlashDone.set(sessionId, Date.now()); console.log(`[flash] "${sessionId}" (launch)`); flashViaAD(sessionId, { force: true }); } catch (e) {}-    }+    if (pupSettings().openFlash === 'on') { try { _flashState.set(sessionId, Date.now()); _openFlashDone.set(sessionId, Date.now()); console.log(`[flash] "${sessionId}" (launch)`); flashViaAD(sessionId, { force: true }); } catch (e) {} }   }    if (url) {@@ -8162,10 +8150,9 @@ async function launchSession(sessionId, url, { freshProfile = false, profile, st     // v1.9.105: keep the main-frame HTTP status — the strongest broken-render signal there is.     const _resp = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });     try { page.__pupHttpStatus = _resp && typeof _resp.status === 'function' ? _resp.status() : null; } catch (e) {}-    // Wait for the page to SETTLE (load event, capped at 2.5s) so the prompt re-bottom below lands-    // AFTER the first cross-origin paint (the paint that can raise the window). Skip if already-    // complete. (Placement-first, v2.0.11: the window is already on-screen at z-bottom by now — this-    // wait just times the corrective re-bottom rather than hiding the raise off-screen.)+    // v1.8.68: wait for the page to SETTLE (load event, capped at 2.5s) while the window is+    // still OFF-SCREEN, so the first paint's window-raise is invisible. Skip the wait if the+    // page is already complete.     if (!foreground && process.platform === 'win32') {       try {         const ready = await page.evaluate(() => document.readyState).catch(() => 'unknown');@@ -8180,10 +8167,9 @@ async function launchSession(sessionId, url, { freshProfile = false, profile, st       setTimeout(() => { reassertBottomAfterNav(sessionId).catch(() => {}); }, 3000);     }   }-  // Park already happened early (placement-first, before the nav). Now that the real URL has-  // painted, re-assert z-bottom once promptly so any first-paint raise is corrected fast (the-  // +2.5s kickoffPark pass and the +3s post-nav timer are the slower belt-and-suspenders).-  if (!foreground && (process.platform === 'win32' || process.platform === 'darwin')) { reassertBottomAfterNav(sessionId).catch(() => {}); }+  // Park now — after settle (url path) or right away (welcome-only path). The paint-raise+  // already happened off-screen; the window's first visible frame is full-size at z-bottom.+  kickoffPark();    // Belt and suspenders: close any tab in this Chrome that's NOT claimed by   // a registered session. This catches two cases: