Bug 1207570 - Make HTMLInputElement::GetFilesAndDirectories throw when the type is not file. r=baku

This commit is contained in:
Jonathan Watt
2015-09-02 10:00:48 +01:00
parent 7d7b7eb6b7
commit 2c376f1008

View File

@@ -4887,6 +4887,11 @@ MakeOrReuseFileSystem(const nsAString& aNewLocalRootPath,
already_AddRefed<Promise>
HTMLInputElement::GetFilesAndDirectories(ErrorResult& aRv)
{
if (mType != NS_FORM_INPUT_FILE) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
if (mFilesAndDirectoriesPromise) {
return nsRefPtr<Promise>(mFilesAndDirectoriesPromise).forget();
}