From 39405c94cd09bd3360cb06ecea1e9402e7600b5e Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Sat, 30 Oct 2004 18:11:25 +0000 Subject: [PATCH] Allow setting the value of to an empty string even in untrusted script. Bug 266744, r=sicking, sr=jst git-svn-id: svn://10.0.0.236/trunk@164672 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/content/src/nsHTMLInputElement.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index b41594e5f51..c3f2def5967 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -639,8 +639,9 @@ nsHTMLInputElement::GetValue(nsAString& aValue) NS_IMETHODIMP nsHTMLInputElement::SetValue(const nsAString& aValue) { - //check secuity - if (mType == NS_FORM_INPUT_FILE) { + // check security. Note that setting the value to the empty string is always + // OK and gives pages a way to clear a file input if necessary. + if (mType == NS_FORM_INPUT_FILE && !aValue.IsEmpty()) { nsIScriptSecurityManager *securityManager = nsContentUtils::GetSecurityManager();