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.
This commit is contained in:
Simon Kornblith 2012-02-28 16:29:12 -05:00
parent fbef301fe0
commit e1594ce3d6

View file

@ -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) {