content/canvas/test/webgl-conformance/reference-cycle-test.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/reference-cycle-test.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +# HG changeset patch
     1.5 +# Parent fae4a63127468bd6447453495c82b9f6713888fb
     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 +@@ -116,16 +116,17 @@ if (!gl) {
    1.11 +         testPassed("Successfully enabled OES_standard_derivatives extension");
    1.12 + 
    1.13 +         runSupportedTest(true);
    1.14 + 
    1.15 +         runHintTestEnabled();
    1.16 +         runShaderTests(true);
    1.17 +         runOutputTests();
    1.18 +         runUniqueObjectTest();
    1.19 ++        runReferenceCycleTest();
    1.20 +     }
    1.21 + }
    1.22 + 
    1.23 + function runSupportedTest(extensionEnabled) {
    1.24 +     var supported = gl.getSupportedExtensions();
    1.25 +     if (supported.indexOf("OES_standard_derivatives") >= 0) {
    1.26 +         if (extensionEnabled) {
    1.27 +             testPassed("OES_standard_derivatives listed as supported and getExtension succeeded");
    1.28 +@@ -365,16 +366,30 @@ function runUniqueObjectTest()
    1.29 +     } else if (window.opera && window.opera.collect) {
    1.30 +         window.opera.collect();
    1.31 +     } else {
    1.32 +         attemptToForceGC();
    1.33 +     }
    1.34 +     shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
    1.35 + }
    1.36 + 
    1.37 ++function runReferenceCycleTest()
    1.38 ++{
    1.39 ++    // create some reference cycles. The goal is to see if they cause leaks. The point is that
    1.40 ++    // some browser test runners have instrumentation to detect leaked refcounted objects.
    1.41 ++
    1.42 ++    debug("Testing reference cycles between context and extension objects");
    1.43 ++    var ext = gl.getExtension("OES_standard_derivatives");
    1.44 ++
    1.45 ++    // create cycle between extension and context, since the context has to hold a reference to the extension
    1.46 ++    ext.context = gl;
    1.47 ++
    1.48 ++    // create a self-cycle on the extension object
    1.49 ++    ext.ext = ext;
    1.50 ++}
    1.51 + 
    1.52 + debug("");
    1.53 + successfullyParsed = true;
    1.54 + </script>
    1.55 + <script>finishTest();</script>
    1.56 + 
    1.57 + </body>
    1.58 + </html>
    1.59 +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.60 +--- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
    1.61 ++++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
    1.62 +@@ -81,16 +81,17 @@ if (!gl) {
    1.63 + 
    1.64 +   if (!gl.getExtension("OES_texture_float")) {
    1.65 +       testPassed("No OES_texture_float support -- this is legal");
    1.66 +   } else {
    1.67 +       testPassed("Successfully enabled OES_texture_float extension");
    1.68 +       runTextureCreationTest(testProgram, true);
    1.69 +       runRenderTargetTest(testProgram);
    1.70 +       runUniqueObjectTest();
    1.71 ++      runReferenceCycleTest();
    1.72 +   }
    1.73 + }
    1.74 + 
    1.75 + // Needs to be global for shouldBe to see it.
    1.76 + var pixels;
    1.77 + 
    1.78 + function allocateTexture()
    1.79 + {
    1.80 +@@ -206,16 +207,30 @@ function runUniqueObjectTest()
    1.81 +     } else if (window.opera && window.opera.collect) {
    1.82 +         window.opera.collect();
    1.83 +     } else {
    1.84 +         attemptToForceGC();
    1.85 +     }
    1.86 +     shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
    1.87 + }
    1.88 + 
    1.89 ++function runReferenceCycleTest()
    1.90 ++{
    1.91 ++    // create some reference cycles. The goal is to see if they cause leaks. The point is that
    1.92 ++    // some browser test runners have instrumentation to detect leaked refcounted objects.
    1.93 ++
    1.94 ++    debug("Testing reference cycles between context and extension objects");
    1.95 ++    var ext = gl.getExtension("OES_texture_float");
    1.96 ++
    1.97 ++    // create cycle between extension and context, since the context has to hold a reference to the extension
    1.98 ++    ext.context = gl;
    1.99 ++
   1.100 ++    // create a self-cycle on the extension object
   1.101 ++    ext.ext = ext;
   1.102 ++}
   1.103 + 
   1.104 + debug("");
   1.105 + successfullyParsed = true;
   1.106 + </script>
   1.107 + <script>finishTest();</script>
   1.108 + 
   1.109 + </body>
   1.110 + </html>

mercurial