1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
content / test / data / indexeddb / bucket_durability_relaxed.html [blame]
<!DOCTYPE html>
<html>
<!--
Copyright 2022 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>Tests that bucket durability is respected. The C++ side of the test sets
the mock backend to fail on strict transactions. Thus the inboxBucket IDB
transaction should succeed and the outbox one should fail.</title>
<script type="text/javascript" src="common.js"></script>
<script>
async function test() {
const inboxBucket = await navigator.storageBuckets.open('inbox_bucket', {durability: "relaxed"});
indexedDBTestWithIdb(inboxBucket.indexedDB, prepareDatabase, startNewTransaction);
}
function prepareDatabase() {
db = event.target.result;
objectStore = db.createObjectStore('store');
}
function startNewTransaction() {
tx = db.transaction('store', 'readwrite');
tx.objectStore('store').put('value', 'key');
tx.oncomplete = function() {
done();
}
tx.onabort = unexpectedAbortCallback;
}
</script>
</head>
<body onLoad="test()">
<div id="status">Starting...</div>
</body>
</html>