From c1a5120e976d18072e80a6086ff0a6a8ef83cb88 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 21 Sep 2010 11:29:10 +0200 Subject: Adding parsed backtraces seems to be functional. Yuhooo! \o/ * rhbzpage.addNewAttachmentRow finally beaten into submission * util.parseXMLfromString ... it is better to hide this --- lib/util.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/util.js') diff --git a/lib/util.js b/lib/util.js index b258c5f..f9a14c7 100644 --- a/lib/util.js +++ b/lib/util.js @@ -41,7 +41,7 @@ var getParamsFromURL = exports.getParamsFromURL = function getParamsFromURL (url if (!url || (url.toString().length === 0)) { throw new Error("Missing URL value!"); } - + if (!(url instanceof urlMod.URL)) { url = new urlMod.URL(url.toString(), base); } @@ -60,6 +60,20 @@ var getParamsFromURL = exports.getParamsFromURL = function getParamsFromURL (url return params; }; +/** + * parse XML object out of string working around various bugs in Gecko implementation + * see https://developer.mozilla.org/en/E4X for more information + * + * @param inStr String with unparsed XML string + * @return XML object + */ +exports.parseXMLfromString = function parseXMLfromString (inStuff) { + // if (typeof inStuff !== 'string') In future we should recognize this.response + // and get just .text property out of it. TODO + var respStr = inStuff.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 + return new XML(respStr); +}; + /** * Get a bug no from URL ... fails with aliases * It should theoretically belong to bzpage.js, but we don't have -- cgit