Closed Bug 2028652 Opened 8 months ago Closed 3 months ago

browser_ext_windows_update.js fails standalone on Windows opt (and also --headless on mac/Linux/Windows)

Categories

(WebExtensions :: General, 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 external file)

browser/components/extensions/test/browser/browser_ext_windows_update.js permafails in standalone mochitest jobs on Windows opt with Got expected value for window.width - Expected: 1296, Actual: 1168

The severity field is not set for this bug.
:rpl, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(lgreco)

I took an initial look into this, but I was unable to hit the same failure locally on a windows 11 x86 25H2 system.

The test case that is hitting this failure is:

  • first it is retrieving the expected width and height from the window in its initial normal state
  • and then it expects the browser window to be restored to that size when it is un-maximized

The failure suggests that the un-maximized window ended up being restored to a size that wasn't the original one that the same window used to have before it was maximized by that test task right before the failure is hit.

I took a look to the tests that are preceding browser_ext_windows_update.js in the browser.toml file but I couldn't find one that I was convinced to be potentially introducing a side-effect that prevents the test from failing when not executed as standalone.

The fact that it seems to be only happening on windows is suspicious though, I wonder if there may be some Windows-only special handling related to un-maximizing a browser window at a Gecko's widget/windows level.

As a side note, when running this same test in --headless mode, I was hitting a permafailure that looked similar to the one tracked by this bug (but with slightly different width and height expected and actual values), it may be completely unrelated but the failure was suspiciously similar.

Not just on Windows, when I run it on my mac it fails as well (but only with --headless; works without):

./mach test --headless browser/components/extensions/test/browser/browser_ext_windows_update.js

browser/components/extensions/test/browser/browser_ext_windows_update.js
  FAIL testWindowUpdate - Got expected value for window.width - Expected: 1366, Actual: 1229
chrome://mochikit/content/browser-test.js:test_ok:1885
chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js:testHandler:83
chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js:testResult:97
resource://testing-common/SpecialPowersChild.sys.mjs:listener:2033
resource://testing-common/SpecialPowersChild.sys.mjs:loadExtension/<:1963
resource://testing-common/SpecialPowersChild.sys.mjs:receiveMessage:213
JSActor query*resource://testing-common/SpecialPowersParent.sys.mjs:resultListener:1269
resource://gre/modules/ExtensionCommon.sys.mjs:emit:341
resource://gre/modules/Extension.sys.mjs:receiveMessage:3590
MessageListener.receiveMessage*resource://gre/modules/Extension.sys.mjs:Extension:3375
resource://testing-common/ExtensionTestCommon.sys.mjs:generate:800
resource://testing-common/SpecialPowersParent.sys.mjs:receiveMessage:1266
JSActor query*resource://testing-common/SpecialPowersChild.sys.mjs:loadExtension:2025
chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js:ExtensionTestUtils.loadExtension:128
chrome://mochitests/content/browser/browser/components/extensions/test/browser/browser_ext_windows_update.js:testWindowUpdate:56
Severity: -- → S4
Flags: needinfo?(lgreco)
Priority: -- → P3
Summary: browser_ext_windows_update.js fails standalone on Windows opt → browser_ext_windows_update.js fails standalone on Windows opt (and also --headless on mac/Linux/Windows)

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Win32' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Win32
Product: WebExtensions → Core
Component: Widget: Win32 → General
Product: Core → WebExtensions

Two independent problems made this test perma-fail whenever it was not
skipped:

  1. browser-init.js's onBeforeInitialXULLayout() sizes the first window of
    a new profile to 90% of the available screen and, when that is smaller
    than 1280x1040, also sets sizemode="maximized". Mochitest always uses a
    new profile, so on small screens the window is already maximized when
    the test records window.width/height as the "normal" size.
    Un-maximizing then correctly restores the smaller pre-maximize size and
    the comparison fails. Fixed by moving the window to the "normal" state
    before recording its size.

  2. Window.setState() waits for the sizemode change but not for the resize
    that follows it when leaving fullscreen. Widgets report the new
    sizemode first and resize afterwards, so windows.update() resolved with
    the fullscreen size still in place. Fixed by also waiting for the
    resize, both waits sharing the single no-window-manager timeout the
    sizemode wait already used. This is a narrow instance of bug 1307759.

Removes the "os == 'win' && opt && standalone" skip (bug 2028652): its
reported failure, Expected 1296 / Actual 1168, is problem 1 (a 1280-wide
work area plus Windows' 8px invisible resize border on each side, 1280+16
maximized against 0.9*1280+16 restored). The test passes 46/46 with
--headless, where the exit-fullscreen resize is exercised, against 42/47
on base.

The mac 10.15 debug entry (bug 1780998) stays and is a different failure:
a fullscreen state mismatch, "Expected: fullscreen, Actual: normal", which
nothing here addresses. So does the linux 24.04 x11 entry of bug 1533982.

Assignee: nobody → florian
Status: NEW → ASSIGNED
Blocks: 2062142
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f4b81e111626 https://hg.mozilla.org/integration/autoland/rev/36f5e150f405 Do not treat the maximized browser window size as the "normal" size in browser_ext_windows_update.js, and wait for the exit-fullscreen resize in windows.update(), r=extension-reviewers,robwu.
Status: ASSIGNED → RESOLVED
Closed: 3 months 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: