Make sure not to save magic _base_href attributes when saving a DOM. Bug

253507, r+sr=jst


git-svn-id: svn://10.0.0.236/trunk@160330 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu 2004-08-04 03:14:18 +00:00
parent 48b2ead6fc
commit dabfcb515f

View File

@ -2788,11 +2788,26 @@ nsWebBrowserPersist::GetNodeToFixup(nsIDOMNode *aNodeIn, nsIDOMNode **aNodeOut)
{
if (!(mPersistFlags & PERSIST_FLAGS_FIXUP_ORIGINAL_DOM))
{
return aNodeIn->CloneNode(PR_FALSE, aNodeOut);
nsresult rv = aNodeIn->CloneNode(PR_FALSE, aNodeOut);
NS_ENSURE_SUCCESS(rv, rv);
}
else
{
NS_ADDREF(*aNodeOut = aNodeIn);
}
nsCOMPtr<nsIDOMHTMLElement> element(do_QueryInterface(*aNodeOut));
if (element) {
// Make sure this is not XHTML
nsAutoString namespaceURI;
element->GetNamespaceURI(namespaceURI);
if (namespaceURI.IsEmpty()) {
// This is a tag-soup node. It may have a _base_href attribute
// stuck on it by the parser, but since we're fixing up all URIs
// relative to the overall document base that will screw us up.
// Just remove the _base_href.
element->RemoveAttribute(NS_LITERAL_STRING("_base_href"));
}
}
*aNodeOut = aNodeIn;
NS_ADDREF((*aNodeOut));
return NS_OK;
}