Chromium Code Reviews| 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 test(function(t) { |
|
Justin Novosad
2017/02/08 18:23:33
Are you sure this works as expected? I am concerne
zakerinasab
2017/02/08 19:57:49
Done.
| |
| 18 context = canvas.getContext("2d"); | 22 canvas = document.createElement("canvas"); |
| 19 context.customProperty = "value"; | 23 context = canvas.getContext("2d"); |
| 20 shouldBeEqualToString("context.customProperty", "value"); | 24 context.customProperty = "value"; |
| 21 context = null; | 25 assert_equals(context.customProperty, "value"); |
| 22 gc(); | 26 context = null; |
| 23 context = canvas.getContext("2d"); | 27 gc(); |
| 24 shouldBeEqualToString("context.customProperty", "value"); | 28 context = canvas.getContext("2d"); |
| 25 finishJSTest(); | 29 assert_equals(context.customProperty, "value"); |
| 30 }, 'Verify that the custom properties on a Canvas 2D rendering context objec t are retained across GCs.'); | |
| 26 } | 31 } |
| 27 | 32 |
| 28 window.onload = runTest; | 33 window.onload = runTest; |
| 29 </script> | 34 </script> |
| 30 </body> | |
| 31 </html> | |
| OLD | NEW |