Sync web-platform-tests up to revision a5b95cb31914507088a4eda16f7674bbc6f3313f
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / IndexedDB / idbobjectstore_createIndex13.htm
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>IDBDatabase.createIndex() - Operate out versionchange throw InvalidStateError </title>
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.html#widl-IDBObjectStore-createIndex-IDBIndex-DOMString-name-DOMString-sequence-DOMString--keyPath-IDBIndexParameters-optionalParameters">
6 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8 <script src="support.js"></script>
9 <div id="log"></div>
10 <script>
11     var db,
12         t = async_test();
13
14     var open_rq = createdb(t);
15     open_rq.onupgradeneeded = function (event) {
16         db = event.target.result;
17         db.createObjectStore("store");
18     }
19
20     open_rq.onsuccess = function (event) {
21         var txn = db.transaction("store", "readwrite");
22         var ostore = txn.objectStore("store");
23         t.step(function(){
24             assert_throws("InvalidStateError", function(){
25                 ostore.createIndex("index", "indexedProperty");
26             });
27         });
28         t.done();
29     }
30 </script>
31