Closed Bug 1414386 Opened 2 years ago Closed 2 years ago

nsBrowserGlue can uninit BrowserUsageTelemetry before it inits it

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 58
Tracking Status
firefox58 --- fixed

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(1 file)

nsBrowserGlue can uninit BrowserUsageTelemetry before it inits it, since it inits it on sessionstore-windows-restored and uninits it on quit-application-granted; and the latter can race the former if the browser quits shortly after startup, before windows have been restored.

When uninit races init, it reports this error:

JavaScript error: resource:///modules/BrowserUsageTelemetry.jsm, line 341: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]

This patch stores the init state in BrowserUsageTelemetry and exists uninit early if it hasn't been inited yet.

(It also makes BrowserUsageTelemetry a weak observer, although that isn't strictly necessary to resolve this issue.)
Attachment #8925124 - Flags: review?(mak77)
Comment on attachment 8925124 [details] [diff] [review]
ensure BrowserUsageTelemetry is inited before uniniting it

Review of attachment 8925124 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM, thanks
Attachment #8925124 - Flags: review?(mak77) → review+
Pushed by myk@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/911d141f1cb1
ensure BrowserUsageTelemetry is inited before uniniting it; r=mak
https://hg.mozilla.org/mozilla-central/rev/911d141f1cb1
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 58
You need to log in before you can comment on or make changes to this bug.