| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/dataset-gc.js"></script> | 7 <script> |
| 8 description("This tests that custom properties on element.dataset persist GC."); |
| 9 |
| 10 function gc() |
| 11 { |
| 12 if (window.GCController) |
| 13 return GCController.collect(); |
| 14 |
| 15 for (var i = 0; i < 10000; i++) { |
| 16 var s = new String(""); |
| 17 } |
| 18 } |
| 19 |
| 20 |
| 21 var d = document.createElement("div"); |
| 22 |
| 23 var dataset = d.dataset; |
| 24 // Add a property to our prototype. It will be hidden by the corresponding data-
attribute. |
| 25 dataset.__proto__.customProperty = 1; |
| 26 dataset.customProperty = 1; // Now set a property on ourselves. |
| 27 shouldBe("d.getAttribute('data-custom-property')", "'1'"); |
| 28 shouldBe("d.dataset.customProperty", "'1'"); |
| 29 |
| 30 dataset = null; |
| 31 |
| 32 gc(); |
| 33 |
| 34 // Test that the custom property persisted the GC. |
| 35 shouldBe("d.dataset.customProperty", "'1'"); |
| 36 </script> |
| 8 </body> | 37 </body> |
| 9 </html> | 38 </html> |
| OLD | NEW |