www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 13c3e5427e80e1a9b5bc0691e08594b6174cc84a
parent f24091626d20de660344a327113a158b2cf33699
Author: aurimasv <aurimas.dev@gmail.com>
Date:   Fri, 18 Jan 2013 10:08:56 -0600

Eliminate race condition during processDocuments call with multiple URLs

Diffstat:
Mchrome/content/zotero/xpcom/http.js | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js @@ -492,8 +492,7 @@ Zotero.HTTP = new function() { // (Approximately) how many seconds to wait if the document is left in the loading state and // pageshow is called before we call pageshow with an incomplete document const LOADING_STATE_TIMEOUT = 120; - var firedLoadEvent = 0, - loaded = false; + var firedLoadEvent = 0; /** * Loads the next page @@ -504,7 +503,6 @@ Zotero.HTTP = new function() { var url = urls[currentURL], hiddenBrowser = hiddenBrowsers[currentURL]; firedLoadEvent = 0; - loaded = false; currentURL++; try { Zotero.debug("Zotero.HTTP.processDocuments: Loading "+url); @@ -529,9 +527,9 @@ Zotero.HTTP = new function() { * @inner */ var onLoad = function(e) { - if(loaded) return; var hiddenBrowser = e.currentTarget, doc = hiddenBrowser.contentDocument; + if(hiddenBrowser.zotero_loaded) return; if(!doc) return; var url = doc.documentURI; if(url === "about:blank") return; @@ -543,7 +541,7 @@ Zotero.HTTP = new function() { Zotero.debug("Zotero.HTTP.processDocuments: "+url+" loaded"); hiddenBrowser.removeEventListener("pageshow", onLoad, true); - loaded = true; + hiddenBrowser.zotero_loaded = true; try { processor(doc);