BrowserApp does not properly clean up on shutdown

NEW
Unassigned

Status

()

Firefox for Android
General
4 years ago
a year ago

People

(Reporter: mcomella, Unassigned)

Tracking

Trunk
All
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Notably the observers registered in BrowserApp.startup(...) [1] are missing from BrowserApp.shutdown(...) [2].

[1]: https://hg.mozilla.org/mozilla-central/file/b1b292d8e383/mobile/android/chrome/content/browser.js#l262
[2]: https://hg.mozilla.org/mozilla-central/file/b1b292d8e383/mobile/android/chrome/content/browser.js#l644

mbrubeck said we may be able to pass ownsWeak=true to addObserver, rather than making many removeObserver calls.

There may be other things that we're not cleaning up properly so it may be worth investigating further for BrowserApp (and other systems), particularly becouse, as nalexander puts it: "Understanding these lifecycles is hard, and changing as we add background services, rework our activity flow, and implement geckoview."
I'm not against the cleanup, but I think part of the reason we see the disconnect is: What bad things will happen if we miss shutdown?
* We are closing the window, and presumably the app
* Android will likely kill us without ever getting to shutdown

It's true this could become a different story in the future. I might predict that adding the ability to use multiple GeckoViews in an app would mean multiple browser.js windows being created. In this case, we might see a benefit from having proper cleanup.
Something worth tracking?
You need to log in before you can comment on or make changes to this bug.