summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds.html
blob: bf6bbe4c75176e7a27223fc2770000a35c2f8c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>

<script>

description("Verifies that calling the indexing operator on WebGLArrays with out-of-range indices returns undefined.");

debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38039">https://bugs.webkit.org/show_bug.cgi?id=38039</a>');

// Global scope so shouldThrow can see it
var webGLArray;

function testGetWithOutOfRangeIndices(typeName) {
    var type = window[typeName];
    webGLArray = new type([2, 3]);
    shouldBeUndefined("webGLArray[2]");
    shouldBeUndefined("webGLArray[-1]");
    shouldBeUndefined("webGLArray[0x20000000]");
}

testGetWithOutOfRangeIndices("Int8Array");
testGetWithOutOfRangeIndices("Uint8Array");
testGetWithOutOfRangeIndices("Int16Array");
testGetWithOutOfRangeIndices("Uint16Array");
testGetWithOutOfRangeIndices("Int32Array");
testGetWithOutOfRangeIndices("Uint32Array");
testGetWithOutOfRangeIndices("Float32Array");

</script>

</body>
</html>