summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds.html
blob: 0c757d6afeafaef44d29c595db80452425867edb (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
39
40
41
42
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
<script src="../../js/resources/js-test-pre.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("WebGLByteArray");
testGetWithOutOfRangeIndices("WebGLUnsignedByteArray");
testGetWithOutOfRangeIndices("WebGLShortArray");
testGetWithOutOfRangeIndices("WebGLUnsignedShortArray");
testGetWithOutOfRangeIndices("WebGLIntArray");
testGetWithOutOfRangeIndices("WebGLUnsignedIntArray");
testGetWithOutOfRangeIndices("WebGLFloatArray");

successfullyParsed = true;

</script>

<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>