Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/storage/indexeddb/cursor-leak.html |
| diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/cursor-leak.html b/third_party/WebKit/LayoutTests/storage/indexeddb/cursor-leak.html |
| index 6fbda670510d9e452212b566256119c293bd8e87..a055dfc2356ae1264c4a8dcd3efde5a5403d718e 100644 |
| --- a/third_party/WebKit/LayoutTests/storage/indexeddb/cursor-leak.html |
| +++ b/third_party/WebKit/LayoutTests/storage/indexeddb/cursor-leak.html |
| @@ -32,19 +32,21 @@ function onOpen(evt) |
| }; |
| tx.oncomplete = function() { |
| db.close(); |
| - |
| - // Try and induce a leak by a reference cycle from DOM to V8 and back. |
| - // If the v8 value of cursor.key (etc) is only held by the cursor's |
| - // V8 wrapper then there will be no leak. |
| - cursor.key.cursor = cursor; |
| - cursor.primaryKey.cursor = cursor; |
| - cursor.value.cursor = cursor; |
| - |
| - // 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. |
| - cursorObserver = internals.observeGC((() => {return cursor;})()); |
| + |
| + // Do initialization work in an inner function to avoid references to |
| + // objects remaining live on this function's stack frame |
| + // (http://crbug.com/595672/). |
| + function initialize() { |
| + // Try and induce a leak by a reference cycle from DOM to V8 and |
| + // back. If the v8 value of cursor.key (etc) is only held by the |
| + // cursor's V8 wrapper then there will be no leak. |
| + cursor.key.cursor = cursor; |
| + cursor.primaryKey.cursor = cursor; |
| + cursor.value.cursor = cursor; |
| + cursorObserver = internals.observeGC(cursor); |
| + } |
| + |
| + initialize(); |
| cursorRequest = null; |
| cursor = null; |
|
rmcilroy
2016/05/20 14:53:39
Ditto with cursorRequest and cursor
mythria
2016/05/23 10:35:45
We can't do this with cursorRequest or cursor. The
|