diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp
index f1fd0de59df..71127a199bf 100644
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -301,23 +301,26 @@ NS_IMETHODIMP
nsHTMLOptionElement::GetDefaultSelected(PRBool* aDefaultSelected)
{
nsHTMLValue val;
- nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::selected, val);
- *aDefaultSelected = (NS_CONTENT_ATTR_NOT_THERE != rv);
- return NS_OK;
+ nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::selected, val);
+ *aDefaultSelected = (NS_CONTENT_ATTR_NOT_THERE != rv);
+ return NS_OK;
}
NS_IMETHODIMP
nsHTMLOptionElement::SetDefaultSelected(PRBool aDefaultSelected)
{
+ nsresult rv = NS_OK;
nsHTMLValue empty(eHTMLUnit_Empty);
- // When setting DefaultSelected, we must also reset Selected
- SetSelected(aDefaultSelected);
if (aDefaultSelected) {
- return mInner.SetHTMLAttribute(nsHTMLAtoms::selected, empty, PR_TRUE);
+ rv = mInner.SetHTMLAttribute(nsHTMLAtoms::selected, empty, PR_TRUE);
} else {
- mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::selected, PR_TRUE);
- return NS_OK;
+ rv = mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::selected, PR_TRUE);
}
+ if (NS_SUCCEEDED(rv)) {
+ // When setting DefaultSelected, we must also reset Selected (DOM Errata)
+ rv = SetSelected(aDefaultSelected);
+ }
+ return rv;
}
NS_IMETHODIMP
diff --git a/layout/html/content/src/nsHTMLOptionElement.cpp b/layout/html/content/src/nsHTMLOptionElement.cpp
index f1fd0de59df..71127a199bf 100644
--- a/layout/html/content/src/nsHTMLOptionElement.cpp
+++ b/layout/html/content/src/nsHTMLOptionElement.cpp
@@ -301,23 +301,26 @@ NS_IMETHODIMP
nsHTMLOptionElement::GetDefaultSelected(PRBool* aDefaultSelected)
{
nsHTMLValue val;
- nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::selected, val);
- *aDefaultSelected = (NS_CONTENT_ATTR_NOT_THERE != rv);
- return NS_OK;
+ nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::selected, val);
+ *aDefaultSelected = (NS_CONTENT_ATTR_NOT_THERE != rv);
+ return NS_OK;
}
NS_IMETHODIMP
nsHTMLOptionElement::SetDefaultSelected(PRBool aDefaultSelected)
{
+ nsresult rv = NS_OK;
nsHTMLValue empty(eHTMLUnit_Empty);
- // When setting DefaultSelected, we must also reset Selected
- SetSelected(aDefaultSelected);
if (aDefaultSelected) {
- return mInner.SetHTMLAttribute(nsHTMLAtoms::selected, empty, PR_TRUE);
+ rv = mInner.SetHTMLAttribute(nsHTMLAtoms::selected, empty, PR_TRUE);
} else {
- mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::selected, PR_TRUE);
- return NS_OK;
+ rv = mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::selected, PR_TRUE);
}
+ if (NS_SUCCEEDED(rv)) {
+ // When setting DefaultSelected, we must also reset Selected (DOM Errata)
+ rv = SetSelected(aDefaultSelected);
+ }
+ return rv;
}
NS_IMETHODIMP