Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test that the callback is not garbage collected if registered.</t itle> | 4 <title>Test that the callback is not garbage collected if registered.</t itle> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../media-file.js"></script> | 7 <script src="../media-file.js"></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <script> | 10 <script> |
| 11 // WPT: thistest can't be moved to WPT because of its usage of: | |
|
foolip
2017/02/05 16:01:18
typo
mlamouri (slow - plz ping)
2017/02/07 21:23:33
Done.
| |
| 12 // - GCController.collect() | |
| 13 | |
| 11 function gc() { | 14 function gc() { |
| 12 if (window.GCController) | 15 if (window.GCController) |
| 13 GCController.collect(); | 16 GCController.collect(); |
| 14 else { | 17 else { |
| 15 for (var i = 0; i < 10000; ++i) { | 18 for (var i = 0; i < 10000; ++i) { |
| 16 ({ }); | 19 ({ }); |
| 17 } | 20 } |
| 18 } | 21 } |
| 19 } | 22 } |
| 20 | 23 |
| 21 async_test(function(t) | 24 async_test(function(t) |
| 22 { | 25 { |
| 23 var v = document.createElement('video'); | 26 var v = document.createElement('video'); |
| 24 v.src = findMediaFile('video', 'content/test'); | 27 v.src = findMediaFile('video', 'content/test'); |
| 25 document.body.appendChild(v); | 28 document.body.appendChild(v); |
| 26 | 29 |
| 27 function callback(available) {} | 30 function callback(available) {} |
| 28 var callbackRef = t.step_func_done(callback); | 31 var callbackRef = t.step_func_done(callback); |
| 29 | 32 |
| 30 v.remote.watchAvailability(callbackRef).then( | 33 v.remote.watchAvailability(callbackRef).then( |
| 31 function() { callbackRef = null; gc(); }, | 34 function() { callbackRef = null; gc(); }, |
| 32 t.unreached_func()); | 35 t.unreached_func()); |
| 33 }, 'Test that the callback is not garbage collected if registered.') ; | 36 }, 'Test that the callback is not garbage collected if registered.') ; |
| 34 </script> | 37 </script> |
| 35 </body> | 38 </body> |
| 36 </html> | 39 </html> |
| OLD | NEW |