Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <body> | 2 <body> |
| 3 <input id='text' type='text'></input> | 3 <input id='text' type='text'></input> |
| 4 | 4 |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/js-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 var input = document.getElementById('text'); | 7 var input = document.getElementById('text'); |
| 8 input.focus(); | 8 input.focus(); |
| 9 textInputController.setMarkedText("hello", 0, 5); | 9 textInputController.setMarkedText("hello", 0, 5); |
|
rmcilroy
2016/05/23 10:51:38
nit - move this initialization into the initializa
mythria
2016/05/23 12:27:03
Done.
| |
| 10 // Do not pass the object directly to observeGC function. This may | 10 // Do initialization work in an inner function to avoid references to |
| 11 // remain live on this function's stack preventing GC from collecting | 11 // objects remaining live on this function's stack frame. |
| 12 // it. Accessing the object inside an inner function will prevent any | 12 // (http://crbug.com/595672/). |
| 13 // unneeded references on this function's stack. | 13 var markedRangeResultGC, selectedRangeResultGC; |
| 14 var markedRangeResultGC = internals.observeGC((() => { | 14 var firstRectForCharacterRangeGC; |
| 15 return textInputController.markedRange(); | 15 function initialize() { |
|
rmcilroy
2016/05/23 10:51:38
nit - you could just make these immediately exectu
mythria
2016/05/23 12:27:03
I fixed it in all the tests. Done.
| |
| 16 })()); | 16 markedRangeResultGC = internals.observeGC( |
| 17 var selectedRangeResultGC = internals.observeGC((() => { | 17 textInputController.markedRange()); |
| 18 return textInputController.selectedRange(); | 18 selectedRangeResultGC = internals.observeGC( |
| 19 })()); | 19 textInputController.selectedRange()); |
| 20 var firstRectForCharacterRangeGC = internals.observeGC((() => { | 20 firstRectForCharacterRangeGC = internals.observeGC( |
| 21 return textInputController.firstRectForCharacterRange(0, 0); | 21 textInputController.firstRectForCharacterRange(0, 0)); |
| 22 })()); | 22 } |
| 23 | |
| 24 initialize(); | |
| 23 gc(); | 25 gc(); |
| 24 shouldBeTrue('markedRangeResultGC.wasCollected'); | 26 shouldBeTrue('markedRangeResultGC.wasCollected'); |
| 25 shouldBeTrue('selectedRangeResultGC.wasCollected'); | 27 shouldBeTrue('selectedRangeResultGC.wasCollected'); |
| 26 shouldBeTrue('firstRectForCharacterRangeGC.wasCollected'); | 28 shouldBeTrue('firstRectForCharacterRangeGC.wasCollected'); |
| 27 </script> | 29 </script> |
| 28 </body> | 30 </body> |
| 29 </html> | 31 </html> |
| OLD | NEW |