1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/gc.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,155 @@ 1.4 +# HG changeset patch 1.5 +# Parent f9585cefcf568dbc2a6ce81f16a2048365af7ed2 1.6 + 1.7 +diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html 1.8 +--- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html 1.9 ++++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html 1.10 +@@ -337,42 +337,21 @@ function runOutputTests() { 1.11 + setupBuffers(1.0, 0.5, 0.5, 0.0); 1.12 + wtu.drawQuad(gl); 1.13 + expectResult([3, 3, 5, 255], 1.14 + "Draw 4 (variation in x & y) returned the correct data", 1.15 + "Draw 4 (variation in x & y) returned incorrect data"); 1.16 + 1.17 + } 1.18 + 1.19 +-function attemptToForceGC() 1.20 +-{ 1.21 +- var holderArray = []; 1.22 +- var tempArray; 1.23 +- window.tempArray = holderArray; 1.24 +- for (var i = 0; i < 12; ++i) { 1.25 +- tempArray = []; 1.26 +- for (var j = 0; j < 1024 * 1024; ++j) { 1.27 +- tempArray.push(0); 1.28 +- } 1.29 +- holderArray.push(tempArray); 1.30 +- } 1.31 +- window.tempArray = null; 1.32 +-} 1.33 +- 1.34 + function runUniqueObjectTest() 1.35 + { 1.36 + debug("Testing that getExtension() returns the same object each time"); 1.37 + gl.getExtension("OES_standard_derivatives").myProperty = 2; 1.38 +- if (window.GCController) { 1.39 +- window.GCController.collect(); 1.40 +- } else if (window.opera && window.opera.collect) { 1.41 +- window.opera.collect(); 1.42 +- } else { 1.43 +- attemptToForceGC(); 1.44 +- } 1.45 ++ gc(); 1.46 + shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2'); 1.47 + } 1.48 + 1.49 + function runReferenceCycleTest() 1.50 + { 1.51 + // create some reference cycles. The goal is to see if they cause leaks. The point is that 1.52 + // some browser test runners have instrumentation to detect leaked refcounted objects. 1.53 + 1.54 +diff --git a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html 1.55 +--- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html 1.56 ++++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html 1.57 +@@ -178,42 +178,21 @@ function runRenderTargetTest(testProgram 1.58 + gl.bindTexture(gl.TEXTURE_2D, texture); 1.59 + gl.useProgram(testProgram); 1.60 + gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0); 1.61 + wtu.drawQuad(gl); 1.62 + glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed"); 1.63 + checkRenderingResults(); 1.64 + } 1.65 + 1.66 +-function attemptToForceGC() 1.67 +-{ 1.68 +- var holderArray = []; 1.69 +- var tempArray; 1.70 +- window.tempArray = holderArray; 1.71 +- for (var i = 0; i < 12; ++i) { 1.72 +- tempArray = []; 1.73 +- for (var j = 0; j < 1024 * 1024; ++j) { 1.74 +- tempArray.push(0); 1.75 +- } 1.76 +- holderArray.push(tempArray); 1.77 +- } 1.78 +- window.tempArray = null; 1.79 +-} 1.80 +- 1.81 + function runUniqueObjectTest() 1.82 + { 1.83 + debug("Testing that getExtension() returns the same object each time"); 1.84 + gl.getExtension("OES_texture_float").myProperty = 2; 1.85 +- if (window.GCController) { 1.86 +- window.GCController.collect(); 1.87 +- } else if (window.opera && window.opera.collect) { 1.88 +- window.opera.collect(); 1.89 +- } else { 1.90 +- attemptToForceGC(); 1.91 +- } 1.92 ++ gc(); 1.93 + shouldBe('gl.getExtension("OES_texture_float").myProperty', '2'); 1.94 + } 1.95 + 1.96 + function runReferenceCycleTest() 1.97 + { 1.98 + // create some reference cycles. The goal is to see if they cause leaks. The point is that 1.99 + // some browser test runners have instrumentation to detect leaked refcounted objects. 1.100 + 1.101 +diff --git a/content/canvas/test/webgl/resources/js-test-pre.js b/content/canvas/test/webgl/resources/js-test-pre.js 1.102 +--- a/content/canvas/test/webgl/resources/js-test-pre.js 1.103 ++++ b/content/canvas/test/webgl/resources/js-test-pre.js 1.104 +@@ -435,29 +435,42 @@ function assertMsg(assertion, msg) { 1.105 + if (assertion) { 1.106 + testPassed(msg); 1.107 + } else { 1.108 + testFailed(msg); 1.109 + } 1.110 + } 1.111 + 1.112 + function gc() { 1.113 +- if (typeof GCController !== "undefined") 1.114 +- GCController.collect(); 1.115 +- else { 1.116 +- function gcRec(n) { 1.117 +- if (n < 1) 1.118 +- return {}; 1.119 +- var temp = {i: "ab" + i + (i / 100000)}; 1.120 +- temp += "foo"; 1.121 +- gcRec(n-1); 1.122 +- } 1.123 +- for (var i = 0; i < 1000; i++) 1.124 +- gcRec(10) 1.125 ++ if (window.GCController) { 1.126 ++ window.GCController.collect(); 1.127 ++ return; 1.128 + } 1.129 ++ 1.130 ++ if (window.opera && window.opera.collect) { 1.131 ++ window.opera.collect(); 1.132 ++ return; 1.133 ++ } 1.134 ++ 1.135 ++ try { 1.136 ++ window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) 1.137 ++ .getInterface(Components.interfaces.nsIDOMWindowUtils) 1.138 ++ .garbageCollect(); 1.139 ++ return; 1.140 ++ } catch(e) {} 1.141 ++ 1.142 ++ function gcRec(n) { 1.143 ++ if (n < 1) 1.144 ++ return {}; 1.145 ++ var temp = {i: "ab" + i + (i / 100000)}; 1.146 ++ temp += "foo"; 1.147 ++ gcRec(n-1); 1.148 ++ } 1.149 ++ for (var i = 0; i < 1000; i++) 1.150 ++ gcRec(10); 1.151 + } 1.152 + 1.153 + function finishTest() { 1.154 + successfullyParsed = true; 1.155 + var epilogue = document.createElement("script"); 1.156 + epilogue.onload = function() { 1.157 + if (window.nonKhronosFrameworkNotifyDone) { 1.158 + window.nonKhronosFrameworkNotifyDone();