mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
7413aa0cdc
From bug 1065128 SettingsManager has been changed to listen the dom-window-destroyed event for its cleanup. However, when running Gaia in Mulet, a race condition is exposed. For B2G, when loading a page, about:blank is first used. This means that window destroyed events will be triggered. However, from the dom-window-destroyed event we cannot distinguish whether this is about:blank or a legit application being closed. SettingsManager gets initialized (i.e., init() called) when the application makes use of navigator.mozSettings. So the chain of event is that we have a SettingsManager living because System app did some request. At this time, about:blank is being unloaded and triggers a dom-window-destroyed event. This makes SettingsManager doing its cleanup, especially freeing the window reference. Then in the meantime, we have the navigator.mozSettings use that is progressing. At some point, SettingsManager has no more window to send messages to, and Gaia is not able to even start. SettingsRequestManager lives on the parent process and SettingsManager lives on the child side. Part of the cleanup performed by SettingsManager was to ensure pending locks on the parent process would be forced to finalize to make sure those are being properly committed. We move this cleanup to SettingsRequestManager and we augment the lock informations with the proper inner window id. This way we can track which lock is attached to which inner window when the lock gets created. And thus we can listen on inner-window-destroyed from SettingsRequestManager to be able to force finalize on any pending lock. Impacted code path are those were we are not running out of process. When we are running out of process, SettingsRequestManager already listens on the child-process-shutdown event to perform the lock finalization. |
||
---|---|---|
.. | ||
tests | ||
moz.build | ||
SettingsDB.jsm | ||
SettingsManager.js | ||
SettingsManager.manifest | ||
SettingsRequestManager.jsm | ||
SettingsService.js | ||
SettingsService.manifest |