content/canvas/test/webgl-conformance/gc.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # HG changeset patch
michael@0 2 # Parent f9585cefcf568dbc2a6ce81f16a2048365af7ed2
michael@0 3
michael@0 4 diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
michael@0 5 --- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
michael@0 6 +++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
michael@0 7 @@ -337,42 +337,21 @@ function runOutputTests() {
michael@0 8 setupBuffers(1.0, 0.5, 0.5, 0.0);
michael@0 9 wtu.drawQuad(gl);
michael@0 10 expectResult([3, 3, 5, 255],
michael@0 11 "Draw 4 (variation in x & y) returned the correct data",
michael@0 12 "Draw 4 (variation in x & y) returned incorrect data");
michael@0 13
michael@0 14 }
michael@0 15
michael@0 16 -function attemptToForceGC()
michael@0 17 -{
michael@0 18 - var holderArray = [];
michael@0 19 - var tempArray;
michael@0 20 - window.tempArray = holderArray;
michael@0 21 - for (var i = 0; i < 12; ++i) {
michael@0 22 - tempArray = [];
michael@0 23 - for (var j = 0; j < 1024 * 1024; ++j) {
michael@0 24 - tempArray.push(0);
michael@0 25 - }
michael@0 26 - holderArray.push(tempArray);
michael@0 27 - }
michael@0 28 - window.tempArray = null;
michael@0 29 -}
michael@0 30 -
michael@0 31 function runUniqueObjectTest()
michael@0 32 {
michael@0 33 debug("Testing that getExtension() returns the same object each time");
michael@0 34 gl.getExtension("OES_standard_derivatives").myProperty = 2;
michael@0 35 - if (window.GCController) {
michael@0 36 - window.GCController.collect();
michael@0 37 - } else if (window.opera && window.opera.collect) {
michael@0 38 - window.opera.collect();
michael@0 39 - } else {
michael@0 40 - attemptToForceGC();
michael@0 41 - }
michael@0 42 + gc();
michael@0 43 shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
michael@0 44 }
michael@0 45
michael@0 46 function runReferenceCycleTest()
michael@0 47 {
michael@0 48 // create some reference cycles. The goal is to see if they cause leaks. The point is that
michael@0 49 // some browser test runners have instrumentation to detect leaked refcounted objects.
michael@0 50
michael@0 51 diff --git a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
michael@0 52 --- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
michael@0 53 +++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
michael@0 54 @@ -178,42 +178,21 @@ function runRenderTargetTest(testProgram
michael@0 55 gl.bindTexture(gl.TEXTURE_2D, texture);
michael@0 56 gl.useProgram(testProgram);
michael@0 57 gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0);
michael@0 58 wtu.drawQuad(gl);
michael@0 59 glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed");
michael@0 60 checkRenderingResults();
michael@0 61 }
michael@0 62
michael@0 63 -function attemptToForceGC()
michael@0 64 -{
michael@0 65 - var holderArray = [];
michael@0 66 - var tempArray;
michael@0 67 - window.tempArray = holderArray;
michael@0 68 - for (var i = 0; i < 12; ++i) {
michael@0 69 - tempArray = [];
michael@0 70 - for (var j = 0; j < 1024 * 1024; ++j) {
michael@0 71 - tempArray.push(0);
michael@0 72 - }
michael@0 73 - holderArray.push(tempArray);
michael@0 74 - }
michael@0 75 - window.tempArray = null;
michael@0 76 -}
michael@0 77 -
michael@0 78 function runUniqueObjectTest()
michael@0 79 {
michael@0 80 debug("Testing that getExtension() returns the same object each time");
michael@0 81 gl.getExtension("OES_texture_float").myProperty = 2;
michael@0 82 - if (window.GCController) {
michael@0 83 - window.GCController.collect();
michael@0 84 - } else if (window.opera && window.opera.collect) {
michael@0 85 - window.opera.collect();
michael@0 86 - } else {
michael@0 87 - attemptToForceGC();
michael@0 88 - }
michael@0 89 + gc();
michael@0 90 shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
michael@0 91 }
michael@0 92
michael@0 93 function runReferenceCycleTest()
michael@0 94 {
michael@0 95 // create some reference cycles. The goal is to see if they cause leaks. The point is that
michael@0 96 // some browser test runners have instrumentation to detect leaked refcounted objects.
michael@0 97
michael@0 98 diff --git a/content/canvas/test/webgl/resources/js-test-pre.js b/content/canvas/test/webgl/resources/js-test-pre.js
michael@0 99 --- a/content/canvas/test/webgl/resources/js-test-pre.js
michael@0 100 +++ b/content/canvas/test/webgl/resources/js-test-pre.js
michael@0 101 @@ -435,29 +435,42 @@ function assertMsg(assertion, msg) {
michael@0 102 if (assertion) {
michael@0 103 testPassed(msg);
michael@0 104 } else {
michael@0 105 testFailed(msg);
michael@0 106 }
michael@0 107 }
michael@0 108
michael@0 109 function gc() {
michael@0 110 - if (typeof GCController !== "undefined")
michael@0 111 - GCController.collect();
michael@0 112 - else {
michael@0 113 - function gcRec(n) {
michael@0 114 - if (n < 1)
michael@0 115 - return {};
michael@0 116 - var temp = {i: "ab" + i + (i / 100000)};
michael@0 117 - temp += "foo";
michael@0 118 - gcRec(n-1);
michael@0 119 - }
michael@0 120 - for (var i = 0; i < 1000; i++)
michael@0 121 - gcRec(10)
michael@0 122 + if (window.GCController) {
michael@0 123 + window.GCController.collect();
michael@0 124 + return;
michael@0 125 }
michael@0 126 +
michael@0 127 + if (window.opera && window.opera.collect) {
michael@0 128 + window.opera.collect();
michael@0 129 + return;
michael@0 130 + }
michael@0 131 +
michael@0 132 + try {
michael@0 133 + window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 134 + .getInterface(Components.interfaces.nsIDOMWindowUtils)
michael@0 135 + .garbageCollect();
michael@0 136 + return;
michael@0 137 + } catch(e) {}
michael@0 138 +
michael@0 139 + function gcRec(n) {
michael@0 140 + if (n < 1)
michael@0 141 + return {};
michael@0 142 + var temp = {i: "ab" + i + (i / 100000)};
michael@0 143 + temp += "foo";
michael@0 144 + gcRec(n-1);
michael@0 145 + }
michael@0 146 + for (var i = 0; i < 1000; i++)
michael@0 147 + gcRec(10);
michael@0 148 }
michael@0 149
michael@0 150 function finishTest() {
michael@0 151 successfullyParsed = true;
michael@0 152 var epilogue = document.createElement("script");
michael@0 153 epilogue.onload = function() {
michael@0 154 if (window.nonKhronosFrameworkNotifyDone) {
michael@0 155 window.nonKhronosFrameworkNotifyDone();

mercurial