gecko-dev/dom/settings
Alexandre Lissy 7413aa0cdc Bug 1082001 - Cleanup settings lock from parent itself. r=bent
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.
2014-10-29 02:36:00 -04:00
..
tests Bug 1076597 - Fix Settings API shutdown race condition. r=bent 2014-10-09 05:12:00 -04:00
moz.build Bug 1076597 - Fix Settings API shutdown race condition. r=bent 2014-10-09 05:12:00 -04:00
SettingsDB.jsm Bug 1047483 - patch 1 - Porting DOMFile/DOMBlob to WebIDL, r=bz, r=bkelly, r=bholley 2014-10-08 17:15:22 +01:00
SettingsManager.js Bug 1082001 - Cleanup settings lock from parent itself. r=bent 2014-10-29 02:36:00 -04:00
SettingsManager.manifest Bug 889503 - Move Settings API to WebIDL. r=gwagner r=bz 2013-07-15 18:17:46 -07:00
SettingsRequestManager.jsm Bug 1082001 - Cleanup settings lock from parent itself. r=bent 2014-10-29 02:36:00 -04:00
SettingsService.js Bug 1015518 - Use SettingsRequestManager as SettingsService Backend; r=bent 2014-08-27 21:01:31 -07:00
SettingsService.manifest