| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 assertSame(elementSize, aOverAbLen0.BYTES_PER_ELEMENT); | 258 assertSame(elementSize, aOverAbLen0.BYTES_PER_ELEMENT); |
| 259 assertSame(0, aOverAbLen0.length); | 259 assertSame(0, aOverAbLen0.length); |
| 260 assertSame(0, aOverAbLen0.byteLength); | 260 assertSame(0, aOverAbLen0.byteLength); |
| 261 assertSame(0, aOverAbLen0.byteOffset); | 261 assertSame(0, aOverAbLen0.byteOffset); |
| 262 | 262 |
| 263 var aNoParam = new constr(); | 263 var aNoParam = new constr(); |
| 264 assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT); | 264 assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT); |
| 265 assertSame(0, aNoParam.length); | 265 assertSame(0, aNoParam.length); |
| 266 assertSame(0, aNoParam.byteLength); | 266 assertSame(0, aNoParam.byteLength); |
| 267 assertSame(0, aNoParam.byteOffset); | 267 assertSame(0, aNoParam.byteOffset); |
| 268 |
| 269 var a = new constr(ab, 64*elementSize, 128); |
| 270 assertEquals("[object " + constr.name + "]", |
| 271 Object.prototype.toString.call(a)); |
| 272 var desc = Object.getOwnPropertyDescriptor( |
| 273 constr.prototype, Symbol.toStringTag); |
| 274 assertTrue(desc.configurable); |
| 275 assertFalse(desc.enumerable); |
| 276 assertFalse(!!desc.writable); |
| 277 assertFalse(!!desc.set); |
| 278 assertEquals("function", typeof desc.get); |
| 268 } | 279 } |
| 269 | 280 |
| 270 TestTypedArray(Uint8Array, 1, 0xFF); | 281 TestTypedArray(Uint8Array, 1, 0xFF); |
| 271 TestTypedArray(Int8Array, 1, -0x7F); | 282 TestTypedArray(Int8Array, 1, -0x7F); |
| 272 TestTypedArray(Uint16Array, 2, 0xFFFF); | 283 TestTypedArray(Uint16Array, 2, 0xFFFF); |
| 273 TestTypedArray(Int16Array, 2, -0x7FFF); | 284 TestTypedArray(Int16Array, 2, -0x7FFF); |
| 274 TestTypedArray(Uint32Array, 4, 0xFFFFFFFF); | 285 TestTypedArray(Uint32Array, 4, 0xFFFFFFFF); |
| 275 TestTypedArray(Int32Array, 4, -0x7FFFFFFF); | 286 TestTypedArray(Int32Array, 4, -0x7FFFFFFF); |
| 276 TestTypedArray(Float32Array, 4, 0.5); | 287 TestTypedArray(Float32Array, 4, 0.5); |
| 277 TestTypedArray(Float64Array, 8, 0.5); | 288 TestTypedArray(Float64Array, 8, 0.5); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 } | 658 } |
| 648 | 659 |
| 649 CheckProperty("buffer"); | 660 CheckProperty("buffer"); |
| 650 CheckProperty("byteOffset"); | 661 CheckProperty("byteOffset"); |
| 651 CheckProperty("byteLength"); | 662 CheckProperty("byteLength"); |
| 652 } | 663 } |
| 653 | 664 |
| 654 | 665 |
| 655 TestDataViewPropertyTypeChecks(); | 666 TestDataViewPropertyTypeChecks(); |
| 656 | 667 |
| 668 |
| 669 function TestDataViewToStringTag() { |
| 670 var a = new DataView(new ArrayBuffer(10)); |
| 671 assertEquals("[object DataView]", Object.prototype.toString.call(a)); |
| 672 var desc = Object.getOwnPropertyDescriptor( |
| 673 DataView.prototype, Symbol.toStringTag); |
| 674 assertTrue(desc.configurable); |
| 675 assertFalse(desc.enumerable); |
| 676 assertFalse(desc.writable); |
| 677 assertEquals("DataView", desc.value); |
| 678 } |
| 679 |
| 680 |
| 657 // General tests for properties | 681 // General tests for properties |
| 658 | 682 |
| 659 // Test property attribute [[Enumerable]] | 683 // Test property attribute [[Enumerable]] |
| 660 function TestEnumerable(func, obj) { | 684 function TestEnumerable(func, obj) { |
| 661 function props(x) { | 685 function props(x) { |
| 662 var array = []; | 686 var array = []; |
| 663 for (var p in x) array.push(p); | 687 for (var p in x) array.push(p); |
| 664 return array.sort(); | 688 return array.sort(); |
| 665 } | 689 } |
| 666 assertArrayEquals([], props(func)); | 690 assertArrayEquals([], props(func)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 688 TestArbitrary(new ArrayBuffer(256)); | 712 TestArbitrary(new ArrayBuffer(256)); |
| 689 for(i = 0; i < typedArrayConstructors.length; i++) { | 713 for(i = 0; i < typedArrayConstructors.length; i++) { |
| 690 TestArbitrary(new typedArrayConstructors[i](10)); | 714 TestArbitrary(new typedArrayConstructors[i](10)); |
| 691 } | 715 } |
| 692 TestArbitrary(new DataView(new ArrayBuffer(256))); | 716 TestArbitrary(new DataView(new ArrayBuffer(256))); |
| 693 | 717 |
| 694 | 718 |
| 695 // Test direct constructor call | 719 // Test direct constructor call |
| 696 assertThrows(function() { ArrayBuffer(); }, TypeError); | 720 assertThrows(function() { ArrayBuffer(); }, TypeError); |
| 697 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); | 721 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); |
| OLD | NEW |