OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <script src="resources/read-common.js"></script> | 3 <script src="resources/read-common.js"></script> |
4 <script> | 4 <script> |
5 description("Test the Blob.close() method, revoking."); | 5 description("Test the Blob.close() method, revoking."); |
6 | 6 |
7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
8 | 8 |
9 function base64ToUint8Array(a) | 9 function base64ToUint8Array(a) |
10 { | 10 { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 84 }; |
85 blobURL1 = window.URL.createObjectURL(blob); | 85 blobURL1 = window.URL.createObjectURL(blob); |
86 // create some more Blob URLs. | 86 // create some more Blob URLs. |
87 for (var i = 0; i < 10; i++) | 87 for (var i = 0; i < 10; i++) |
88 window.URL.createObjectURL(blob); | 88 window.URL.createObjectURL(blob); |
89 // Make them all inaccessible. | 89 // Make them all inaccessible. |
90 blob.close(); | 90 blob.close(); |
91 img.src = blobURL1; | 91 img.src = blobURL1; |
92 } | 92 } |
93 | 93 |
94 function testRegisterAfterClose() | 94 function testCreateAfterClose() |
95 { | 95 { |
96 debug("Test creating object URLs on closed Blobs"); | 96 debug("Test creating object URLs on closed Blobs"); |
97 blob = new Blob(["body{background: green}"], {type: "text/css"}); | 97 blob = new Blob(["body{background: green}"], {type: "text/css"}); |
98 blobURL1 = window.URL.createObjectURL(blob); | |
99 blob.close(); | 98 blob.close(); |
100 // Verifies createObjectURL() still works and returns a valid (non-empty) UR
L | 99 shouldThrow("window.URL.createObjectURL(blob);"); |
101 // without throwing an error. See http://crbug.com/344820 for this requireme
nt. | |
102 blobURL2 = window.URL.createObjectURL(blob); | |
103 shouldBeTrue("blobURL1 !== blobURL2"); | |
104 shouldBeTrue("blobURL2.length > 0"); | |
105 runNextTest(); | 100 runNextTest(); |
106 } | 101 } |
107 | 102 |
108 var tests = [ | 103 var tests = [ |
109 testRevokeAfterClose, | 104 testRevokeAfterClose, |
110 testRevokeAfterCloseWorkers, | 105 testRevokeAfterCloseWorkers, |
111 testRegisterAfterClose ]; | 106 testCreateAfterClose ]; |
112 | 107 |
113 function runNextTest() | 108 function runNextTest() |
114 { | 109 { |
115 if (!tests.length) { | 110 if (!tests.length) { |
116 finishJSTest(); | 111 finishJSTest(); |
117 return; | 112 return; |
118 } | 113 } |
119 tests.shift()(); | 114 tests.shift()(); |
120 } | 115 } |
121 </script> | 116 </script> |
122 <body onload="runNextTest()"> | 117 <body onload="runNextTest()"> |
123 </body> | 118 </body> |
OLD | NEW |