diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 38df20e4b1..bf7f42e3ee 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -753,7 +753,7 @@ Zotero.Attachments = new function(){ if ((contentType === 'text/html' || contentType === 'application/xhtml+xml') // Documents from XHR don't work here - && document instanceof Ci.nsIDOMDocument) { + && Zotero.Translate.DOMWrapper.unwrap(document) instanceof Ci.nsIDOMDocument) { Zotero.debug('Saving document with saveDocument()'); yield Zotero.Utilities.Internal.saveDocument(document, tmpFile); } diff --git a/chrome/content/zotero/xpcom/connector/server_connector.js b/chrome/content/zotero/xpcom/connector/server_connector.js index 2c3c447fff..b2b33778b4 100644 --- a/chrome/content/zotero/xpcom/connector/server_connector.js +++ b/chrome/content/zotero/xpcom/connector/server_connector.js @@ -929,6 +929,7 @@ Zotero.Server.Connector.SaveSnapshot.prototype = { var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); + parser.init(null, Services.io.newURI(data.url)); var doc = parser.parseFromString(`${data.html}`, 'text/html'); doc = Zotero.HTTP.wrapDocument(doc, data.url); diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index cf2f7fd1ea..1c4cedc555 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -462,7 +462,7 @@ Zotero.Utilities.Internal = { wbp.progressListener = listener; wbp.saveDocument( - document, + Zotero.Translate.DOMWrapper.unwrap(document), Zotero.File.pathToFile(destFile), Zotero.File.pathToFile(filesFolder), null, diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index f798735889..5a33d7ef06 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -2121,9 +2121,13 @@ Zotero.WebProgressFinishListener = function(onFinish) { let contentType = null; try { let r = _request || req; - _request.QueryInterface(Components.interfaces.nsIHttpChannel); - status = r.responseStatus; - contentType = r.contentType; + if (!r) { + Zotero.debug("WebProgressFinishListener: finished without a valid request") + } else { + r.QueryInterface(Components.interfaces.nsIHttpChannel); + status = r.responseStatus; + contentType = r.contentType; + } } catch (e) { Zotero.debug(e, 2);