gecko/content/canvas/test/webgl/reference-cycle-test.patch
Benoit Jacob 7acfec9dc1 Bug 734423 - Upgrade WebGL conformance test suite to 1.0.1 in-principle-final (r17063) - no review
1.0.1 is in principle a done thing. This is also the occasion to do a clean upgrade, by rm and cp, instead of applying a diff.

Upstream:
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/conformance-suites/1.0.1/
2012-03-26 15:10:40 -04:00

108 lines
3.7 KiB
Diff

# HG changeset patch
# Parent fae4a63127468bd6447453495c82b9f6713888fb
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
--- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
+++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
@@ -116,16 +116,17 @@ if (!gl) {
testPassed("Successfully enabled OES_standard_derivatives extension");
runSupportedTest(true);
runHintTestEnabled();
runShaderTests(true);
runOutputTests();
runUniqueObjectTest();
+ runReferenceCycleTest();
}
}
function runSupportedTest(extensionEnabled) {
var supported = gl.getSupportedExtensions();
if (supported.indexOf("OES_standard_derivatives") >= 0) {
if (extensionEnabled) {
testPassed("OES_standard_derivatives listed as supported and getExtension succeeded");
@@ -365,16 +366,30 @@ function runUniqueObjectTest()
} else if (window.opera && window.opera.collect) {
window.opera.collect();
} else {
attemptToForceGC();
}
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
}
+function runReferenceCycleTest()
+{
+ // create some reference cycles. The goal is to see if they cause leaks. The point is that
+ // some browser test runners have instrumentation to detect leaked refcounted objects.
+
+ debug("Testing reference cycles between context and extension objects");
+ var ext = gl.getExtension("OES_standard_derivatives");
+
+ // create cycle between extension and context, since the context has to hold a reference to the extension
+ ext.context = gl;
+
+ // create a self-cycle on the extension object
+ ext.ext = ext;
+}
debug("");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
--- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
+++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
@@ -81,16 +81,17 @@ if (!gl) {
if (!gl.getExtension("OES_texture_float")) {
testPassed("No OES_texture_float support -- this is legal");
} else {
testPassed("Successfully enabled OES_texture_float extension");
runTextureCreationTest(testProgram, true);
runRenderTargetTest(testProgram);
runUniqueObjectTest();
+ runReferenceCycleTest();
}
}
// Needs to be global for shouldBe to see it.
var pixels;
function allocateTexture()
{
@@ -206,16 +207,30 @@ function runUniqueObjectTest()
} else if (window.opera && window.opera.collect) {
window.opera.collect();
} else {
attemptToForceGC();
}
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
}
+function runReferenceCycleTest()
+{
+ // create some reference cycles. The goal is to see if they cause leaks. The point is that
+ // some browser test runners have instrumentation to detect leaked refcounted objects.
+
+ debug("Testing reference cycles between context and extension objects");
+ var ext = gl.getExtension("OES_texture_float");
+
+ // create cycle between extension and context, since the context has to hold a reference to the extension
+ ext.context = gl;
+
+ // create a self-cycle on the extension object
+ ext.ext = ext;
+}
debug("");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>