Closed Bug 2019592 Opened 5 months ago Closed 5 months ago

NimbusTestUtils._testSuite retains test scope through shutdown, causing window leaks

Categories

(Firefox :: Nimbus Desktop Client, defect)

defect

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: florian, Assigned: florian)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

NimbusTestUtils.init(this) stores a reference to the test's global scope in a module-level _testSuite variable. Since var declarations in browser chrome tests become properties of the global object, any window references stored in vars are kept alive through shutdown via the chain: ModuleLoaderBase → NimbusTestUtils.sys.mjs → _testSuite → (test global) → window.

This causes shutdown leaks for any test that both uses NimbusTestUtils (via head.js) and stores window references in global vars. For example, browser_site_login_exceptions_policy.js leaks its subdialog windows this way.

The fix is to have NimbusTestUtils.init() register a cleanup function on the test scope that nulls out _testSuite when the test finishes.

The reference paths are visible when hovering the "FAIL" markers in this profile produced with the patches from bug 2019756.

NimbusTestUtils.init() stored the entire test global scope in _testSuite,
which retained all var declarations (including window references) through
shutdown. Instead, capture only the Assert instance directly.

Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a94ea6683c31 https://hg.mozilla.org/integration/autoland/rev/8bfabdb43012 Fix shutdown leak in NimbusTestUtils by not retaining test scope, r=nimbus-reviewers,beth.
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: