Bug 880042 - file[multiple] form field nsIFilePicker crash if overriding component has not implemented a domfiles getter. r=smaug, a=akeybl
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 11 Jun 2013 15:09:49 -0400
changeset 142870 a991fa3810ac334034c93d875b39489263eba096
parent 142869 98eab2d6e5d699f8e57e3ed5d1e14fcae6bb839d
child 142871 944182a5a20459d3356afb86f5686151b83a570a
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, akeybl
bugs880042
milestone23.0a2
Bug 880042 - file[multiple] form field nsIFilePicker crash if overriding component has not implemented a domfiles getter. r=smaug, a=akeybl
content/html/content/src/HTMLInputElement.cpp
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -318,16 +318,20 @@ HTMLInputElement::nsFilePickerShownCallb
 
   // Collect new selected filenames
   nsCOMArray<nsIDOMFile> newFiles;
   if (mMulti) {
     nsCOMPtr<nsISimpleEnumerator> iter;
     nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter));
     NS_ENSURE_SUCCESS(rv, rv);
 
+    if (!iter) {
+      return NS_OK;
+    }
+
     nsCOMPtr<nsISupports> tmp;
     bool prefSaved = false;
     bool loop = true;
 
     while (NS_SUCCEEDED(iter->HasMoreElements(&loop)) && loop) {
       iter->GetNext(getter_AddRefs(tmp));
       nsCOMPtr<nsIDOMFile> domFile = do_QueryInterface(tmp);
       MOZ_ASSERT(domFile);