Closed Bug 2067577 Opened 1 day ago Closed 11 hours ago

Adjust lint rules to require SpecialPowers.pushPrefEnv for preference changes in browser tests

Categories

(Thunderbird :: General, task)

task
Points:
1

Tracking

(Not tracked)

RESOLVED FIXED
157 Branch

People

(Reporter: tobyp, Assigned: tobyp)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

Browser tests should use SpecialPowers.pushPrefEnv() instead of directly changing preferences with Services.prefs to ensure preferences are restored automatically, including when a test fails before reaching its cleanup code.

After the direct preference changes have been migrated in bug 1982429 and bug 2066871, add ESLint enforcement for browser-test paths matching /test/*/browser/.

The lint check should report:

Services.prefs.set*Pref(...)
Services.prefs.clearUserPref(...)

The diagnostic should direct developers to use SpecialPowers.pushPrefEnv() with set or clear as appropriate.

Tests that intentionally exercise the preference service directly can use narrowly scoped ESLint exemptions.

Assignee: nobody → toby
Status: NEW → ASSIGNED
Target Milestone: --- → 157 Branch

Pushed by edicharry@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/566f7f744b4a
Require SpecialPowers.pushPrefEnv for preference changes in browser tests. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 11 hours ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: