| 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/observeGC.js"></script> |
| 3 <script src="resources/shared.js"></script> | 4 <script src="resources/shared.js"></script> |
| 4 <script> | 5 <script> |
| 5 | 6 |
| 6 description("Verify that that cursors weakly hold script value properties"); | 7 description("Verify that that cursors weakly hold script value properties"); |
| 7 | 8 |
| 8 if (window.internals) { | 9 if (window.internals) { |
| 9 indexedDBTest(prepareDatabase, onOpen); | 10 indexedDBTest(prepareDatabase, onOpen); |
| 10 } else { | 11 } else { |
| 11 testFailed('This test requires access to the Internals object'); | 12 testFailed('This test requires access to the Internals object'); |
| 12 finishJSTest(); | 13 finishJSTest(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 33 tx.oncomplete = function() { | 34 tx.oncomplete = function() { |
| 34 db.close(); | 35 db.close(); |
| 35 | 36 |
| 36 // Try and induce a leak by a reference cycle from DOM to V8 and back. | 37 // Try and induce a leak by a reference cycle from DOM to V8 and back. |
| 37 // If the v8 value of cursor.key (etc) is only held by the cursor's | 38 // If the v8 value of cursor.key (etc) is only held by the cursor's |
| 38 // V8 wrapper then there will be no leak. | 39 // V8 wrapper then there will be no leak. |
| 39 cursor.key.cursor = cursor; | 40 cursor.key.cursor = cursor; |
| 40 cursor.primaryKey.cursor = cursor; | 41 cursor.primaryKey.cursor = cursor; |
| 41 cursor.value.cursor = cursor; | 42 cursor.value.cursor = cursor; |
| 42 | 43 |
| 43 cursorObserver = internals.observeGC(cursor); | 44 cursorObserver = observeGC(() => {return cursor;}); |
| 44 | 45 |
| 45 cursorRequest = null; | 46 cursorRequest = null; |
| 46 cursor = null; | 47 cursor = null; |
| 47 | 48 |
| 48 gc(); | 49 gc(); |
| 49 | 50 |
| 50 shouldBeTrue("cursorObserver.wasCollected"); | 51 shouldBeTrue("cursorObserver.wasCollected"); |
| 51 finishJSTest(); | 52 finishJSTest(); |
| 52 }; | 53 }; |
| 53 } | 54 } |
| 54 | 55 |
| 55 | 56 |
| 56 </script> | 57 </script> |
| OLD | NEW |