Closed Bug 2070908 Opened 3 days ago Closed 2 days ago

SetFocus(Raise::Yes) does not activate the application on macOS, causes test failures

Categories

(Core :: Widget: Cocoa, defect)

defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: florian, Assigned: florian)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

On macOS nsCocoaWindow::SetFocus(Raise::Yes) only calls [mWindow makeKeyAndOrderFront:nil], and AppKit will not make a window key while its application is inactive. Windows uses SetForegroundWindow and GTK uses gtk_window_present, so mac is the one platform where Raise::Yes does not honour its contract.

A browser-chrome test that launches the browser toolbox takes application activation away with -foreground and never gets it back. Every test after it then hangs in SimpleTest.waitForFocus(), waiting for a focus event that cannot arrive, which is the failure Bug 1937315 recorded when it was filed. Adding [NSApp activateIgnoringOtherApps:YES] on that path fixes it.

Severity: -- → S3
Summary: SetFocus(Raise::Yes) does not activate the application on macOS → SetFocus(Raise::Yes) does not activate the application on macOS, causes test failures

Raise::Yes did nothing while Firefox was not the active application, where GTK
activates through gtk_window_present_with_time. Only nsFocusManager::RaiseWindow
reaches this on macOS, after BrowsingContext::CanFocusCheck grants the raise,
and mozilla.widget.raise-on-setfocus is a kill switch. The mac arms un-skipped
here are the browser-chrome harness waiting forever for a focus event once the
Browser Toolbox has taken activation: Bug 1937229, Bug 1937315, Bug 1767721,
Bug 1781499.

Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/66f7f4704be7 https://hg.mozilla.org/integration/autoland/rev/8320591aecd1 Activate the application when asked to raise a window on macOS, r=mac-reviewers,devtools-reviewers,bradwerth,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 2 days ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: