Closed Bug 2062193 Opened 29 days ago Closed 24 days ago

browser_ext_windows_size.js expects windows.update() to clamp an off-screen position to (0, 0) rather than to the screen's available origin

Categories

(WebExtensions :: Frontend, defect, P3)

defect

Tracking

(firefox156 fixed)

RESOLVED FIXED
156 Branch
Tracking Status
firefox156 --- fixed

People

(Reporter: florian, Assigned: florian)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

sanitizePositionParams() clamps a requested window position to the screen's available rect offset by the widget's screen edge slop. On macOS that rect is [NSScreen visibleFrame], which excludes the menu bar, and GetScreenEdgeSlop() is overridden only on GTK, so requesting top: -50 puts the window at the bottom of the menu bar rather than at y = 0.

The test asserted the clamped position was exactly (0, 0), which holds only where the available rect starts at the screen origin. That expectation was written in bug 1271047 at a time when the test had already been skipped on mac since 2016, so it was never once exercised on a platform with a menu bar.

On try, macosx1015-64-qr opt and debug failed 12/12 with Expected 'top' value - Expected: 0, Actual: 23 and only that assertion, through all five 200 ms retries and the fresh-browser rerun. 23 is the menu bar height on those workers, measured from the failure screenshot, where the menu bar occupies rows y = 0..22 of the 1920x1080 screen. The fix reads screen.availTop/availLeft at runtime instead.

All three mac conditions descend from one os == 'mac' blanket skip added in bug 1253133 in 2016, in the same patch that added windows.update()'s geometry support and this test, whose stated reason ("Fails when windows are randomly opened in fullscreen mode") is unrelated and is contradicted by that push, where all 12 runs got the exact sizes they requested. Bug 1881925 split it per version and dropped the comment, and bugs 1919776 and 1948426 re-spelled it.

sanitizePositionParams() clamps a requested window position to the
screen's available rect (nsIScreen::GetAvailRectDisplayPix), offset by the
widget's screen edge slop. On macOS that rect is [NSScreen visibleFrame],
which excludes the menu bar, and GetScreenEdgeSlop() is only overridden on
GTK, so requesting top: -50 puts the window at the bottom of the menu bar
rather than at y = 0.

The test asserted the clamped position was exactly (0, 0), which only
holds when the available rect starts at the screen origin. That
expectation was written in bug 1271047 when the clamping was introduced,
at a time when the test had already been skipped on mac since 2016, so it
was never exercised on a platform with a menu bar. Compare against the
screen's available origin instead, read at runtime, so the expectation no
longer encodes where that origin happens to be.

All three mac conditions are removed, not only the mac 10.15 one a try
push can exercise: neither the cause nor the fix is macOS-version
specific, since visibleFrame excludes the menu bar on every version and
the expectation is now read from screen.availTop instead of being written
down. macosx1470 runs no mochitest-browser-chrome job at all, so that
condition matches nothing; macOS 15.30 aarch64 browser-chrome exists only
under --full and is not verified here.

Severity: -- → N/A
Priority: -- → P3
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/36ffcad0ba0c https://hg.mozilla.org/integration/autoland/rev/9121687e5827 Expect windows.update() to clamp an off-screen position to the screen's available area in browser_ext_windows_size.js, and re-enable the test on mac, r=extension-reviewers,rpl.

Backed out for causing bc failures @browser_ext_url_overrides_newtab.js.

Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/10e4e7321bea https://hg.mozilla.org/integration/autoland/rev/f6343b76a0ea Expect windows.update() to clamp an off-screen position to the screen's available area in browser_ext_windows_size.js, and re-enable the test on mac, r=extension-reviewers,rpl.
Status: ASSIGNED → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: