mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 520526 - Changes to TimerManager cause test_preventive_maintenance.js to leak due to PlacesDBUtils using TimerManager. r=mak77, r=dtownsend
This commit is contained in:
parent
3c5ad17de1
commit
aa6793b649
@ -192,6 +192,12 @@ function LOG(module, string) {
|
||||
}
|
||||
}
|
||||
|
||||
function getObserverService()
|
||||
{
|
||||
return Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
}
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gApp", function() {
|
||||
@ -748,12 +754,6 @@ function readStringFromFile(file) {
|
||||
return text;
|
||||
}
|
||||
|
||||
function getObserverService()
|
||||
{
|
||||
return Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
}
|
||||
|
||||
function getDefaultPrefBranch()
|
||||
{
|
||||
return gPref.QueryInterface(Ci.nsIPrefService).getDefaultBranch(null);
|
||||
@ -3160,6 +3160,8 @@ UpdatePrompt.prototype = {
|
||||
* @constructor
|
||||
*/
|
||||
function TimerManager() {
|
||||
let os = getObserverService();
|
||||
os.addObserver(this, "xpcom-shutdown", false);
|
||||
}
|
||||
TimerManager.prototype = {
|
||||
/**
|
||||
@ -3192,19 +3194,19 @@ TimerManager.prototype = {
|
||||
* See nsIObserver.idl
|
||||
*/
|
||||
observe: function TM_observe(aSubject, aTopic, aData) {
|
||||
var os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
switch (aTopic) {
|
||||
case "profile-after-change":
|
||||
os.addObserver(this, "xpcom-shutdown", false);
|
||||
this._start();
|
||||
break;
|
||||
case "xpcom-shutdown":
|
||||
let os = getObserverService();
|
||||
os.removeObserver(this, "xpcom-shutdown");
|
||||
|
||||
// Release everything we hold onto.
|
||||
this._timer.cancel();
|
||||
this._timer = null;
|
||||
if (this._timer) {
|
||||
this._timer.cancel();
|
||||
this._timer = null;
|
||||
}
|
||||
for (var timerID in this._timers)
|
||||
delete this._timers[timerID];
|
||||
this._timers = null;
|
||||
|
Loading…
Reference in New Issue
Block a user