dogfood port: cmux next focus: no reclaim inside the grant of a page that still has focus (port of #25689)

Draft
LA
4d ago
+23-2

Summary

Port to the dogfood line of feat #25689 (no reclaim inside the grant of a page that still has focus). On cp/dogfood-v2-2-12-opt, ChildPageFocus.reclaim had no grant guard: the page window's own didBecomeKey inside a focus grant could re-apply the model, and its reclaim gave the keys straight back to the cmux window (two key changes; the page kept focus with no keys). This holds the browser P0 on dogfood (STATUS 7582 and 7809; REOPEN VIDEO journey cycle A fails 1 of 3 on dogfood for this reason).

What this PR takes, exactly:

  1. 5f16828addc: from feat #25222 (b36320bf0fa1), only the granting state of ChildPageFocus (a private Bool set in focus(_:) around setFocus). Not taken: keysReturned(to:during:), its app callers (FocusEffectApplier, KeyWindowRole), NSWindow+ChromiumPage.swift, its tests and all its webviews changes. The guard reads only granting.
  2. 514a623397b: feat #25689 (002c20ec941e), cherry-pick -x with no conflict: reclaim returns while granting && page != nil, and the test reclaimInsideTheGrantAfterThePageBlurredTakesTheKeysBack (a blur inside the grant still reclaims).

The regression test ChildPageFocusKeyChangeTests.aReapplyInsideTheGrantDoesNotGrantAgain is already on the dogfood line, so the red run is the dogfood base itself.

CEFTabHostFocusTests.aPageWindowTargetNeverTakesFirstResponder (fails on the dogfood base, same STATUS 7582) is NOT fixed by these feat commits, and no feat commit fixes it: the test and the .pageWindow input target exist only on the dogfood line (37d2d8534f0b). Merge 259ac7717b06 ("Merge perf/chrome-parity into the p13-webui-030 integration") brought back the unconditional becomeFirstResponder of a814b7a8d237 in ChromiumHostPageView, so makeFirstResponder on a .pageWindow view succeeds. That needs its own dogfood fix; it is not in this PR.

Testing

Fleet, dogfood suite filter (scripts/ci/package-test-lane.sh suite Packages/macOS/CmuxNext ChildPageFocusKeyChangeTests), display worker gui-session-v1:

  • Red on the dogfood base 5b50f8bb57ac6d0964fb9c75146a3423a0ceeeb2: step 6a1db195f55ae829a1b6ff4a: FAILED as expected ("Test run with 6 tests", 1 issue): aReapplyInsideTheGrantDoesNotGrantAgain saw key-window changes ["pageB", "cmux"], expected ["pageB"]
  • Green at the exact head 514a623397b07da136afd56af0bceda7cb63bd76, 5 runs one after another: 1/5 fd7dd53b6cb7db07aa242f32 PASSED, 2/5 4cffa8a7692b750f97d03bf8 PASSED (each "Test run with 7 tests in 1 suite passed"); 3/5 174d9d7211e0211e4aca5ded PASSED; 4/5 68b90c9e48f4cea49a648fc8 PASSED (each "Test run with 7 tests in 1 suite passed"); 5/5 1357853d98e9c46a69829b93 CANCELLED when the dogfood ports stopped (4 of 5 greens)
  • Compile cmux-ci compile-check --app --package CmuxNext --recipe-version 2 at the head: job b9cea9ab5180b3526b4c8f02: PASSED
  • prepush-gate.py --base origin/cp/dogfood-v2-2-12-opt: no new violations.

Observed / Not run

  • Observed: the steps above.
  • Not run: the REOPEN VIDEO journey cycle A on a dogfood build of this head (the REOPEN VIDEO owner films it); CEFTabHostFocusTests (not changed here, see above).

No capture: focus logic with no visible UI change.

Changelog

none