Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/files/blob-constructor.html

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(undefined)) instanceof window.Blob");
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 shouldBe("new Blob([(new Uint16Array(100)).buffer]).size", "200"); 116 shouldBe("new Blob([(new Uint16Array(100)).buffer]).size", "200");
117 shouldBe("new Blob([(new Uint32Array(100)).buffer]).size", "400"); 117 shouldBe("new Blob([(new Uint32Array(100)).buffer]).size", "400");
118 shouldBe("new Blob([(new Int8Array(100)).buffer]).size", "100"); 118 shouldBe("new Blob([(new Int8Array(100)).buffer]).size", "100");
119 shouldBe("new Blob([(new Int16Array(100)).buffer]).size", "200"); 119 shouldBe("new Blob([(new Int16Array(100)).buffer]).size", "200");
120 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400"); 120 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400");
121 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); 121 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400");
122 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); 122 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800");
123 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer , (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si ze", "1400"); 123 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer , (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si ze", "1400");
124 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"); 124 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");
125 125
126 if (window.SharedArrayBuffer) {
127 // Test SharedArrayBuffer parameters.
128 shouldThrow("new Blob([new Uint8Array(new SharedArrayBuffer(4))])", '"TypeErro r: Failed to construct \'Blob\': The provided ArrayBufferView value must not be shared."');
129 }
130
126 // Test passing blob parts in objects with indexed properties. 131 // Test passing blob parts in objects with indexed properties.
127 // (This depends on the bindings code handling of sequence<T>) 132 // (This depends on the bindings code handling of sequence<T>)
128 shouldBe("new Blob({length: 0}).size", "0"); 133 shouldBe("new Blob({length: 0}).size", "0");
129 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); 134 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6");
130 135
131 testNormalization(); 136 testNormalization();
132 137
133 function testNormalization() { 138 function testNormalization() {
134 // Test that strings are not NFC normalized 139 // Test that strings are not NFC normalized
135 OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC 140 OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC
(...skipping 14 matching lines...) Expand all
150 reader = new FileReader(); 155 reader = new FileReader();
151 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES])); 156 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES]));
152 reader.onload = function() { 157 reader.onload = function() {
153 shouldBe("reader.result.charCodeAt(3)", "0xFFFD"); 158 shouldBe("reader.result.charCodeAt(3)", "0xFFFD");
154 shouldBe("reader.result.charCodeAt(7)", "0xFFFD"); 159 shouldBe("reader.result.charCodeAt(7)", "0xFFFD");
155 finishJSTest(); 160 finishJSTest();
156 }; 161 };
157 } 162 }
158 163
159 </script> 164 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698