summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal.html
blob: f5425d77586eccc4802f9dbb2a1ec5c486250ce4 (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
43
44
45
46
47
48
49
50
51
<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 the get method, and the set method for individual elements, on the WebGLArray types no longer exist.");

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 negativeTestGetAndSetMethods(typeName) {
    var type = window[typeName];
    webGLArray = new type([2, 3]);
    shouldBeUndefined("webGLArray.get");
    var exceptionThrown = false;
    // We deliberately check for an exception here rather than using
    // shouldThrow here because the precise contents of the syntax
    // error are not specified.
    try {
        webGLArray.set(0, 1);
    } catch (e) {
        exceptionThrown = true;
    }
    var output = "webGLArray.set(0, 1) ";
    if (exceptionThrown) {
        testPassed(output + "threw exception.");
    } else {
        testFailed(output + "did not throw exception.");
    }
}

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

</script>

</body>
</html>