www

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

commit aad29a5469f8684226befc3890945850b845f27e
parent f69c7d2e2daa275d7c4454817337c06b5fe9aec0
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date:   Wed, 25 Apr 2018 14:07:49 +0300

Use XPCOM DOMParser in http integration client to avoid addon conflicts

Diffstat:
Mchrome/content/zotero/xpcom/connector/httpIntegrationClient.js | 17+++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/connector/httpIntegrationClient.js b/chrome/content/zotero/xpcom/connector/httpIntegrationClient.js @@ -171,18 +171,11 @@ Zotero.HTTPIntegrationClient.Field.prototype.getText = async function() { Zotero.HTTPIntegrationClient.Field.prototype.setText = async function(text, isRich) { // The HTML will be stripped by Google Docs and and since we're // caching this value, we need to strip it ourselves - if (isRich) { - var win = window; - if (!win) { - var wm = Services.wm; - var win = wm.getMostRecentWindow('navigator:browser'); - } - var doc = new win.DOMParser().parseFromString(text, "text/html"); - this._text = doc.documentElement.textContent; - } else { - this._text = text; - } - return Zotero.HTTPIntegrationClient.sendCommand("Field.setText", [this._documentID, this._id, text, isRich]); + var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] + .createInstance(Components.interfaces.nsIDOMParser); + var doc = parser.parseFromString(text, "text/html"); + this._text = doc.documentElement.textContent; + return Zotero.HTTPIntegrationClient.sendCommand("Field.setText", [this._documentID, this._id, text, true]); }; Zotero.HTTPIntegrationClient.Field.prototype.getCode = async function() { return this._code;