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) 2009 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
michael@0 | 7 | "http://www.w3.org/TR/html4/loose.dtd"> |
michael@0 | 8 | <html> |
michael@0 | 9 | <head> |
michael@0 | 10 | <meta charset="utf-8"> |
michael@0 | 11 | <title>WebGL Out Of Memory Test</title> |
michael@0 | 12 | <link rel="stylesheet" href="../resources/js-test-style.css"/> |
michael@0 | 13 | <script src="../resources/desktop-gl-constants.js" type="text/javascript"></script> |
michael@0 | 14 | <script src="../resources/js-test-pre.js"></script> |
michael@0 | 15 | <script src="../conformance/resources/webgl-test.js"></script> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <div id="description"></div> |
michael@0 | 19 | <div id="console"></div> |
michael@0 | 20 | <canvas id="canvas" width="2" height="2"> </canvas> |
michael@0 | 21 | <script> |
michael@0 | 22 | debug("This tests WebGL running out of memory."); |
michael@0 | 23 | |
michael@0 | 24 | debug(""); |
michael@0 | 25 | debug("Canvas.getContext"); |
michael@0 | 26 | |
michael@0 | 27 | var gl = create3DContext(document.getElementById("canvas")); |
michael@0 | 28 | if (!gl) { |
michael@0 | 29 | testFailed("context does not exist"); |
michael@0 | 30 | } else { |
michael@0 | 31 | testPassed("context exists"); |
michael@0 | 32 | |
michael@0 | 33 | debug(""); |
michael@0 | 34 | debug("Allocating shaders."); |
michael@0 | 35 | |
michael@0 | 36 | function makeBigShader() { |
michael@0 | 37 | var lines = []; |
michael@0 | 38 | var line = "// "; |
michael@0 | 39 | for (var ii = 0; ii < 1024; ++ii) { |
michael@0 | 40 | line += String.fromCharCode(48 + ii % 10); |
michael@0 | 41 | } |
michael@0 | 42 | for (var ii = 0; ii < 1024; ++ii) { |
michael@0 | 43 | lines[ii] = line; |
michael@0 | 44 | } |
michael@0 | 45 | var oneMB = lines.join(); |
michael@0 | 46 | for (var ii = 0; ii < 64; ++ii) { |
michael@0 | 47 | lines[ii] = oneMB; |
michael@0 | 48 | } |
michael@0 | 49 | return lines.join("\n"); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | var shaderSource = makeBigShader(); |
michael@0 | 53 | debug("created " + Math.floor(shaderSource.length / 1024 / 1024) + "MB shader"); |
michael@0 | 54 | |
michael@0 | 55 | var intervalId; |
michael@0 | 56 | var count = 0; |
michael@0 | 57 | |
michael@0 | 58 | function makeShader() { |
michael@0 | 59 | ++count; |
michael@0 | 60 | debug ("creating shader #" + count + " mem = " + Math.floor(shaderSource.length * count / 1024 / 1024) + "MB"); |
michael@0 | 61 | var shader = gl.createShader(gl.VERTEX_SHADER); |
michael@0 | 62 | if (shader == null) { |
michael@0 | 63 | window.clearInterval(intervalId); |
michael@0 | 64 | testPassed("createShader returns null"); // not sure this is a passing |
michael@0 | 65 | finish(); |
michael@0 | 66 | } else { |
michael@0 | 67 | gl.shaderSource(shader, shaderSource); |
michael@0 | 68 | var err = gl.getError(); |
michael@0 | 69 | if (err != gl.NO_ERROR) { |
michael@0 | 70 | window.clearInterval(intervalId); |
michael@0 | 71 | assertMsg(err == gl.OUT_OF_MEMORY, "shaderSource returns OUT_OF_MEMORY"); |
michael@0 | 72 | finish(); |
michael@0 | 73 | } |
michael@0 | 74 | } |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | intervalId = window.setInterval(makeShader, 1000/15); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | function finish() { |
michael@0 | 81 | debug(""); |
michael@0 | 82 | successfullyParsed = true; |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | </script> |
michael@0 | 86 | <!-- <script>finishTest();</script> --> |
michael@0 | 87 | |
michael@0 | 88 | <script> |
michael@0 | 89 | </script> |
michael@0 | 90 | |
michael@0 | 91 | </body> |
michael@0 | 92 | </html> |