From b916935256ee533c0caa6f398916f74671f9e288 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 8 Dec 2011 01:28:57 -0500 Subject: [PATCH 1/2] Replace direct nsITimer call with setTimeout() --- chrome/content/zotero/xpcom/attachments.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 86a53a1a8..40cab4c05 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -328,11 +328,9 @@ Zotero.Attachments = new function(){ // if it fails // // TODO: index later - var timer = Components.classes["@mozilla.org/timer;1"]. - createInstance(Components.interfaces.nsITimer); - timer.initWithCallback({notify: function() { + setTimeout(function() { Zotero.Fulltext.indexItems([itemID]); - }}, 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT); + }, 1000); } catch (e) { // Clean up From 14bb52a43f42dc6271128b4989460bbaafb40833 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 8 Dec 2011 01:35:24 -0500 Subject: [PATCH 2/2] Replace a couple more nsITimer calls --- chrome/content/zotero/xpcom/attachments.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 40cab4c05..4b8216731 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -610,10 +610,9 @@ Zotero.Attachments = new function(){ // we'll index it later if it fails // // TODO: index later - var timer = Components.classes["@mozilla.org/timer;1"]. - createInstance(Components.interfaces.nsITimer); - timer.initWithCallback({notify: f}, 1000, - Components.interfaces.nsITimer.TYPE_ONE_SHOT); + setTimeout(function () { + f(); + }, 1000); } catch (e) { // Clean up @@ -650,10 +649,9 @@ Zotero.Attachments = new function(){ Zotero.Notifier.trigger('add', 'item', itemID); // Wait a second before indexing (see note above) - var timer = Components.classes["@mozilla.org/timer;1"]. - createInstance(Components.interfaces.nsITimer); - timer.initWithCallback({notify: f}, 1000, - Components.interfaces.nsITimer.TYPE_ONE_SHOT); + setTimeout(function () { + f(); + }, 1000); } // Caution: Take care using this itemID. The notifier may not yet have been called,