зеркало из https://github.com/mozilla/gecko-dev.git
Bug 262222 : Relative URLs in Live Bookmark link elements not resolved, patch by Sam Ruby <rubys@intertwingly.net>, r=vlad, a=bsmedberg
This commit is contained in:
Родитель
c1d7b1191f
Коммит
44a7961ddc
|
@ -65,6 +65,7 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOM3Node.h"
|
||||
|
||||
/* These are defined in nsBookmarksService.cpp */
|
||||
extern nsIRDFResource *kRDF_type;
|
||||
|
@ -93,6 +94,7 @@ extern nsIRDFContainerUtils *gRDFC;
|
|||
|
||||
static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kStdURLCID, NS_STANDARDURL_CID);
|
||||
|
||||
nsresult nsBMSVCClearSeqContainer (nsIRDFDataSource* aDataSource, nsIRDFResource* aResource);
|
||||
nsresult nsBMSVCUnmakeSeq (nsIRDFDataSource* aDataSource, nsIRDFResource* aResource);
|
||||
|
@ -562,6 +564,7 @@ nsFeedLoadListener::TryParseAsSimpleRSS ()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> xmldoc;
|
||||
parser->SetBaseURI(mURI);
|
||||
rv = parser->ParseFromBuffer ((const PRUint8*) mBody.get(), mBody.Length(), "text/xml", getter_AddRefs(xmldoc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -702,6 +705,23 @@ nsFeedLoadListener::TryParseAsSimpleRSS ()
|
|||
{
|
||||
rv = linkElem->GetAttribute(NS_LITERAL_STRING("href"), linkStr);
|
||||
if (NS_FAILED(rv)) break; // out of while(childNode) loop
|
||||
|
||||
nsCOMPtr<nsIDOM3Node> linkElem3 = do_QueryInterface(childNode);
|
||||
if (linkElem3) {
|
||||
// get the BaseURI
|
||||
nsAutoString baseURI;
|
||||
linkElem3->GetBaseURI(baseURI);
|
||||
nsCOMPtr<nsIURI> base;
|
||||
base = nsCOMPtr<nsIURI>(do_CreateInstance(kStdURLCID, &rv));
|
||||
base->SetSpec(NS_ConvertUCS2toUTF8(baseURI));
|
||||
|
||||
// use it to resolve linkStr to an absolute URI
|
||||
nsCString result;
|
||||
rv = base->Resolve(NS_ConvertUCS2toUTF8(linkStr), result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
linkStr = NS_ConvertUTF8toUCS2(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (linkStr.IsEmpty()) {
|
||||
// in node's TEXT
|
||||
|
|
Загрузка…
Ссылка в новой задаче