Fix bug 725478 because we run a buggy Python released almost 5 years ago; r=tigerblood

This commit is contained in:
Gregory Szorc 2012-02-27 16:15:59 -08:00
parent e5a23e2884
commit 8e14fcd32b

View File

@ -463,10 +463,14 @@ class XPCShellTests(object):
failure.setAttribute("type", str(result["failure"]["type"]))
failure.setAttribute("message", result["failure"]["message"])
# Lossy translation but required to not break CDATA.
# Lossy translation but required to not break CDATA. Also, text could
# be None and Python 2.5's minidom doesn't accept None. Later versions
# do, however.
cdata = result["failure"]["text"]
if cdata is not None:
cdata = cdata.replace("]]>", "]] >")
if not isinstance(cdata, str):
cdata = ""
cdata = cdata.replace("]]>", "]] >")
text = doc.createCDATASection(cdata)
failure.appendChild(text)
testcase.appendChild(failure)