summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/shader-deleted-by-accessor.html
blob: 8b4abe4a92e6d0ab1eac3caf5256274b06489edb (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>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>

<script>

description("Verifies that WebGLRenderingContext::getAttachedShaders doesn't crash when an accessor property is defined on Array.prototype.");

if (window.internals)
    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);

context = create3DContext();
program = context.createProgram();

shader1 = context.createShader(context.VERTEX_SHADER);
context.attachShader(program, shader1);

for (var i = 0; i < 10; ++i) {
    shader2 = context.createShader(context.FRAGMENT_SHADER);
    context.attachShader(program, shader2);

    Array.prototype.__defineSetter__(0, function() {
        context.detachShader(program, shader2);
        context.deleteShader(shader2);
        shader2 = null;
        gc();
    });

    shaders = context.getAttachedShaders(program);
    context.getShaderParameter(shaders[1], 0);
}
</script>

</body>
</html>