bug 305243 set an XML content-type hint on XMLHttpRequest channels, to always

parse local files as XML.
Also, make TestXMLExtras convert non-ASCII bytes to UTF-16 correctly.
r=jst sr=bz
This commit is contained in:
cbiesinger%web.de 2005-09-07 12:51:17 +00:00
Родитель 3ed69aa48f
Коммит 57d51d23c8
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -1579,6 +1579,11 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
listener = this;
}
// Since we expect XML data, set the type hint accordingly
// This means that we always try to parse local files as XML
// ignoring return value, as this is not critical
mChannel->SetContentType(NS_LITERAL_CSTRING("application/xml"));
// Start reading from the channel
ChangeState(XML_HTTP_REQUEST_SENT);
rv = mChannel->AsyncOpen(listener, nsnull);

Просмотреть файл

@ -57,6 +57,7 @@
#include <nsIDOMLoadListener.h>
#include "nsContentCID.h"
#include "nsReadableUtils.h"
#include "nsNativeCharsetUtils.h"
static NS_DEFINE_CID( kXMLDocumentCID, NS_XMLDOCUMENT_CID );
#if 0
@ -152,7 +153,8 @@ int main (int argc, char* argv[])
&rv );
if (NS_SUCCEEDED( rv )) {
nsString str; str.AssignWithConversion(argv[2]);
nsString str;
NS_CopyNativeToUnicode(nsDependentCString(argv[2]), str);
rv = pDOMParser->ParseFromString(str.get(), "application/xml",
getter_AddRefs( pDOMDocument ) );