Bug 357830: use parseFromBuffer instead of doing byte->string conversion manually, to benefit from nsDomParser's charset detection, r=mano

This commit is contained in:
gavin@gavinsharp.com 2007-05-02 13:06:43 -07:00
parent a8da5788c4
commit 24ad3c798b

View File

@ -1158,12 +1158,9 @@ Engine.prototype = {
switch (aEngine._dataType) {
case SEARCH_DATA_XML:
var dataString = bytesToString(aBytes, "UTF-8");
ENSURE(dataString, "_onLoad: Couldn't convert byte array!",
Cr.NS_ERROR_FAILURE);
var parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
var doc = parser.parseFromString(dataString, "text/xml");
var doc = parser.parseFromBuffer(aBytes, aBytes.length, "text/xml");
aEngine._data = doc.documentElement;
break;
case SEARCH_DATA_TEXT: