Closed Bug 1244723 Opened 8 years ago Closed 8 years ago

xpcshell should shutdown profile after all the registered cleanup functions, not before them

Categories

(Testing :: XPCShell Harness, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: mak, Assigned: mak)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

do_get_profile registers profile shutdown topics through do_register_cleanup, but by doing so the function will be invoked before the cleanup functions registered by the test...
Instead it should be the last one, after the test cleanup functions.

We should probably not use do_register_cleanup, instead store it separately and invoke it before we walk the clenaup functions array.
(In reply to Marco Bonardo [::mak] from comment #0)
> We should probably not use do_register_cleanup, instead store it separately
> and invoke it before we walk the clenaup functions array.

ehr, that should have been "after".
Assignee: nobody → mak77
Status: NEW → ASSIGNED
Summary: xpcshell should run its cleanup after all the other functions registered through do_register_cleanup → xpcshell should shutdown profile after all the registered cleanup functions, not before them
looks like Try is showing some errors to be fixed.

Many (or all of them?) are "Unable to find a rejection expected by expectUncaughtRejection" that sounds like a positive thing!
Will check later and add another changeset on top.
Comment on attachment 8714343 [details]
MozReview Request: Bug 1244723 - xpcshell should shutdown profile after all the registered cleanup functions, not before them. r=ted

https://reviewboard.mozilla.org/r/33035/#review30025

Well that was silly. Good catch!
Attachment #8714343 - Flags: review?(ted) → review+
Comment on attachment 8714843 [details]
MozReview Request: Bug 1244723 - Remove some of the expected uncaught exceptions not happening anymore. r=ted

https://reviewboard.mozilla.org/r/33247/#review30027
Attachment #8714843 - Flags: review?(ted) → review+
The second part is not needed anymore since bug 989960 has temporarily been backed out.
Good to see less chances for error. There's no way to register an asynchronous cleanup function to be executed after profile shutdown notifications anymore (only synchronous through the observers), but I think this won't likely be needed in practice.

Remember to update the documentation of do_get_profile at:

https://developer.mozilla.org/en-US/docs/Mozilla/QA/Writing_xpcshell-based_unit_tests
Keywords: dev-doc-needed
(In reply to :Paolo Amadini from comment #9)
> Good to see less chances for error. There's no way to register an
> asynchronous cleanup function to be executed after profile shutdown
> notifications anymore (only synchronous through the observers), but I think
> this won't likely be needed in practice.

you can add an observer to do that, if needed, and you can use async shutdown tooling to wait for async functions.
the scope of cleanup functions is cleanup, not really do testing of shutdown or such.

> Remember to update the documentation of do_get_profile at:
> 
> https://developer.mozilla.org/en-US/docs/Mozilla/QA/Writing_xpcshell-
> based_unit_tests

what should I update there? it still looks correct to me.
ah I see, the note.
https://hg.mozilla.org/mozilla-central/rev/b49ff0115100
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: