| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 description("Test the Blob constructor."); | 5 description("Test the Blob constructor."); |
| 6 | 6 |
| 7 // Test the different ways you can construct a Blob. | 7 // Test the different ways you can construct a Blob. |
| 8 shouldBeTrue("(new Blob()) instanceof window.Blob"); | 8 shouldBeTrue("(new Blob()) instanceof window.Blob"); |
| 9 shouldBeTrue("(new Blob([])) instanceof window.Blob"); | 9 shouldBeTrue("(new Blob([])) instanceof window.Blob"); |
| 10 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); | 10 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 shouldBe("(new Blob([toStringingObj])).size", "8"); | 35 shouldBe("(new Blob([toStringingObj])).size", "8"); |
| 36 | 36 |
| 37 var throwingObj = { toString: function() { throw "Error"; } }; | 37 var throwingObj = { toString: function() { throw "Error"; } }; |
| 38 shouldThrow("new Blob([throwingObj])", "'Error'"); | 38 shouldThrow("new Blob([throwingObj])", "'Error'"); |
| 39 | 39 |
| 40 // Test some invalid property bags. | 40 // Test some invalid property bags. |
| 41 shouldBeTrue("(new Blob([], {unknownKey:'value'})) instanceof window.Blob");
// Ignore invalid keys | 41 shouldBeTrue("(new Blob([], {unknownKey:'value'})) instanceof window.Blob");
// Ignore invalid keys |
| 42 shouldThrow("new Blob([], {endings:'illegalValue'})", "'TypeError: Failed to con
struct \\'Blob\\': The provided value \\'illegalValue\\' is not a valid enum val
ue of type NormalizeLineEndings.'"); | 42 shouldThrow("new Blob([], {endings:'illegalValue'})", "'TypeError: Failed to con
struct \\'Blob\\': The provided value \\'illegalValue\\' is not a valid enum val
ue of type NormalizeLineEndings.'"); |
| 43 shouldThrow("new Blob([], {endings:throwingObj})", "'Error'"); | 43 shouldThrow("new Blob([], {endings:throwingObj})", "'Error'"); |
| 44 shouldThrow("new Blob([], {type:throwingObj})", "'Error'"); | 44 shouldThrow("new Blob([], {type:throwingObj})", "'Error'"); |
| 45 shouldThrow("new Blob([], {type:'hello\u00EE'})", "'SyntaxError: Failed to const
ruct \\'Blob\\': The \\'type\\' property must consist of ASCII characters.'"); | |
| 46 | 45 |
| 47 // Test that order of property bag evaluation is lexigraphical | 46 // Test that order of property bag evaluation is lexigraphical |
| 48 var throwingObj1 = { toString: function() { throw "Error 1"; } }; | 47 var throwingObj1 = { toString: function() { throw "Error 1"; } }; |
| 49 var throwingObj2 = { toString: function() { throw "Error 2"; } }; | 48 var throwingObj2 = { toString: function() { throw "Error 2"; } }; |
| 50 shouldThrow("new Blob([], {endings:throwingObj1, type:throwingObj2})", "'Error 1
'"); | 49 shouldThrow("new Blob([], {endings:throwingObj1, type:throwingObj2})", "'Error 1
'"); |
| 51 shouldThrow("new Blob([], {type:throwingObj2, endings:throwingObj1})", "'Error 1
'"); | 50 shouldThrow("new Blob([], {type:throwingObj2, endings:throwingObj1})", "'Error 1
'"); |
| 52 shouldThrow("new Blob([], {type:throwingObj2, endings:'illegal'})", "'TypeError:
Failed to construct \\'Blob\\': The provided value \\'illegal\\' is not a valid
enum value of type NormalizeLineEndings.'"); | 51 shouldThrow("new Blob([], {type:throwingObj2, endings:'illegal'})", "'TypeError:
Failed to construct \\'Blob\\': The provided value \\'illegal\\' is not a valid
enum value of type NormalizeLineEndings.'"); |
| 53 | 52 |
| 53 // Test non-ASCII type handling |
| 54 shouldBeEqualToString("new Blob([], {type:'hello\u00EE'}).type", ""); |
| 55 |
| 56 // Test lowercasing of type |
| 57 shouldBeEqualToString("new Blob([], {type:'123ABCabc'}).type", "123abcabc"); |
| 58 |
| 54 // Test various non-object literals being used as property bags. | 59 // Test various non-object literals being used as property bags. |
| 55 shouldBeTrue("(new Blob([], null)) instanceof window.Blob"); | 60 shouldBeTrue("(new Blob([], null)) instanceof window.Blob"); |
| 56 shouldBeTrue("(new Blob([], undefined)) instanceof window.Blob"); | 61 shouldBeTrue("(new Blob([], undefined)) instanceof window.Blob"); |
| 57 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to
construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); | 62 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to
construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); |
| 58 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed
to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); | 63 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed
to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); |
| 59 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t
o construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); | 64 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t
o construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); |
| 60 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed
to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); | 65 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed
to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); |
| 61 shouldBeTrue("(new Blob([], [])) instanceof window.Blob"); | 66 shouldBeTrue("(new Blob([], [])) instanceof window.Blob"); |
| 62 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob"); | 67 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob"); |
| 63 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob"); | 68 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob"); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); | 106 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); |
| 102 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); | 107 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); |
| 103 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer
, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si
ze", "1400"); | 108 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer
, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si
ze", "1400"); |
| 104 shouldBe("new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(10
0)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100)))
.buffer]).size", "1000"); | 109 shouldBe("new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(10
0)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100)))
.buffer]).size", "1000"); |
| 105 | 110 |
| 106 // Test passing blob parts in objects with indexed properties. | 111 // Test passing blob parts in objects with indexed properties. |
| 107 // (This depends on the bindings code handling of sequence<T>) | 112 // (This depends on the bindings code handling of sequence<T>) |
| 108 shouldBe("new Blob({length: 0}).size", "0"); | 113 shouldBe("new Blob({length: 0}).size", "0"); |
| 109 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); | 114 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); |
| 110 </script> | 115 </script> |
| OLD | NEW |