Bug #1820, add the optional "type" parameter to Blob

This commit is contained in:
Shing Lyu 2014-12-22 23:45:00 +08:00
parent 37a97f3273
commit 6df9b7fd3a
6 changed files with 66 additions and 51 deletions

View file

@ -10,6 +10,34 @@
var bs = b.slice(0, 5);
is(bs.size, 5);
is(b.type, "");
var bc = new Blob(testData, {type:"text/plain"}); // the blob
is(bc.size, 32);
is(bc.type, "text/plain");
var bss = new Blob(testData, {type:" text/plain "}); // spaces
is(bss.size, 32);
is(bss.type, " text/plain ");
var bcs = bc.slice(0, 7);
is(bcs.size, 7);
is(bcs.type, "");
var bcsc = bc.slice(0, 7, "text/xml");
is(bcsc.size, 7);
is(bcsc.type, "text/xml");
var bu = new Blob(testData, {type:"TEXT/PLAIN"}); // the blob
is(bu.size, 32);
is(bu.type, "text/plain");
var bj = new Blob(testData, {type:"☃"}); // the blob
is(bj.size, 32);
is(bj.type, "");
var bjs = bj.slice(0, 7, "☃");
is(bjs.size, 7);
is(bjs.type, "");
</script>
</head>
</html>

View file

@ -1,7 +1,5 @@
[Blob-constructor.html]
type: testharness
[Blob interface object]
expected: FAIL
[Passing non-objects, Dates and RegExps for blobParts should throw a TypeError.]
expected: FAIL
@ -78,9 +76,6 @@
[Array with mixed types]
expected: FAIL
[options properties should be accessed in lexicographic order.]
expected: FAIL
[Passing null (index 0) for options should use the defaults.]
expected: FAIL
@ -122,28 +117,3 @@
[Newlines should not change when endings is \'native\'.]
expected: FAIL
[Blob with type "a"]
expected: FAIL
[Blob with type "A"]
expected: FAIL
[Blob with type "text/html"]
expected: FAIL
[Blob with type "TEXT/HTML"]
expected: FAIL
[Blob with type " image/gif "]
expected: FAIL
[Blob with type "unknown/unknown"]
expected: FAIL
[Blob with type "text/plain"]
expected: FAIL
[Blob with type "image/png"]
expected: FAIL