Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (C) 2011 Apple Computer, Inc. All rights reserved. |
michael@0 | 3 | |
michael@0 | 4 | Redistribution and use in source and binary forms, with or without |
michael@0 | 5 | modification, are permitted provided that the following conditions |
michael@0 | 6 | are met: |
michael@0 | 7 | 1. Redistributions of source code must retain the above copyright |
michael@0 | 8 | notice, this list of conditions and the following disclaimer. |
michael@0 | 9 | 2. Redistributions in binary form must reproduce the above copyright |
michael@0 | 10 | notice, this list of conditions and the following disclaimer in the |
michael@0 | 11 | documentation and/or other materials provided with the distribution. |
michael@0 | 12 | |
michael@0 | 13 | THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
michael@0 | 14 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
michael@0 | 16 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
michael@0 | 17 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
michael@0 | 18 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
michael@0 | 19 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
michael@0 | 20 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
michael@0 | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
michael@0 | 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
michael@0 | 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 24 | --> |
michael@0 | 25 | <!DOCTYPE html> |
michael@0 | 26 | <html> |
michael@0 | 27 | <head> |
michael@0 | 28 | <meta charset="utf-8"> |
michael@0 | 29 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 30 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 31 | <script src="../resources/webgl-test.js"></script> |
michael@0 | 32 | <script src="../resources/webgl-test-utils.js"></script> |
michael@0 | 33 | </head> |
michael@0 | 34 | <body> |
michael@0 | 35 | <div id="description"></div> |
michael@0 | 36 | <div id="console"></div> |
michael@0 | 37 | |
michael@0 | 38 | <script> |
michael@0 | 39 | var wtu = WebGLTestUtils; |
michael@0 | 40 | description("Tests calling WebGL APIs with wrong argument types"); |
michael@0 | 41 | |
michael@0 | 42 | var context = wtu.create3DContext(); |
michael@0 | 43 | var program = wtu.loadStandardProgram(context); |
michael@0 | 44 | var shader = wtu.loadStandardVertexShader(context); |
michael@0 | 45 | var shouldGenerateGLError = wtu.shouldGenerateGLError; |
michael@0 | 46 | |
michael@0 | 47 | assertMsg(program != null, "Program Compiled"); |
michael@0 | 48 | assertMsg(shader != null, "Shader Compiled"); |
michael@0 | 49 | |
michael@0 | 50 | var loc = context.getUniformLocation(program, "u_modelViewProjMatrix"); |
michael@0 | 51 | assertMsg(loc != null, "getUniformLocation succeeded"); |
michael@0 | 52 | |
michael@0 | 53 | var arguments = [ |
michael@0 | 54 | { value: "foo", |
michael@0 | 55 | throws: true }, |
michael@0 | 56 | { value: 0, |
michael@0 | 57 | throws: true }, |
michael@0 | 58 | { value: null, |
michael@0 | 59 | throws: false }, |
michael@0 | 60 | { value: undefined, |
michael@0 | 61 | throws: false } |
michael@0 | 62 | ]; |
michael@0 | 63 | |
michael@0 | 64 | var argument; |
michael@0 | 65 | |
michael@0 | 66 | function shouldBeEmptyString(command) { |
michael@0 | 67 | shouldBe(command, "''"); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | for (var i = 0; i < arguments.length; ++i) { |
michael@0 | 71 | var func, func2, func3; |
michael@0 | 72 | if (arguments[i].throws) { |
michael@0 | 73 | func = shouldThrow; |
michael@0 | 74 | func2 = shouldThrow; |
michael@0 | 75 | func3 = shouldThrow; |
michael@0 | 76 | } else { |
michael@0 | 77 | func = shouldBeUndefined; |
michael@0 | 78 | func2 = shouldBeNull; |
michael@0 | 79 | func3 = shouldBeEmptyString; |
michael@0 | 80 | } |
michael@0 | 81 | argument = arguments[i].value; |
michael@0 | 82 | func("context.compileShader(argument)"); |
michael@0 | 83 | func("context.linkProgram(argument)"); |
michael@0 | 84 | func("context.attachShader(program, argument)"); |
michael@0 | 85 | func("context.attachShader(argument, shader)"); |
michael@0 | 86 | func("context.detachShader(program, argument)"); |
michael@0 | 87 | func("context.detachShader(argument, shader)"); |
michael@0 | 88 | func("context.useProgram(argument)"); |
michael@0 | 89 | func("context.shaderSource(argument, 'foo')"); |
michael@0 | 90 | func("context.bindAttribLocation(argument, 0, 'foo')"); |
michael@0 | 91 | func("context.bindBuffer(context.ARRAY_BUFFER, argument)"); |
michael@0 | 92 | func("context.bindFramebuffer(context.FRAMEBUFFER, argument)"); |
michael@0 | 93 | func("context.bindRenderbuffer(context.RENDERBUFFER, argument)"); |
michael@0 | 94 | func("context.bindTexture(context.TEXTURE_2D, argument)"); |
michael@0 | 95 | func("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, argument)"); |
michael@0 | 96 | func("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, argument, 0)"); |
michael@0 | 97 | func("context.uniform2fv(argument, new Float32Array([0.0, 0.0]))"); |
michael@0 | 98 | func("context.uniform2iv(argument, new Int32Array([0, 0]))"); |
michael@0 | 99 | func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))"); |
michael@0 | 100 | |
michael@0 | 101 | func2("context.getProgramParameter(argument, 0)"); |
michael@0 | 102 | func2("context.getShaderParameter(argument, 0)"); |
michael@0 | 103 | func2("context.getUniform(argument, loc)"); |
michael@0 | 104 | func2("context.getUniform(program, argument)"); |
michael@0 | 105 | func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')"); |
michael@0 | 106 | |
michael@0 | 107 | func3("context.getProgramInfoLog(argument)"); |
michael@0 | 108 | func3("context.getShaderInfoLog(argument)"); |
michael@0 | 109 | func3("context.getShaderSource(argument)"); |
michael@0 | 110 | } |
michael@0 | 111 | |
michael@0 | 112 | successfullyParsed = true; |
michael@0 | 113 | </script> |
michael@0 | 114 | |
michael@0 | 115 | <script>finishTest();</script> |
michael@0 | 116 | </body> |
michael@0 | 117 | </html> |