If pickType !== pickedFile.type (if we're converting a jpeg to a png, for example) then pickedFile.name will probably include a file extension that does not match the new file type.

If this patch is just to satisfy the use case of the gecko <input type=file> file picker, then that case can probably never arise. 

I don't know if it is worth trying to handle this case or not. I don't think we should change the original extension of the file name, but maybe we could append the new type extension if needed?  That is, if the user picked foo.jpg but is being returned as a png, we could set the filename to foo.jpg.png.  If you want to do that you could lazily load the shared/js/mime_mapper.js module.

What do you think?  If you'd just like to land this as is, and file a followup bug, that is fine with me.