зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1409325 - Update FileReader WebIDL File, r=smaug
This commit is contained in:
Родитель
44860178be
Коммит
ba7f928d6a
|
@ -189,11 +189,16 @@ Blob::GetType(nsAString &aType)
|
||||||
already_AddRefed<Blob>
|
already_AddRefed<Blob>
|
||||||
Blob::Slice(const Optional<int64_t>& aStart,
|
Blob::Slice(const Optional<int64_t>& aStart,
|
||||||
const Optional<int64_t>& aEnd,
|
const Optional<int64_t>& aEnd,
|
||||||
const nsAString& aContentType,
|
const Optional<nsAString>& aContentType,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
nsAutoString contentType;
|
||||||
|
if (aContentType.WasPassed()) {
|
||||||
|
contentType = aContentType.Value();
|
||||||
|
}
|
||||||
|
|
||||||
RefPtr<BlobImpl> impl =
|
RefPtr<BlobImpl> impl =
|
||||||
mImpl->Slice(aStart, aEnd, aContentType, aRv);
|
mImpl->Slice(aStart, aEnd, contentType, aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public:
|
||||||
|
|
||||||
already_AddRefed<Blob> Slice(const Optional<int64_t>& aStart,
|
already_AddRefed<Blob> Slice(const Optional<int64_t>& aStart,
|
||||||
const Optional<int64_t>& aEnd,
|
const Optional<int64_t>& aEnd,
|
||||||
const nsAString& aContentType,
|
const Optional<nsAString>& aContentType,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
size_t GetAllocationSize() const;
|
size_t GetAllocationSize() const;
|
||||||
|
|
|
@ -72,9 +72,14 @@ public:
|
||||||
ReadFileContent(aBlob, EmptyString(), FILE_AS_ARRAYBUFFER, aRv);
|
ReadFileContent(aBlob, EmptyString(), FILE_AS_ARRAYBUFFER, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadAsText(Blob& aBlob, const nsAString& aLabel, ErrorResult& aRv)
|
void ReadAsText(Blob& aBlob, const Optional<nsAString>& aLabel,
|
||||||
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
ReadFileContent(aBlob, aLabel, FILE_AS_TEXT, aRv);
|
if (aLabel.WasPassed()) {
|
||||||
|
ReadFileContent(aBlob, aLabel.Value(), FILE_AS_TEXT, aRv);
|
||||||
|
} else {
|
||||||
|
ReadFileContent(aBlob, EmptyString(), FILE_AS_TEXT, aRv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadAsDataURL(Blob& aBlob, ErrorResult& aRv)
|
void ReadAsDataURL(Blob& aBlob, ErrorResult& aRv)
|
||||||
|
|
|
@ -27,7 +27,7 @@ interface Blob {
|
||||||
[Throws]
|
[Throws]
|
||||||
Blob slice([Clamp] optional long long start,
|
Blob slice([Clamp] optional long long start,
|
||||||
[Clamp] optional long long end,
|
[Clamp] optional long long end,
|
||||||
optional DOMString contentType = "");
|
optional DOMString contentType);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EndingTypes { "transparent", "native" };
|
enum EndingTypes { "transparent", "native" };
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* The origin of this IDL file is
|
* The origin of this IDL file is
|
||||||
* http://dev.w3.org/2006/webapi/FileAPI/#dfn-filereader
|
* https://w3c.github.io/FileAPI/#APIASynch
|
||||||
*
|
*
|
||||||
* Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C
|
* Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C
|
||||||
* liability, trademark and document use rules apply.
|
* liability, trademark and document use rules apply.
|
||||||
|
@ -17,7 +17,9 @@ interface FileReader : EventTarget {
|
||||||
[Throws]
|
[Throws]
|
||||||
void readAsArrayBuffer(Blob blob);
|
void readAsArrayBuffer(Blob blob);
|
||||||
[Throws]
|
[Throws]
|
||||||
void readAsText(Blob blob, optional DOMString label = "");
|
void readAsBinaryString(Blob filedata);
|
||||||
|
[Throws]
|
||||||
|
void readAsText(Blob blob, optional DOMString label);
|
||||||
[Throws]
|
[Throws]
|
||||||
void readAsDataURL(Blob blob);
|
void readAsDataURL(Blob blob);
|
||||||
|
|
||||||
|
@ -46,9 +48,3 @@ interface FileReader : EventTarget {
|
||||||
attribute EventHandler onerror;
|
attribute EventHandler onerror;
|
||||||
attribute EventHandler onloadend;
|
attribute EventHandler onloadend;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mozilla extensions.
|
|
||||||
partial interface FileReader {
|
|
||||||
[Throws]
|
|
||||||
void readAsBinaryString(Blob filedata);
|
|
||||||
};
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче