| OLD | NEW |
| 1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
| 2 <script src="../../resources/testharnessreport.js"></script> | 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <script src="../../resources/gc.js"></script> |
| 3 <script> | 4 <script> |
| 4 function gc() { | |
| 5 if (typeof GCController !== "undefined") | |
| 6 GCController.collectAll(); | |
| 7 else { | |
| 8 var gcRec = function (n) { | |
| 9 if (n < 1) | |
| 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 } | |
| 18 } | |
| 19 | 5 |
| 20 function runTest() { | 6 function runTest() { |
| 21 canvas = document.createElement("canvas"); | 7 canvas = document.createElement("canvas"); |
| 22 context = canvas.getContext("2d"); | 8 context = canvas.getContext("2d"); |
| 23 context.customProperty = "value"; | 9 context.customProperty = "value"; |
| 24 assert_equals(context.customProperty, "value"); | 10 assert_equals(context.customProperty, "value"); |
| 25 context = null; | 11 context = null; |
| 26 gc(); | 12 gc(); |
| 27 context = canvas.getContext("2d"); | 13 context = canvas.getContext("2d"); |
| 28 assert_equals(context.customProperty, "value"); | 14 assert_equals(context.customProperty, "value"); |
| 29 } | 15 } |
| 30 | 16 |
| 31 async_test(t => { | 17 async_test(t => { |
| 32 window.onload = function() { | 18 window.onload = function() { |
| 33 t.step(runTest); | 19 t.step(runTest); |
| 34 t.done(); | 20 t.done(); |
| 35 } | 21 } |
| 36 }, 'Verify that the custom properties on a Canvas 2D rendering context object ar
e retained across GCs.'); | 22 }, 'Verify that the custom properties on a Canvas 2D rendering context object ar
e retained across GCs.'); |
| 37 | 23 |
| 38 </script> | 24 </script> |
| OLD | NEW |