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 without providing the necessary objects"); |
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 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.compileShader(undefined)"); |
michael@0 | 50 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.linkProgram(undefined)"); |
michael@0 | 51 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(undefined, undefined)"); |
michael@0 | 52 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(program, undefined)"); |
michael@0 | 53 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(undefined, shader)"); |
michael@0 | 54 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.detachShader(program, undefined)"); |
michael@0 | 55 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.detachShader(undefined, shader)"); |
michael@0 | 56 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.shaderSource(undefined, undefined)"); |
michael@0 | 57 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.shaderSource(undefined, 'foo')"); |
michael@0 | 58 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.bindAttribLocation(undefined, 0, 'foo')"); |
michael@0 | 59 | shouldThrow("context.bindBuffer(context.ARRAY_BUFFER, 0)"); |
michael@0 | 60 | shouldThrow("context.bindFramebuffer(context.FRAMEBUFFER, 0)"); |
michael@0 | 61 | shouldThrow("context.bindRenderbuffer(context.RENDERBUFFER, 0)"); |
michael@0 | 62 | shouldThrow("context.bindTexture(context.TEXTURE_2D, 0)"); |
michael@0 | 63 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, null)"); |
michael@0 | 64 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, null)"); |
michael@0 | 65 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, null)"); |
michael@0 | 66 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, null)"); |
michael@0 | 67 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, undefined)"); |
michael@0 | 68 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, undefined)"); |
michael@0 | 69 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, undefined)"); |
michael@0 | 70 | shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, undefined)"); |
michael@0 | 71 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null)"); |
michael@0 | 72 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0)"); |
michael@0 | 73 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getProgramParameter(undefined, 0)"); |
michael@0 | 74 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getProgramInfoLog(undefined, 0)"); |
michael@0 | 75 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderParameter(undefined, 0)"); |
michael@0 | 76 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderInfoLog(undefined, 0)"); |
michael@0 | 77 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderSource(undefined)"); |
michael@0 | 78 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getUniform(undefined, null)"); |
michael@0 | 79 | shouldGenerateGLError(context, context.INVALID_VALUE, "context.getUniformLocation(undefined, 'foo')"); |
michael@0 | 80 | |
michael@0 | 81 | debug(""); |
michael@0 | 82 | debug("check with bindings"); |
michael@0 | 83 | context.bindBuffer(context.ARRAY_BUFFER, context.createBuffer()); |
michael@0 | 84 | context.bindTexture(context.TEXTURE_2D, context.createTexture()); |
michael@0 | 85 | shouldGenerateGLError(context, context.NO_ERROR, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)"); |
michael@0 | 86 | shouldGenerateGLError(context, context.NO_ERROR, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)"); |
michael@0 | 87 | shouldGenerateGLError(context, context.NO_ERROR, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))"); |
michael@0 | 88 | shouldGenerateGLError(context, context.NO_ERROR, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)"); |
michael@0 | 89 | shouldGenerateGLError(context, context.NO_ERROR, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)"); |
michael@0 | 90 | |
michael@0 | 91 | debug(""); |
michael@0 | 92 | debug("check without bindings"); |
michael@0 | 93 | context.bindBuffer(context.ARRAY_BUFFER, null); |
michael@0 | 94 | context.bindTexture(context.TEXTURE_2D, null); |
michael@0 | 95 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)"); |
michael@0 | 96 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)"); |
michael@0 | 97 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))"); |
michael@0 | 98 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)"); |
michael@0 | 99 | shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)"); |
michael@0 | 100 | |
michael@0 | 101 | |
michael@0 | 102 | successfullyParsed = true; |
michael@0 | 103 | </script> |
michael@0 | 104 | |
michael@0 | 105 | <script>finishTest();</script> |
michael@0 | 106 | </body> |
michael@0 | 107 | </html> |