Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Use pushPref helper in mochitests to set temporary pref values#5128

Merged
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
juliandescottes:use-push-pref-helper
Jan 17, 2018
Merged

Use pushPref helper in mochitests to set temporary pref values#5128
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
juliandescottes:use-push-pref-helper

Conversation

@juliandescottes

Copy link
Copy Markdown
Member

Use the pushPref helper whenever possible in mochitests, otherwise the preference changes leak from one test to another.

Also simplified some tests that used to set the preference and restore it on cleanup. First, there was no added value compared to pushPref. Secondly, the restore was not wrong. It should restore to the original value (read at the beginning of the test) rather than to a random set value (eg. false).

Let's see if tests still pass.

@juliandescottes

juliandescottes commented Jan 17, 2018

Copy link
Copy Markdown
Member Author

Can't use it for devtools.toolbox.splitconsoleEnabled in browser_dbg-console.js because this pref is automatically cleared by shared-head.js and pushPref has a tendency to freeze when the prefs get modified by something else during the test.

https://github.com/devtools-html/debugger.html/blob/master/src/test/mochitest/browser_dbg-console.js#L25

@jasonLaster jasonLaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants