| <!DOCTYPE html> |
| <html> |
| <body> |
| <p>This tests that ValidityState survives garbage collection.</p> |
| <div id="test-cases"> |
| <button></button> |
| <fieldset></fieldset> |
| <input type="text"> |
| <input type="radio"> |
| <input type="checkbox"> |
| <object></object> |
| <output></output> |
| <select></select> |
| <textarea></textarea> |
| </div> |
| <pre id="result"></pre> |
| <script> |
| function gc() |
| { |
| if (window.GCController) |
| return GCController.collect(); |
| |
| for (var i = 0; i < 1000000; i++) // > force garbage collection (FF requires about 9K allocations before a collect) |
| var s = new String(''); |
| } |
| |
| const testCases = Array.from(document.getElementById('test-cases').children); |
| for (const child of testCases) |
| child.validity.foo = 'PASS'; |
| |
| gc(); |
| |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| } |
| |
| setTimeout(function () { |
| gc(); |
| setTimeout(function () { |
| gc(); |
| for (const child of testCases) |
| result.textContent += `${child.outerHTML}: ${child.validity.foo || 'FAIL'}\n`; |
| document.getElementById('test-cases').style.display = 'none'; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }, 0); |
| }, 0); |
| |
| </script> |
| </body> |
| </html> |