3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
11 description("Test overriding the set method of WebGL array");
13 debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=87862">https://bugs.webkit.org/show_bug.cgi?id=87862</a> : <code>[v8] Crash after redefining setter on typed array to a number</code>');
16 var typeNames
= ['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array',
17 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array']
19 function overrideSetWithNumberAndConstruct(typeName
) {
20 var type
= window
[typeName
];
21 type
.prototype.set = 0x3ffff;
22 array
= new type([0], function() {});
23 shouldBe("array[0]", "0");
26 for (var i
= 0; i
< typeNames
.length
; i
++) {
27 overrideSetWithNumberAndConstruct(typeNames
[i
]);
30 function overrideSetWithNumberAndSet(typeName
) {
31 var type
= window
[typeName
];
33 type
.prototype.set = 0x3ffff;
35 array
.set([0], function() {});
36 shouldBe("array[0]", "0");
39 for (var i
= 0; i
< typeNames
.length
; i
++) {
40 overrideSetWithNumberAndConstruct(typeNames
[i
]);