Bug 887889 - Clean up ContentPrefServiceChild on xpcom-shutdown r=mak

I'm not sure why this became necessary as a result of migrating to
Sqlite.jsm, but this is the only way I've found to eliminate
leaks from the tab process on shutdown. These leaks occur when
the child process requests something from the ContentPrefService2
but shuts down before it gets its response.

MozReview-Commit-ID: 2Haks17D6Em

--HG--
extra : rebase_source : 6a5d213620ae497e3d073e70a3d5da4f2bb3b702
This commit is contained in:
Doug Thayer 2018-03-30 15:54:08 -07:00
parent b14f6090bc
commit 957135b686

View File

@ -62,6 +62,13 @@ var ContentPrefServiceChild = {
Services.cpmm.addMessageListener("ContentPrefs:HandleResult", this);
Services.cpmm.addMessageListener("ContentPrefs:HandleError", this);
Services.cpmm.addMessageListener("ContentPrefs:HandleCompletion", this);
Services.obs.addObserver(this, "xpcom-shutdown");
},
observe() {
Services.obs.removeObserver(this, "xpcom-shutdown");
delete this._observers;
delete this._requests;
},
receiveMessage(msg) {