| 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 var jsTestIsAsync = true; | 6 var jsTestIsAsync = true; |
| 7 | 7 |
| 8 // Test the different ways you can construct a Blob. | 8 // Test the different ways you can construct a Blob. |
| 9 shouldBeTrue("(new Blob()) instanceof window.Blob"); | 9 shouldBeTrue("(new Blob()) instanceof window.Blob"); |
| 10 shouldBeTrue("(new Blob(undefined)) instanceof window.Blob"); |
| 10 shouldBeTrue("(new Blob([])) instanceof window.Blob"); | 11 shouldBeTrue("(new Blob([])) instanceof window.Blob"); |
| 11 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); | 12 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); |
| 12 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob"); | 13 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob"); |
| 13 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob")
; | 14 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob")
; |
| 14 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'native'})) instan
ceof window.Blob"); | 15 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'native'})) instan
ceof window.Blob"); |
| 15 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'transparent'})) i
nstanceof window.Blob"); | 16 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'transparent'})) i
nstanceof window.Blob"); |
| 16 | 17 |
| 18 // Test default sizes/types. |
| 19 shouldBe("(new Blob()).size", "0"); |
| 20 shouldBe("(new Blob(undefined)).size", "0"); |
| 21 shouldBeEqualToString("(new Blob()).type", ""); |
| 22 shouldBeEqualToString("(new Blob(undefined)).type", ""); |
| 23 |
| 17 // Test invalid blob parts. | 24 // Test invalid blob parts. |
| 18 shouldThrow("new Blob('hello')", '"TypeError: Failed to construct \'Blob\': The
1st argument is neither an array, nor does it have indexed properties."'); | 25 shouldThrow("new Blob('hello')", '"TypeError: Failed to construct \'Blob\': The
1st argument is neither an array, nor does it have indexed properties."'); |
| 19 shouldThrow("new Blob(0)", '"TypeError: Failed to construct \'Blob\': The 1st ar
gument is neither an array, nor does it have indexed properties."'); | 26 shouldThrow("new Blob(0)", '"TypeError: Failed to construct \'Blob\': The 1st ar
gument is neither an array, nor does it have indexed properties."'); |
| 20 shouldThrow("new Blob(null)", '"TypeError: Failed to construct \'Blob\': The 1st
argument is neither an array, nor does it have indexed properties."'); | 27 shouldThrow("new Blob(null)", '"TypeError: Failed to construct \'Blob\': The 1st
argument is neither an array, nor does it have indexed properties."'); |
| 21 | 28 |
| 22 // Test valid blob parts. | 29 // Test valid blob parts. |
| 23 shouldBeTrue("(new Blob([])) instanceof window.Blob"); | 30 shouldBeTrue("(new Blob([])) instanceof window.Blob"); |
| 24 shouldBeTrue("(new Blob(['stringPrimitive'])) instanceof window.Blob"); | 31 shouldBeTrue("(new Blob(['stringPrimitive'])) instanceof window.Blob"); |
| 25 shouldBeTrue("(new Blob([String('stringObject')])) instanceof window.Blob"); | 32 shouldBeTrue("(new Blob([String('stringObject')])) instanceof window.Blob"); |
| 26 shouldBeTrue("(new Blob([new Blob])) instanceof window.Blob"); | 33 shouldBeTrue("(new Blob([new Blob])) instanceof window.Blob"); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Test that strings are not NFC normalized | 119 // Test that strings are not NFC normalized |
| 113 var OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC | 120 var OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC |
| 114 shouldBe("OMICRON_WITH_OXIA.charCodeAt(0)", "0x1F79"); | 121 shouldBe("OMICRON_WITH_OXIA.charCodeAt(0)", "0x1F79"); |
| 115 var reader = new FileReader(); | 122 var reader = new FileReader(); |
| 116 reader.readAsText(new Blob([OMICRON_WITH_OXIA])); | 123 reader.readAsText(new Blob([OMICRON_WITH_OXIA])); |
| 117 reader.onload = function() { | 124 reader.onload = function() { |
| 118 shouldBe("reader.result.charCodeAt(0)", "0x1F79"); | 125 shouldBe("reader.result.charCodeAt(0)", "0x1F79"); |
| 119 finishJSTest(); | 126 finishJSTest(); |
| 120 }; | 127 }; |
| 121 </script> | 128 </script> |
| OLD | NEW |