| Index: third_party/WebKit/LayoutTests/editing/input/text-input-controller-leak-document.html
|
| diff --git a/third_party/WebKit/LayoutTests/editing/input/text-input-controller-leak-document.html b/third_party/WebKit/LayoutTests/editing/input/text-input-controller-leak-document.html
|
| index 06e65c066f443b795aa844588804f375c755b69a..cc74c3d30184c09eba48f2dfcb50b61a9ce1ce82 100644
|
| --- a/third_party/WebKit/LayoutTests/editing/input/text-input-controller-leak-document.html
|
| +++ b/third_party/WebKit/LayoutTests/editing/input/text-input-controller-leak-document.html
|
| @@ -7,9 +7,19 @@
|
| var input = document.getElementById('text');
|
| input.focus();
|
| textInputController.setMarkedText("hello", 0, 5);
|
| - var markedRangeResultGC = internals.observeGC(textInputController.markedRange());
|
| - var selectedRangeResultGC = internals.observeGC(textInputController.selectedRange());
|
| - var firstRectForCharacterRangeGC = internals.observeGC(textInputController.firstRectForCharacterRange(0, 0));
|
| + // Do not pass the object directly to observeGC function. This may
|
| + // remain live on this function's stack preventing GC from collecting
|
| + // it. Accessing the object inside an inner function will prevent any
|
| + // unneeded references on this function's stack.
|
| + var markedRangeResultGC = internals.observeGC((() => {
|
| + return textInputController.markedRange();
|
| + })());
|
| + var selectedRangeResultGC = internals.observeGC((() => {
|
| + return textInputController.selectedRange();
|
| + })());
|
| + var firstRectForCharacterRangeGC = internals.observeGC((() => {
|
| + return textInputController.firstRectForCharacterRange(0, 0);
|
| + })());
|
| gc();
|
| shouldBeTrue('markedRangeResultGC.wasCollected');
|
| shouldBeTrue('selectedRangeResultGC.wasCollected');
|
|
|