Permalink
Browse files

Enhanced test if result is an XML

  • Loading branch information...
1 parent 74f9c11 commit 8499b5d4d19887fa873db33cb6817d487b179a8b @SebastianZ SebastianZ committed with janodvarko Jul 24, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 tests/FBTest/content/testResultRep.js
@@ -512,7 +512,15 @@ FBTestApp.TestResultTabView = domplate(
isXml: function(text)
{
- return text && text.indexOf("<") == 0;
+ var parser = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser);
+
+ // Create helper root element (for the case where there is no signle root).
+ var tempXml = "<wrapper>" + text + "</wrapper>";
+ var doc = parser.parseFromString(tempXml, "text/xml");
+ var docElem = doc.documentElement;
+ var nsURI = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
+
+ return docElem.namespaceURI != nsURI && docElem.nodeName != "parsererror";
},
onSwitchView: function(event)
@@ -656,7 +664,7 @@ FBTestApp.TestResult = function(win, pass, msg, expected, result)
this.fileName = location.substr(location.lastIndexOf("/") + 1);
this.pass = pass ? true : false;
- this.msg = clean(msg);
+ this.msg = msg;//clean(msg);
// Make sure the following values are strings.
this.expected = expected ? expected + "" : null;

0 comments on commit 8499b5d

Please sign in to comment.