Backed out 2 changesets (bug 1338637) for perma failures on test_webkitdirectory.html. CLOSED TREE
Backed out changeset 5bddcb99f650 (bug 1338637) Backed out changeset 5c29fd30af97 (bug 1338637)
This commit is contained in:
@@ -54,7 +54,6 @@
|
||||
#include "nsError.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "nsIPromptCollection.h"
|
||||
|
||||
#include "mozilla/PresState.h"
|
||||
#include "nsLinebreakConverter.h" //to strip out carriage returns
|
||||
@@ -481,37 +480,6 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) {
|
||||
mode == static_cast<int16_t>(nsIFilePicker::modeGetFolder));
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
nsresult rv = mFilePicker->GetDomFileOrDirectory(getter_AddRefs(tmp));
|
||||
|
||||
// Show a prompt to get user confirmation before allowing folder access.
|
||||
// This is to prevent sites from tricking the user into uploading files.
|
||||
// See Bug 1338637.
|
||||
if (mode == static_cast<int16_t>(nsIFilePicker::modeGetFolder)) {
|
||||
nsCOMPtr<nsIPromptCollection> prompter =
|
||||
do_GetService("@mozilla.org/embedcomp/prompt-collection;1");
|
||||
if (!prompter) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
bool confirmed = false;
|
||||
BrowsingContext* bc = mInput->OwnerDoc()->GetBrowsingContext();
|
||||
|
||||
// Get directory name
|
||||
RefPtr<Directory> directory = static_cast<Directory*>(tmp.get());
|
||||
nsAutoString directoryName;
|
||||
ErrorResult error;
|
||||
directory->GetName(directoryName, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
rv = prompter->ConfirmFolderUpload(bc, directoryName, &confirmed);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!confirmed) {
|
||||
// User aborted upload
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<Blob> blob = do_QueryObject(tmp);
|
||||
|
||||
Reference in New Issue
Block a user