From e1594ce3d6b822d1c4b6c339d6c841b85e54d743 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 28 Feb 2012 16:29:12 -0500 Subject: [PATCH] Don't fire callback to processDocuments() if document.readyState is still "loading" This fixes the AMS bug, but it may break other things. We'll see when the unit tests run tonight. --- chrome/content/zotero/xpcom/http.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 3635bcb603..9534b2ffc1 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -527,12 +527,13 @@ Zotero.HTTP = new function() { * @inner */ var onLoad = function() { - if(hiddenBrowser.contentDocument.location.href == "about:blank") return; - Zotero.debug(hiddenBrowser.contentDocument.location.href+" has been loaded"); - if(hiddenBrowser.contentDocument.location.href != prevUrl) { // Just in case it fires too many times - prevUrl = hiddenBrowser.contentDocument.location.href; + var doc = hiddenBrowser.contentDocument, + url = doc.location.href.toString(); + if(url == "about:blank" || doc.readyState === "loading") return; + if(url !== prevUrl) { // Just in case it fires too many times + prevUrl = url; try { - processor(hiddenBrowser.contentDocument); + processor(doc); } catch(e) { removeListeners(); if(exception) {