gecko/content/canvas/test/webgl/reference-cycle-test.patch
Benoit Jacob 19c5d673a6 Bug 763355 - attempt to fix timeouts in WebGL mochitest on Android slaves by avoiding loading the js-test-post.js script - r=jgilbert
Indeed, we have data here showing that the timeouts are caused by failure to load this file. Reason not yet understood.
2012-08-14 12:59:14 -04:00

108 lines
3.6 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>finishTest();</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>finishTest();</script>
</body>
</html>