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

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

Issue 1295773004: update-w3c-deps import using blink c936ac9d274f959a4b5908db6835bcd612fb1a9e: (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title>IDBObjectStore.createIndex() - event order when unique constraint is trig gered</title> 3 <title>IDBObjectStore.createIndex() - event order when unique constraint is trig gered</title>
4 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> 4 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
5 <meta rel=help href=http://odinho.html5.org/IndexedDB/spec/Overview.html#widl-ID BObjectStore-createIndex-IDBIndex-DOMString-name-any-keyPath-IDBIndexParameters- optionalParameters> 5 <meta rel=help href=http://odinho.html5.org/IndexedDB/spec/Overview.html#widl-ID BObjectStore-createIndex-IDBIndex-DOMString-name-any-keyPath-IDBIndexParameters- optionalParameters>
6 <meta rel=assert title="The index that is requested to be created can contain co nstraints on the data allowed in the index's referenced object store, such as re quiring uniqueness of the values referenced by the index's keyPath. If the refer enced object store already contains data which violates these constraints, this must not cause the implementation of createIndex to throw an exception or affect what it returns. The implementation must still create and return an IDBIndex ob ject. Instead the implementation must queue up an operation to abort the 'versio nchange' transaction which was used for the createIndex call."> 6 <meta rel=assert title="The index that is requested to be created can contain co nstraints on the data allowed in the index's referenced object store, such as re quiring uniqueness of the values referenced by the index's keyPath. If the refer enced object store already contains data which violates these constraints, this must not cause the implementation of createIndex to throw an exception or affect what it returns. The implementation must still create and return an IDBIndex ob ject. Instead the implementation must queue up an operation to abort the 'versio nchange' transaction which was used for the createIndex call.">
7 <meta rel=assert title="In some implementations it's possible for the implementa tion to asynchronously run into problems creating the index after the createInde x function has returned. For example in implementations where metadata about the newly created index is queued up to be inserted into the database asynchronousl y, or where the implementation might need to ask the user for permission for quo ta reasons. Such implementations must still create and return an IDBIndex object . Instead, once the implementation realizes that creating the index has failed, it must abort the transaction using the steps for aborting a transaction using t he appropriate error as error parameter."> 7 <meta rel=assert title="In some implementations it's possible for the implementa tion to asynchronously run into problems creating the index after the createInde x function has returned. For example in implementations where metadata about the newly created index is queued up to be inserted into the database asynchronousl y, or where the implementation might need to ask the user for permission for quo ta reasons. Such implementations must still create and return an IDBIndex object . Instead, once the implementation realizes that creating the index has failed, it must abort the transaction using the steps for aborting a transaction using t he appropriate error as error parameter.">
8 <meta rel=assert title="if the index can't be created due to unique constraints, ConstraintError must be used as error"> 8 <meta rel=assert title="if the index can't be created due to unique constraints, ConstraintError must be used as error">
9 <script src=../../../resources/testharness.js></script> 9 <script src=../../../resources/testharness.js></script>
10 <script src=../../../resources/testharnessreport.js></script> 10 <script src=../../../resources/testharnessreport.js></script>
(...skipping 29 matching lines...) Expand all
40 40
41 objStore.createIndex("index", "animal", { unique: true }) 41 objStore.createIndex("index", "animal", { unique: true })
42 42
43 var rq_add3 = objStore.add({ animal: "Unicorn" }, 3); 43 var rq_add3 = objStore.add({ animal: "Unicorn" }, 3);
44 rq_add3.onsuccess = log("rq_add3.success"); 44 rq_add3.onsuccess = log("rq_add3.success");
45 rq_add3.onerror = log("rq_add3.error"); 45 rq_add3.onerror = log("rq_add3.error");
46 } 46 }
47 47
48 open_rq.onerror = function(e) { 48 open_rq.onerror = function(e) {
49 log("open_rq.error")(e); 49 log("open_rq.error")(e);
50 assert_object_equals(events, [ "rq_add1.success", 50 assert_array_equals(events, [ "rq_add1.success",
51 "rq_add2.success", 51 "rq_add2.success",
52 52
53 "rq_add3.error: AbortError", 53 "rq_add3.error: AbortError",
54 "transaction.error: AbortError", 54 "transaction.error: AbortError",
55 "db.error: AbortError", 55 "db.error: AbortError",
56 56
57 "transaction.abort: ConstraintError", 57 "transaction.abort: ConstraintError",
58 "db.abort: ConstraintError", 58 "db.abort: ConstraintError",
59 59
60 "open_rq.error: AbortError" ], 60 "open_rq.error: AbortError" ],
61 "events"); 61 "events");
62 t.done(); 62 t.done();
63 } 63 }
64 64
65 function log(msg) { 65 function log(msg) {
66 return function(e) { 66 return function(e) {
67 if(e && e.target && e.target.error) 67 if(e && e.target && e.target.error)
68 events.push(msg + ": " + e.target.error.name); 68 events.push(msg + ": " + e.target.error.name);
69 else 69 else
70 events.push(msg); 70 events.push(msg);
71 }; 71 };
72 } 72 }
73 </script> 73 </script>
74 74
75 <div id=log></div> 75 <div id=log></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698