Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: LayoutTests/storage/indexeddb/cursor-request-cycle.html

Issue 23653024: IndexedDB: Have IDBCursor and IDBRequest explicitly break ref cycles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../fast/js/resources/js-test-pre.js"></script>
3 <script src="resources/shared.js"></script>
4 <script>
5
6 description("Verify that that cursors weakly hold request, and work if request i s GC'd");
7
8 indexedDBTest(prepareDatabase, onOpen);
9
10 function prepareDatabase(evt)
11 {
12 preamble(evt);
13 evalAndLog("db = event.target.result");
14 evalAndLog("store = db.createObjectStore('store')");
15 store.put("value1", "key1");
16 store.put("value2", "key2");
17 }
18
19 function onOpen(evt)
20 {
21 preamble(evt);
22 evalAndLog("db = event.target.result");
23 evalAndLog("tx = db.transaction('store')");
24 evalAndLog("store = tx.objectStore('store')");
25
26 evalAndLog("cursorRequest = store.openCursor()");
27 cursorRequest.onsuccess = function openCursorRequest(evt) {
28 preamble(evt);
29 evalAndLog("cursor = cursorRequest.result");
30 shouldBeNonNull("cursor");
31 shouldBeEqualToString("cursor.key", "key1");
32 shouldBeEqualToString("cursor.value", "value1");
33 };
34
35 evalAndLog("otherRequest = store.get(0)");
36
37 otherRequest.onsuccess = function otherRequestSuccess(evt) {
38 preamble(evt);
39
40 gc();
41 gc(); // FIXME: Why is this second call necessary?
42 beforeCount = window.internals.numberOfLiveNodes();
43
44 cursorRequest.canary = document.createElement('canary');
45 cursorRequest = null;
46
47 gc();
48 gc(); // FIXME: Why is this second call necessary?
alecflett 2013/09/06 17:56:35 I wonder if there's any way to make this test fail
jsbell 2013/09/06 18:07:43 This is only needed on the bots and it's flaky, un
49 afterCount = window.internals.numberOfLiveNodes();
50 shouldBe("afterCount", "beforeCount");
51
52 // The following call should generate a scratch request, invisible to sc ript:
53 evalAndLog("cursor.continue()");
54
55 evalAndLog("finalRequest = store.get(0)");
56 finalRequest.onsuccess = function finalRequestSuccess(evt) {
57 preamble(evt);
58 shouldBeEqualToString("cursor.key", "key2");
59 shouldBeEqualToString("cursor.value", "value2");
60 };
61 };
62
63 tx.oncomplete = finishJSTest;
64 }
65
66
67 </script>
68 <script src="../../fast/js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698