зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384030 - Enable setting <input type=file>.files. r=smaug
This commit is contained in:
Родитель
5e4b2337bc
Коммит
1acd604a98
|
@ -2948,6 +2948,26 @@ HTMLInputElement::GetFiles()
|
|||
return mFileData->mFileList;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::SetFiles(FileList* aFiles)
|
||||
{
|
||||
if (mType != NS_FORM_INPUT_FILE || !aFiles) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear |mFileData->mFileList| to omit |UpdateFileList|
|
||||
if (mFileData->mFileList) {
|
||||
mFileData->mFileList->Clear();
|
||||
mFileData->mFileList = nullptr;
|
||||
}
|
||||
|
||||
// Update |mFileData->mFilesOrDirectories|
|
||||
SetFiles(aFiles, true);
|
||||
|
||||
// Update |mFileData->mFileList| without copy
|
||||
mFileData->mFileList = aFiles;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
HTMLInputElement::HandleNumberControlSpin(void* aData)
|
||||
{
|
||||
|
|
|
@ -513,6 +513,7 @@ public:
|
|||
// XPCOM GetForm() is OK
|
||||
|
||||
FileList* GetFiles();
|
||||
void SetFiles(FileList* aFiles);
|
||||
|
||||
// XPCOM GetFormAction() is OK
|
||||
void SetFormAction(const nsAString& aValue, ErrorResult& aRv)
|
||||
|
|
|
@ -40,7 +40,7 @@ interface HTMLInputElement : HTMLElement {
|
|||
attribute boolean disabled;
|
||||
readonly attribute HTMLFormElement? form;
|
||||
[Pure]
|
||||
readonly attribute FileList? files;
|
||||
attribute FileList? files;
|
||||
[CEReactions, Pure, SetterThrows]
|
||||
attribute DOMString formAction;
|
||||
[CEReactions, Pure, SetterThrows]
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[files.html]
|
||||
type: testharness
|
||||
[setting <input type=file>.files]
|
||||
expected: FAIL
|
||||
|
|
@ -691,7 +691,7 @@ interface HTMLInputElement : HTMLElement {
|
|||
[CEReactions] attribute DOMString dirName;
|
||||
[CEReactions] attribute boolean disabled;
|
||||
readonly attribute HTMLFormElement? form;
|
||||
readonly attribute FileList? files;
|
||||
attribute FileList? files;
|
||||
[CEReactions] attribute USVString formAction;
|
||||
[CEReactions] attribute DOMString formEnctype;
|
||||
[CEReactions] attribute DOMString formMethod;
|
||||
|
|
Загрузка…
Ссылка в новой задаче