4 Copyright (c) 2013 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
9 <title>IDB test that origins over quota aren't trapped
</title>
10 <script type=
"text/javascript" src=
"common.js"></script>
14 // This file runs after fill_up_5k puts this origin over quota.
15 request
= indexedDB
.open("fill_up_5k.html");
16 request
.onblocked
= unexpectedBlockedCallback
;
17 request
.onupgradeneeded
= unexpectedUpgradeNeededCallback
;
18 request
.onsuccess
= onOpen
;
19 request
.onerror
= unexpectedErrorCallback
;
23 db
= event
.target
.result
;
24 shouldBe("db.objectStoreNames.length", "1");
25 trans
= db
.transaction(db
.objectStoreNames
, "readwrite");
26 trans
.objectStore(db
.objectStoreNames
[0]).put("dogs", "cats");
27 trans
.oncomplete
= unexpectedCompleteCallback
;
28 trans
.onabort = function() {
29 shouldBeEqualToString("trans.error.name", "QuotaExceededError");
30 testOnlyDeleteTransaction();
34 function testOnlyDeleteTransaction() {
35 trans
= db
.transaction(db
.objectStoreNames
, "readwrite");
36 request
= trans
.objectStore(db
.objectStoreNames
[0]).openCursor();
37 request
.onerror
= unexpectedErrorCallback
;
38 request
.onsuccess = function() {
39 cursor
= request
.result
;
40 shouldBeTrue("cursor != null");
43 trans
.onabort
= unexpectedAbortCallback
;
44 trans
.oncomplete
= testReadOnlyTransaction
;
47 function testReadOnlyTransaction() {
48 trans
= db
.transaction(db
.objectStoreNames
, "readonly");
49 trans
.objectStore(db
.objectStoreNames
[0]).get("cats").onerror
=
50 unexpectedErrorCallback
;
51 trans
.onabort
= unexpectedAbortCallback
;
52 trans
.oncomplete
= done
;
56 <body onLoad=
"test()">
57 <div id=
"status">Starting...
</div>