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

Side by Side Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_objectstore5.htm

Issue 727883002: update-w3c-deps import using blink 7f8c8ee3e30dc15b7b821c627fc7ac32331d2253: (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 1 month 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <title>IDBCursor.advance() - object store - throw InvalidStateError</title> 3 <title>IDBCursor.advance() - object store - throw InvalidStateError caused by ob ject store been deleted</title>
4 <link rel="author" title="Intel" href="http://www.intel.com"> 4 <link rel="author" title="Intel" href="http://www.intel.com">
5 <link rel="help" href="https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.ht ml#widl-IDBCursor-advance-void-unsigned-long-count">
6 <script src="../../../resources/testharness.js"></script> 5 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script> 6 <script src="../../../resources/testharnessreport.js"></script>
8 <script src="support.js"></script> 7 <script src="support.js"></script>
9 <div id="log"></div> 8 <div id="log"></div>
10 <script> 9 <script>
11 var db, 10 var db,
12 t = async_test(), 11 t = async_test(),
13 records = [{ pKey: "primaryKey_0"}, 12 records = [{ pKey: "primaryKey_0"},
14 { pKey: "primaryKey_1"}]; 13 { pKey: "primaryKey_1"}];
15 14
16 var open_rq = createdb(t); 15 var open_rq = createdb(t);
17 open_rq.onupgradeneeded = function (event) { 16 open_rq.onupgradeneeded = function (event) {
18 db = event.target.result; 17 db = event.target.result;
19 var objStore = db.createObjectStore("store", {keyPath:"pKey"}); 18 var objStore = db.createObjectStore("store", {keyPath:"pKey"});
20 for (var i = 0; i < records.length; i++) { 19 for (var i = 0; i < records.length; i++) {
21 objStore.add(records[i]); 20 objStore.add(records[i]);
22 } 21 }
23 } 22 var rq = objStore.openCursor();
24
25 open_rq.onsuccess = function (event) {
26 var txn = db.transaction("store", "readwrite");
27 var rq = txn.objectStore("store").openCursor();
28 rq.onsuccess = t.step_func(function(event) { 23 rq.onsuccess = t.step_func(function(event) {
29 var cursor = event.target.result; 24 var cursor = event.target.result;
30 assert_true(cursor instanceof IDBCursor); 25 assert_true(cursor instanceof IDBCursor, "cursor exist");
31 26
32 cursor.advance(1); 27 db.deleteObjectStore("store");
33 assert_throws("InvalidStateError", function() { 28 assert_throws("InvalidStateError", function() {
34 cursor.advance(1); 29 cursor.advance(1);
35 }, "Calling advance() should throw DOMException when the cursor is c urrently being iterated."); 30 }, "If the cursor's source or effective object store has been delete d, the implementation MUST throw a DOMException of type InvalidStateError");
36 31
37 t.done(); 32 t.done();
38 }); 33 });
39 } 34 }
40 </script> 35 </script>
41 36
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698