OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <script src="resources/shared.js"></script> | 3 <script src="resources/shared.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 description("Verify that that key cursors weakly hold request, and work if reque
st is GC'd"); | 6 description("Verify that that key cursors weakly hold request, and work if reque
st is GC'd"); |
7 | 7 |
8 indexedDBTest(prepareDatabase, onOpen); | 8 indexedDBTest(prepareDatabase, onOpen); |
9 | 9 |
10 function prepareDatabase(evt) | 10 function prepareDatabase(evt) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 cursorObservation = internals.observeGC(cursor); | 63 cursorObservation = internals.observeGC(cursor); |
64 evalAndLog("cursor = null"); | 64 evalAndLog("cursor = null"); |
65 evalAndLog("gc()"); | 65 evalAndLog("gc()"); |
66 shouldBeFalse("cursorObservation.wasCollected"); | 66 shouldBeFalse("cursorObservation.wasCollected"); |
67 | 67 |
68 evalAndLog("finalRequest = store.get(0)"); | 68 evalAndLog("finalRequest = store.get(0)"); |
69 finalRequest.onsuccess = function finalRequestSuccess(evt) { | 69 finalRequest.onsuccess = function finalRequestSuccess(evt) { |
70 preamble(evt); | 70 preamble(evt); |
71 shouldBeEqualToString("cursor.key", "key2"); | 71 shouldBeEqualToString("cursor.key", "key2"); |
72 | 72 |
73 cursorObservation = internals.observeGC(cursor); | 73 // Access objects in an inner function to avoid references to |
| 74 // objects remaining live on this function's stack frame |
| 75 // (http://crbug.com/595672/). |
| 76 (() => { cursorObservation = internals.observeGC(cursor); })(); |
74 evalAndLog("cursor = null"); | 77 evalAndLog("cursor = null"); |
75 evalAndLog("gc()"); | 78 evalAndLog("gc()"); |
76 shouldBeTrue("cursorRequestObservation.wasCollected"); | 79 shouldBeTrue("cursorRequestObservation.wasCollected"); |
77 shouldBeTrue("cursorObservation.wasCollected"); | 80 shouldBeTrue("cursorObservation.wasCollected"); |
78 }; | 81 }; |
79 }; | 82 }; |
80 | 83 |
81 tx.oncomplete = finishJSTest; | 84 tx.oncomplete = finishJSTest; |
82 } | 85 } |
83 | 86 |
84 | 87 |
85 </script> | 88 </script> |
OLD | NEW |