fx-compat: nsIIdleServicensIUserIdleService

This commit is contained in:
Dan Stillman 2022-05-04 05:48:14 -04:00
parent 1714351cc9
commit f91bf49aae
4 changed files with 14 additions and 14 deletions

View file

@ -1532,8 +1532,8 @@ Zotero.Items = function() {
}
};
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"].
getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"].
getService(Components.interfaces.nsIUserIdleService);
idleService.addIdleObserver(this._emptyTrashIdleObserver, 305);
}

View file

@ -1234,8 +1234,8 @@ Zotero.DBConnection.prototype._getConnectionAsync = async function (options) {
// Register idle observer for DB backup
Zotero.Schema.schemaUpdatePromise.then(() => {
Zotero.debug("Initializing DB backup idle observer");
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
idleService.addIdleObserver(this, 300);
});
}

View file

@ -850,8 +850,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
if (!_idleObserverIsRegistered) {
Zotero.debug("Starting full-text content processor");
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
idleService.addIdleObserver(this.idleObserver, _idleObserverDelay);
_idleObserverIsRegistered = true;
}
@ -861,8 +861,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
this.unregisterContentProcessor = function () {
if (_idleObserverIsRegistered) {
Zotero.debug("Unregistering full-text content processor idle observer");
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
idleService.removeIdleObserver(this.idleObserver, _idleObserverDelay);
_idleObserverIsRegistered = false;
}
@ -894,8 +894,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
this.processUnprocessedContent = Zotero.Promise.coroutine(function* (itemIDs) {
// Idle observer can take a little while to trigger and may not cancel the setTimeout()
// in time, so check idle time directly
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
if (idleService.idleTime < _idleObserverDelay * 1000) {
return;
}

View file

@ -245,8 +245,8 @@ Zotero.Sync.EventListeners.IdleListener = {
register: function () {
Zotero.debug("Registering auto-sync idle observer");
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
idleService.addIdleObserver(this, this._idleTimeout);
idleService.addIdleObserver(this._backObserver, this._backTimeout);
},
@ -299,8 +299,8 @@ Zotero.Sync.EventListeners.IdleListener = {
unregister: function () {
Zotero.debug("Unregistering auto-sync idle observer");
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
.getService(Components.interfaces.nsIIdleService);
var idleService = Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService);
idleService.removeIdleObserver(this, this._idleTimeout);
idleService.removeIdleObserver(this._backObserver, this._backTimeout);
}