Open Bug 1432690 Opened 2 years ago Updated 2 years ago

SimpleTest.registerCleanupFunction silently doesn't work in mochitest browser-chrome (bare registerCleanupFunction works)

Categories

(Testing :: Mochitest, enhancement, major)

enhancement
Not set
major

Tracking

(Not tracked)

People

(Reporter: MattN, Unassigned)

References

()

Details

Attachments

(1 file, 1 obsolete file)

If `registerCleanupFunction` is called on the `SimpleTest` object in a mochitest-browser-chrome test like:
> SimpleTest.registerCleanupFunction(() => … )
then the callback is never called. Calling the bare function works fine:
> registerCleanupFunction(() => … )

This is bad since devs expect it to work (and possibly it used to work).

Examples of cleanup functions that are never called due to this bug:
* https://dxr.mozilla.org/mozilla-central/search?q=SimpleTest.registerCleanupFunction+path%3Abrowser_&redirect=false
* https://dxr.mozilla.org/mozilla-central/search?q=SimpleTest.registerCleanupFunction+path%3Ahead.js&redirect=false

Possible solutions:
1) Fix `SimpleTest.registerCleanupFunction` to work with `registerCleanupFunction` 
2) `SimpleTest.registerCleanupFunction` should throw if it's called in a browser-chrome test
3) `SimpleTest.registerCleanupFunction` shouldn't be defined in a browser-chrome test
Assignee: nobody → MattN+bmo
Status: NEW → ASSIGNED
Attachment #8944973 - Attachment is obsolete: true
Assignee: MattN+bmo → nobody
Status: ASSIGNED → NEW
Component: BrowserTest → Mochitest
You need to log in before you can comment on or make changes to this bug.