Closed Bug 1946642 Opened 16 days ago Closed 15 days ago

Unable to cleanup MockFilePicker if init called more than once

Categories

(Testing :: General, defect)

defect

Tracking

(firefox137 fixed)

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

Details

Attachments

(1 file)

In a test, I was calling MockFilePicker.init() several times (unnecessarily).
The test worked fine on its own, but then on try when running the full test suite, another test started failing because it was calling MockFilePicker.cleanup() as a registerCleanupFunction.

If init() is called more than once we lose the reference to the factory which was registered and it's impossible to cleanup the MockFilePicker.
We should either fix it or throw early.

Calling init twice currently makes it impossible to cleanup the MockFilePicker later on.
This change will automatically call cleanup() in case a previous MockFilePicker factory was already
registered.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d7ade04a809 MockFilePicker should handle multiple calls to init() gracefully r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: