Fix for bug 68824 (XMLParser::getDocumentFromURI returns empty documents for missing pages). r=Pike, sr=bz.

This commit is contained in:
peterv%propagandism.org 2005-11-02 07:42:43 +00:00
Родитель 370b372d38
Коммит 0c7d982c52
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -129,10 +129,18 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
// the document.
nsIDOMDocument* theDocument = nsnull;
rv = loader->LoadDocumentAsXML(channel, loaderUri, &theDocument);
if (NS_FAILED(rv) || !theDocument) {
PRBool succeeded = NS_SUCCEEDED(rv) && theDocument;
if (succeeded && http) {
PRBool httpSucceeded;
rv = http->GetRequestSucceeded(&httpSucceeded);
succeeded = NS_SUCCEEDED(rv) && httpSucceeded;
}
if (!succeeded) {
aErrMsg.Append(NS_LITERAL_STRING("Document load of ") +
aHref + NS_LITERAL_STRING(" failed."));
return rv;
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
}
*aResult = txXPathNativeNode::createXPathNode(theDocument);