diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 0908c51dbff..1e68b55358a 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -804,6 +804,14 @@ nsHTMLInputElement::SetFileName(const nsAString& aValue) // No big deal if |new| fails, we simply won't submit the file mFileName = aValue.IsEmpty() ? nsnull : new nsString(aValue); + // No need to flush here, if there's no frame at this point we + // don't need to force creation of one just to tell it about this + // new value. We just want the display to update as needed. + nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); + if (formControlFrame) { + formControlFrame->SetFormProperty(nsGkAtoms::value, aValue); + } + SetValueChanged(PR_TRUE); } diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 4d6117cc7dc..a06d4b4c92e 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -332,13 +332,12 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) // and not fire onchange when it should. PRBool oldState = mTextFrame->GetFireChangeEventState(); mTextFrame->SetFireChangeEventState(PR_TRUE); - mTextFrame->SetFormProperty(nsGkAtoms::value, unicodePath); - mTextFrame->SetFireChangeEventState(oldState); nsCOMPtr fileControl = do_QueryInterface(mContent); if (fileControl) { fileControl->SetFileName(unicodePath); } + mTextFrame->SetFireChangeEventState(oldState); // May need to fire an onchange here mTextFrame->CheckFireOnChange(); return NS_OK;