Fix bug 393802 for HTML links: remove them from the link map when they stop being links due to removeAttribute. r+sr=bz

This commit is contained in:
Jesse Ruderman 2008-09-10 15:12:43 -07:00
parent 9e72e6554f
commit 10a4553f65
3 changed files with 20 additions and 0 deletions

View File

@ -664,6 +664,10 @@ nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) PRBool aNotify)
{ {
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) { if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
SetLinkState(eLinkState_Unknown); SetLinkState(eLinkState_Unknown);
} }

View File

@ -279,6 +279,14 @@ nsresult
nsHTMLAreaElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsHTMLAreaElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) PRBool aNotify)
{ {
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
SetLinkState(eLinkState_Unknown);
}
if (aAttribute == nsGkAtoms::accesskey && if (aAttribute == nsGkAtoms::accesskey &&
aNameSpaceID == kNameSpaceID_None) { aNameSpaceID == kNameSpaceID_None) {
RegUnRegAccessKey(PR_FALSE); RegUnRegAccessKey(PR_FALSE);

View File

@ -322,6 +322,14 @@ nsresult
nsHTMLLinkElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsHTMLLinkElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) PRBool aNotify)
{ {
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->ForgetLink(this);
}
SetLinkState(eLinkState_Unknown);
}
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
aNotify); aNotify);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {