From e45ee36117b2c5fdb4d84db539dede53aba73171 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 15 Nov 2008 20:26:36 +0000 Subject: [PATCH] Fix invalid progress values due to Firefox bug (fixed in 3.1) --- chrome/content/zotero/xpcom/storage.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index cde3a905f8..3b50609d88 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -2068,6 +2068,13 @@ Zotero.Sync.Storage = new function () { + "_Zotero.Sync.Storage._updateProgress()"); } + // Workaround for invalid progress values (possibly related to + // https://bugzilla.mozilla.org/show_bug.cgi?id=451991 and fixed in 3.1) + if (progress < r.progress) { + //Zotero.debug("Invalid progress (" + progress + " < " + r.progress + ")"); + return; + } + _totalProgress[queue] += progress - r.progress; r.progress = progress; @@ -2336,6 +2343,11 @@ Zotero.Sync.Storage.StreamListener.prototype = { // nsIProgressEventSink onProgress: function (request, context, progress, progressMax) { + // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=451991 + // (fixed in Fx3.1) + if (progress > progressMax) { + progress = progressMax; + } //Zotero.debug("onProgress with " + progress + "/" + progressMax); this._onProgress(request, progress, progressMax); },