Sync web-platform-tests up to revision a5b95cb31914507088a4eda16f7674bbc6f3313f
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / IndexedDB / abort-in-initial-upgradeneeded.html
1 <!doctype html>
2 <!--  Submitted from TestTWF Paris  -->
3 <title>Test that an abort in the initial upgradeneeded sets version back to 0</title>
4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script>
6 <script src=support.js></script>
7
8 <script>
9
10 var db, open_rq = createdb(async_test(), undefined, 2);
11
12 open_rq.onupgradeneeded = function(e) {
13     db = e.target.result;
14     assert_equals(db.version, 2);
15     var transaction = e.target.transaction;
16     transaction.oncomplete = fail(this, "unexpected transaction.complete");
17     transaction.onabort = function(e) {
18         assert_equals(e.target.db.version, 0);
19     }
20     db.onabort = function() {}
21
22     transaction.abort();
23 }
24
25 open_rq.onerror = function(e) {
26     assert_equals(open_rq, e.target);
27     assert_equals(e.target.result, undefined);
28     assert_equals(e.target.error.name, "AbortError");
29     assert_equals(db.version, 0);
30     assert_equals(open_rq.transaction, null);
31     this.done();
32 }
33 </script>
34
35 <div id=log></div>