From e6dfc5e889d9759d1e8a93d101c9d57285f0d9ad Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 28 Apr 2005 17:11:22 +0000 Subject: [PATCH] Make file input frames correctly store their value in the content node even if the whole presentation is coming down. Bug 287120, r=sicking, sr=jst, a=brendan git-svn-id: svn://10.0.0.236/trunk@172813 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsFileControlFrame.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index c53cfce48f3..c4f4f0d91e5 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -119,11 +119,19 @@ void nsFileControlFrame::PreDestroy(nsPresContext* aPresContext) { // Toss the value into the control from the anonymous content, which is about - // to get lost. + // to get lost. Note that if the page is being torn down then the anonymous + // content may no longer have access to its frame. But _we_ can access that + // frame. So if it's there, get the value from the frame if (mTextContent) { - nsCOMPtr input = do_QueryInterface(mTextContent); nsAutoString value; - input->GetValue(value); + if (mTextFrame) { + // Second arg doesn't really matter here... + mTextFrame->GetValue(value, PR_TRUE); + } else { + // Get from the content + nsCOMPtr input = do_QueryInterface(mTextContent); + input->GetValue(value); + } // Have it take the value, just like when input type=text goes away nsCOMPtr fileInput = do_QueryInterface(mContent);