| OLD | NEW |
| 1 <html> | 1 <script src="../../resources/testharness.js"></script> |
| 2 <head> | 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <script src="../../resources/js-test.js"></script> | |
| 4 </head> | |
| 5 <body> | |
| 6 <script> | 3 <script> |
| 7 description("Verify that the custom properties on a Canvas 2D rendering context
object are retained across GCs."); | 4 function gc() { |
| 8 | 5 if (typeof GCController !== "undefined") |
| 9 window.jsTestIsAsync = true; | 6 GCController.collectAll(); |
| 10 | 7 else { |
| 11 if (window.testRunner) { | 8 var gcRec = function (n) { |
| 12 testRunner.dumpAsText(); | 9 if (n < 1) |
| 13 testRunner.waitUntilDone(); | 10 return {}; |
| 11 var temp = {i: "ab" + i + (i / 100000)}; |
| 12 temp += "foo"; |
| 13 gcRec(n-1); |
| 14 }; |
| 15 for (var i = 0; i < 1000; i++) |
| 16 gcRec(10); |
| 17 } |
| 14 } | 18 } |
| 15 | 19 |
| 16 function runTest() { | 20 function runTest() { |
| 17 canvas = document.createElement("canvas"); | 21 canvas = document.createElement("canvas"); |
| 18 context = canvas.getContext("2d"); | 22 context = canvas.getContext("2d"); |
| 19 context.customProperty = "value"; | 23 context.customProperty = "value"; |
| 20 shouldBeEqualToString("context.customProperty", "value"); | 24 assert_equals(context.customProperty, "value"); |
| 21 context = null; | 25 context = null; |
| 22 gc(); | 26 gc(); |
| 23 context = canvas.getContext("2d"); | 27 context = canvas.getContext("2d"); |
| 24 shouldBeEqualToString("context.customProperty", "value"); | 28 assert_equals(context.customProperty, "value"); |
| 25 finishJSTest(); | |
| 26 } | 29 } |
| 27 | 30 |
| 28 window.onload = runTest; | 31 async_test(t => { |
| 32 window.onload = function() { |
| 33 t.step(runTest); |
| 34 t.done(); |
| 35 } |
| 36 }, 'Verify that the custom properties on a Canvas 2D rendering context object ar
e retained across GCs.'); |
| 37 |
| 29 </script> | 38 </script> |
| 30 </body> | |
| 31 </html> | |
| OLD | NEW |