diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp
index a4e96d64835..17cfa57ac1e 100644
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1178,13 +1178,17 @@ nsresult
nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify)
{
+ PRBool contentEditable = PR_FALSE;
+ PRInt32 contentEditableChange;
+
+ if (aNameSpaceID == kNameSpaceID_None) {
+ contentEditable = PR_TRUE;
+ contentEditableChange = GetContentEditableValue() == eTrue ? -1 : 0;
+ }
+
// Check for event handlers
if (aNameSpaceID == kNameSpaceID_None) {
- if (aAttribute == nsGkAtoms::contenteditable) {
- ChangeEditableState(GetContentEditableValue() == eTrue ? -1 : 0);
- }
- else if (nsContentUtils::IsEventAttributeName(aAttribute,
- EventNameType_HTML)) {
+ if (nsContentUtils::IsEventAttributeName(aAttribute, EventNameType_HTML)) {
nsCOMPtr manager;
GetListenerManager(PR_FALSE, getter_AddRefs(manager));
@@ -1194,8 +1198,15 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
}
}
- return nsGenericHTMLElementBase::UnsetAttr(aNameSpaceID, aAttribute,
- aNotify);
+ nsresult rv = nsGenericHTMLElementBase::UnsetAttr(aNameSpaceID, aAttribute,
+ aNotify);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (contentEditable) {
+ ChangeEditableState(contentEditableChange);
+ }
+
+ return NS_OK;
}
already_AddRefed
diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in
index 7be92e37a0c..7ef48c1827e 100644
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -122,6 +122,7 @@ _TEST_FILES = test_bug589.html \
test_bug441930.html \
test_bug442801.html \
test_bug448166.html \
+ test_bug460568.html \
$(NULL)
libs:: $(_TEST_FILES)
diff --git a/content/html/content/test/test_bug460568.html b/content/html/content/test/test_bug460568.html
new file mode 100644
index 00000000000..d1c0dbf3872
--- /dev/null
+++ b/content/html/content/test/test_bug460568.html
@@ -0,0 +1,77 @@
+
+
+
+
+ Test for Bug 460568
+
+
+
+
+
+
+Mozilla Bug 460568
+a[href]
+
+
+
+
+
+