Skip to content

🐞 Fix makeKeyWindow NaN coords that terminate Chromium PWA shims (#1131) - #1132

Merged
mrkai77 merged 5 commits into
mrkai77:developfrom
jvanderen1:fix/1131-pwa-vertical-snap-crash
Aug 9, 2026
Merged

🐞 Fix makeKeyWindow NaN coords that terminate Chromium PWA shims (#1131)#1132
mrkai77 merged 5 commits into
mrkai77:developfrom
jvanderen1:fix/1131-pwa-vertical-snap-crash

Conversation

@jvanderen1

@jvanderen1 jvanderen1 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Description

Loop’s synthetic makeKeyWindow focus event filled windowLocation with 0xFF bytes, which decode as NaN doubles. A Chromium regression caused Mojo to terminate the PWA app-shim connection when those values were received (app_shim_controller.mm:679 Channel error), so installed Chromium/Brave/Edge PWAs quit when Loop focused them before resize.

This ports AltTab’s fix:

  • Use a finite off-content point CGPoint(x: -1, y: -1) instead of 0xFF fill
  • Widen the event buffer to 0x100 (record length stays 0xf8)

The earlier Chromium-PWA-only resize workaround was removed in favor of this general fix.

Upstream:

Fixes #1131

How has this been tested?

Tested on macOS Tahoe 26.6 with a local Debug build.

  • Brave Google Keep / Chat PWAs — keybind snaps no longer quit the app
  • Chrome / Brave browser windows — still focus/resize normally
  • Safari Keep PWA / TextEdit — still fine
  • Re-verify after this AltTab-style revision (author): Keep/Chat PWA snap + focus still healthy

Screencast

Screencast of Chromium PWA snapping successfully is attached on the PR timeline / issue.

output.mp4

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in this PR.

Please describe to which degree, if any, an LLM was used in creating this pull request.

Cursor Agent assisted with root-cause investigation, the initial Chromium-PWA workaround, and rewriting this PR to the AltTab-style makeKeyWindow fix after Chromium clarified the NaN/Mojo cause. Behavior verified manually on-device; approach aligned with maintainer feedback on #1131.

Isolate a removable AX resize workaround for Chromium app-mode PWAs so Loop can snap them without triggering the shim's NSInvalidArgumentException / channel-error quit path.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jvanderen1
jvanderen1 marked this pull request as draft August 2, 2026 19:38
@jvanderen1
jvanderen1 marked this pull request as ready for review August 2, 2026 19:44
@jvanderen1 jvanderen1 mentioned this pull request Aug 2, 2026
6 tasks
jvanderen1 and others added 2 commits August 2, 2026 13:56
Point reviewers at the public duplicate and restricted canonical bugs so the workaround can be removed once Chromium ships a fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace 0xFF-filled windowLocation bytes (decoded as NaN) with a finite
off-content point, matching AltTab. Chromium’s Mojo path terminates the
app-shim connection when it receives those NaNs (mrkai77#1131). Also widen the
event buffer to 0x100 and drop the Chromium-specific resize workaround.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jvanderen1 jvanderen1 changed the title 🐞 Prevent Chromium PWA crashes when snapping (#1131) 🐞 Fix makeKeyWindow NaN coords that terminate Chromium PWA shims (#1131) Aug 8, 2026
@jvanderen1

Copy link
Copy Markdown
Contributor Author

Updated per @mrkai77’s feedback on #1131:

  • Replaced the Chromium-specific resize workaround with AltTab’s makeKeyWindow fix (CGPoint(x: -1, y: -1) + 0x100 buffer) in SkyLightToolBelt.makeKeyWindow
  • Removed ChromiumPWAResizeWorkaround entirely

Net diff vs develop is now only SkyLightToolBelt.swift. Please re-test Keep/Chat PWA snaps on this revision.

jvanderen1 and others added 2 commits August 8, 2026 15:17
Extract magic offsets into MakeKeyWindowEvent for readability, matching AltTab’s structure. No behavior change.

Co-authored-by: Cursor <cursoragent@cursor.com>

@mrkai77 mrkai77 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@mrkai77
mrkai77 merged commit a7a8e5f into mrkai77:develop Aug 9, 2026
1 check failed
@jvanderen1
jvanderen1 deleted the fix/1131-pwa-vertical-snap-crash branch August 9, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 PWA Crashes when Using Loop

2 participants