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 cursors weakly hold request, and work if request i
s GC'd"); | 6 description("Verify that that cursors weakly hold request, and work if request i
s GC'd"); |
7 | 7 |
8 indexedDBTest(prepareDatabase, onOpen); | 8 indexedDBTest(prepareDatabase, onOpen); |
9 | 9 |
10 function prepareDatabase(evt) | 10 function prepareDatabase(evt) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 evalAndLog("cursor = null"); | 66 evalAndLog("cursor = null"); |
67 evalAndLog("gc()"); | 67 evalAndLog("gc()"); |
68 shouldBeFalse("cursorObservation.wasCollected"); | 68 shouldBeFalse("cursorObservation.wasCollected"); |
69 | 69 |
70 evalAndLog("finalRequest = store.get(0)"); | 70 evalAndLog("finalRequest = store.get(0)"); |
71 finalRequest.onsuccess = function finalRequestSuccess(evt) { | 71 finalRequest.onsuccess = function finalRequestSuccess(evt) { |
72 preamble(evt); | 72 preamble(evt); |
73 shouldBeEqualToString("cursor.key", "key2"); | 73 shouldBeEqualToString("cursor.key", "key2"); |
74 shouldBeEqualToString("cursor.value", "value2"); | 74 shouldBeEqualToString("cursor.value", "value2"); |
75 | 75 |
76 cursorObservation = internals.observeGC(cursor); | 76 // Access objects in an inner function to avoid references to |
| 77 // objects remaining live on this function's stack frame |
| 78 // (http://crbug.com/595672/). |
| 79 (() => { cursorObservation = internals.observeGC(cursor); })(); |
77 evalAndLog("cursor = null"); | 80 evalAndLog("cursor = null"); |
78 evalAndLog("gc()"); | 81 evalAndLog("gc()"); |
79 shouldBeTrue("cursorRequestObservation.wasCollected"); | 82 shouldBeTrue("cursorRequestObservation.wasCollected"); |
80 shouldBeTrue("cursorObservation.wasCollected"); | 83 shouldBeTrue("cursorObservation.wasCollected"); |
81 }; | 84 }; |
82 }; | 85 }; |
83 | 86 |
84 tx.oncomplete = finishJSTest; | 87 tx.oncomplete = finishJSTest; |
85 } | 88 } |
86 | 89 |
87 | 90 |
88 </script> | 91 </script> |
OLD | NEW |