Only collect timeline profiles when the profiler is active.

Fixes:

https://bugzilla.mozilla.org/show_bug.cgi?id=1031931