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.

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

mercurial