Bug 1678580 - Check file picker result for errors before showing ConfirmFolderUpload prompt. r=baku

Differential Revision: https://phabricator.services.mozilla.com/D97755
This commit is contained in:
pbz 2020-11-26 10:54:22 +00:00
Родитель 75b4e18676
Коммит d0517b5353
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -484,6 +484,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) {
mode == static_cast<int16_t>(nsIFilePicker::modeGetFolder));
nsCOMPtr<nsISupports> tmp;
nsresult rv = mFilePicker->GetDomFileOrDirectory(getter_AddRefs(tmp));
NS_ENSURE_SUCCESS(rv, rv);
// Show a prompt to get user confirmation before allowing folder access.
// This is to prevent sites from tricking the user into uploading files.
@ -515,8 +516,6 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) {
}
}
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<Blob> blob = do_QueryObject(tmp);
if (blob) {
RefPtr<File> file = blob->ToFile();