зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1143934 - Disallow mozSetFileNameArray in content processes. r=ehsan
Summary of rationale: it never entirely worked, in that the File objects it created would cause form submission to fail, and the longer-term plan for content-process system-principal scripts is to remove APIs that allow direct filesystem access.
This commit is contained in:
Родитель
9690f1b2d6
Коммит
ae42a23a28
|
@ -1831,7 +1831,7 @@ HTMLInputElement::SetValue(const nsAString& aValue, ErrorResult& aRv)
|
|||
}
|
||||
Sequence<nsString> list;
|
||||
list.AppendElement(aValue);
|
||||
MozSetFileNameArray(list);
|
||||
MozSetFileNameArray(list, aRv);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -2352,8 +2352,13 @@ HTMLInputElement::MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles)
|
|||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames)
|
||||
HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv)
|
||||
{
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<File>> files;
|
||||
for (uint32_t i = 0; i < aFileNames.Length(); ++i) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
@ -2397,8 +2402,9 @@ HTMLInputElement::MozSetFileNameArray(const char16_t** aFileNames, uint32_t aLen
|
|||
list.AppendElement(nsDependentString(aFileNames[i]));
|
||||
}
|
||||
|
||||
MozSetFileNameArray(list);
|
||||
return NS_OK;
|
||||
ErrorResult rv;
|
||||
MozSetFileNameArray(list, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2445,8 +2451,9 @@ HTMLInputElement::SetUserInput(const nsAString& aValue)
|
|||
{
|
||||
Sequence<nsString> list;
|
||||
list.AppendElement(aValue);
|
||||
MozSetFileNameArray(list);
|
||||
return NS_OK;
|
||||
ErrorResult rv;
|
||||
MozSetFileNameArray(list, rv);
|
||||
return rv.ErrorCode();
|
||||
} else {
|
||||
nsresult rv = SetValueInternal(aValue, true, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -715,7 +715,7 @@ public:
|
|||
|
||||
void MozGetFileNameArray(nsTArray< nsString >& aFileNames);
|
||||
|
||||
void MozSetFileNameArray(const Sequence< nsString >& aFileNames);
|
||||
void MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv);
|
||||
void MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles);
|
||||
|
||||
HTMLInputElement* GetOwnerNumberControl();
|
||||
|
|
|
@ -151,7 +151,7 @@ partial interface HTMLInputElement {
|
|||
[ChromeOnly]
|
||||
sequence<DOMString> mozGetFileNameArray();
|
||||
|
||||
[ChromeOnly]
|
||||
[ChromeOnly, Throws]
|
||||
void mozSetFileNameArray(sequence<DOMString> fileNames);
|
||||
|
||||
[ChromeOnly]
|
||||
|
|
Загрузка…
Ссылка в новой задаче