diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index affee9e83588..7b51f8c4b9ee 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -1748,6 +1748,22 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) if (!aVisitor.mPresContext) { return NS_OK; } + + // ignore the activate event fired by the "Browse..." button + // (file input controls fire their own) (bug 500885) + if (mType == NS_FORM_INPUT_FILE) { + nsCOMPtr maybeButton = + do_QueryInterface(aVisitor.mEvent->originalTarget); + if (maybeButton && + maybeButton->IsRootOfNativeAnonymousSubtree() && + maybeButton->AttrValueIs(kNameSpaceID_None, + nsGkAtoms::type, + nsGkAtoms::button, + eCaseMatters)) { + return NS_OK; + } + } + nsresult rv = NS_OK; PRBool outerActivateEvent = !!(aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT); PRBool originalCheckedValue = diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 39cf25b4f838..93a707ea29e1 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -136,6 +136,7 @@ _TEST_FILES = test_bug589.html \ 347174transformable.xml \ 347174transform.xsl \ test_bug481335.xhtml \ + test_bug500885.html \ test_bug514856.html \ bug514856_iframe.html \ test_bug519987.html \ diff --git a/content/html/content/test/test_bug500885.html b/content/html/content/test/test_bug500885.html new file mode 100644 index 000000000000..53f0a5c2dd27 --- /dev/null +++ b/content/html/content/test/test_bug500885.html @@ -0,0 +1,98 @@ + + + + + Test for Bug 500885 + + + + + + + +Mozilla Bug 500885 +
+ +
+ + + +