Auto merge of #11076 - izgzhen:fileapi, r=Ms2ger

Implement File DOM object interface

* Rewrite constructors of `Blob` and `File` with `DataSlice` as argument
* Update WebIDL of `Blob` and `File`
* Implement missing interfaces of `File` (However, due to lack of working `ArrayBuffer/ArrayBufferView` in `Blob`, so it still differs from spec)
* Update WPT test `File-constructor.html`

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11076)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-11 10:28:05 -07:00
commit 392135bd0c
12 changed files with 127 additions and 187 deletions

View file

@ -2,8 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob
[Constructor(optional sequence<(/*ArrayBuffer or ArrayBufferView or */Blob or DOMString)> blobParts,
// https://w3c.github.io/FileAPI/#blob
[Constructor(optional sequence<BlobPart> blobParts,
optional BlobPropertyBag options),
Exposed=Window/*,Worker*/]
interface Blob {
@ -26,3 +27,5 @@ dictionary BlobPropertyBag {
DOMString type = "";
};
typedef (/*ArrayBuffer or ArrayBufferView or */Blob or DOMString) BlobPart;

View file

@ -2,13 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-file
// https://w3c.github.io/FileAPI/#file
// [Constructor(sequence<(Blob or DOMString or ArrayBufferView or ArrayBuffer)> fileBits,
// [EnsureUTF16] DOMString fileName, optional FilePropertyBag options)]
[Constructor(sequence<BlobPart> fileBits,
DOMString fileName,
optional FilePropertyBag options),
Exposed=Window/*,Worker*/]
interface File : Blob {
readonly attribute DOMString name;
// readonly attribute Date lastModifiedDate;
readonly attribute long long lastModified;
};
dictionary FilePropertyBag : BlobPropertyBag {
long long lastModified;
};