Skip to content

Commit

Permalink
Update IndexedDB web tests to durability relaxed
Browse files Browse the repository at this point in the history
Updates IndexedDB web tests to use the durability relaxed option
for transactions. This will speed up trybots.

Bug: 1258341
Change-Id: I0bfdc1e8adb1490d41b196f6711bdb4131dbe4bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3984246
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1063963}
  • Loading branch information
Nathan Memmott authored and chromium-wpt-export-bot committed Oct 26, 2022
1 parent 445e321 commit 8ce3ff8
Show file tree
Hide file tree
Showing 210 changed files with 324 additions and 324 deletions.
2 changes: 1 addition & 1 deletion IndexedDB/bigint_value.htm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

e.target.onsuccess = t.step_func(e => {
e.target.result
.transaction("store")
.transaction("store", "readonly", {durability: "relaxed"})
.objectStore("store")
.get(1)
.onsuccess = t.step_func(e =>
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/bindings-inject-keys-bypass-setters.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
});
t.add_cleanup(() => { delete Object.prototype['10']; });

const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const result = await promiseForRequest(t, tx.objectStore('store').put(
'value', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'key']));

Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/bindings-inject-values-bypass-chain.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Object.prototype.a = {b: {c: 'on proto'}};
t.add_cleanup(() => { delete Object.prototype.a; });

const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: "relaxed"});
tx.objectStore('store').put({});
const result = await promiseForRequest(t, tx.objectStore('store').get(1));

Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/bindings-inject-values-bypass-setters.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
});
t.add_cleanup(() => { delete Object.prototype['id']; });

const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
tx.objectStore('store').put({});
const result = await promiseForRequest(t, tx.objectStore('store').get(1));

Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/blob-composite-blob-reads.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function composite_blob_test({ blobCount, blobSize, name }) {
db.createObjectStore("blobs");
});

const write_tx = db.transaction("blobs", "readwrite");
const write_tx = db.transaction("blobs", "readwrite", {durability: "relaxed"});
let store = write_tx.objectStore("blobs");
store.put(memBlobs, key);
// Make the blobs eligible for GC which is most realistic and most likely
Expand All @@ -42,7 +42,7 @@ function composite_blob_test({ blobCount, blobSize, name }) {

await promiseForTransaction(testCase, write_tx);

const read_tx = db.transaction("blobs");
const read_tx = db.transaction("blobs", "readonly", {durability: "relaxed"});
store = read_tx.objectStore("blobs");
const read_req = store.get(key);

Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/blob-contenttype.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ indexeddb_test(
var blob = new Blob(['mulder', 'scully'], {type: type});
assert_equals(blob.type, type, 'Blob type should match constructor option');

var tx = db.transaction('store', 'readwrite');
var tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
tx.objectStore('store').put(blob, 'key');

tx.oncomplete = t.step_func(function() {
var tx = db.transaction('store');
var tx = db.transaction('store', 'readonly', {durability: 'relaxed'});
tx.objectStore('store').get('key').onsuccess = t.step_func(function(e) {
var result = e.target.result;
assert_equals(result.type, type, 'Blob type should survive round-trip');
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/blob-delete-objectstore-db.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ indexeddb_test(

request.onsuccess = t.step_func(function() {
const blobBContent = "Second blob content";
const trans = db.transaction('store1', 'readwrite');
const trans = db.transaction('store1', 'readwrite', {durability: 'relaxed'});
const store1 = trans.objectStore('store1');
const blobB = new Blob([blobBContent], {"type" : "text/plain"});
store1.put(blobB, key);
Expand Down
6 changes: 3 additions & 3 deletions IndexedDB/blob-valid-after-deletion.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ indexeddb_test(
const blobB = new Blob([blobBContent], {"type" : "text/plain"});
value = { a0: blobA, a1: blobA, b0: blobB };

const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
var store = tx.objectStore('store');

store.put(value, key);
value = null;

const trans = db.transaction('store');
const trans = db.transaction('store', 'readonly', {durability: 'relaxed'});
store = trans.objectStore('store');
const request = store.get(key);

request.onsuccess = t.step_func(function() {
const record = request.result;

trans.oncomplete = t.step_func(function() {
const trans = db.transaction('store', 'readwrite');
const trans = db.transaction('store', 'readwrite', {durability: 'relaxed'});
store = trans.objectStore('store');
const request = store.delete(key);

Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/blob-valid-before-commit.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ indexeddb_test(
const blobB = new Blob([blobBContent], {"type" : "text/plain"});
const value = { a0: blobA, a1: blobA, b0: blobB };

const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');

store.put(value, key);
Expand Down
10 changes: 5 additions & 5 deletions IndexedDB/clone-before-keypath-eval.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
db.createObjectStore('store', {keyPath: 'id', autoIncrement: true});
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');
const obj = new ProbeObject();
store.put(obj);
Expand All @@ -60,7 +60,7 @@
db.createObjectStore('store', {keyPath: 'invalid_id', autoIncrement: true});
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');
const obj = new ProbeObject();
assert_throws_dom('DataError', () => { store.put(obj); },
Expand All @@ -80,7 +80,7 @@
store.createIndex('index', 'prop');
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');
const obj = new ProbeObject();
store.put(obj, 'key');
Expand All @@ -98,7 +98,7 @@
store.createIndex('index', 'prop');
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');
const obj = new ProbeObject();
store.put(obj);
Expand All @@ -115,7 +115,7 @@
store.createIndex('index', 'prop');
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');
store.put(new ProbeObject());

Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/close-in-upgradeneeded.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
assert_true(!!db)
assert_equals(db.version, 1)
assert_equals(db.objectStoreNames.length, 1)
assert_throws_dom("InvalidStateError", function() { db.transaction('os') })
assert_throws_dom("InvalidStateError", function() { db.transaction('os', 'readonly', {durability: 'relaxed'}) })

this.done()
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/cursor-overloads.htm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
};

function verifyOverloads() {
trans = db.transaction('store');
trans = db.transaction('store', 'readonly', {durability: 'relaxed'});
store = trans.objectStore('store');
index = store.index('index');

Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/delete-range.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for (const entry of entries) {
db.createObjectStore("store");
},
function open_func(t, db) {
const store = db.transaction("store", "readwrite").objectStore("store");
const store = db.transaction("store", "readwrite", {durability: 'relaxed'}).objectStore("store");

for (let i = 1; i <= 10; ++i) {
store.put(i, i);
Expand All @@ -41,4 +41,4 @@ for (const entry of entries) {
cursor_request.onerror = t.unreached_func("Failed to open cursor for read request.");
}
)
}
}
2 changes: 1 addition & 1 deletion IndexedDB/error-attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
db.createObjectStore('store');
},
function(t, db) {
var tx = db.transaction('store', 'readwrite');
var tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
var store = tx.objectStore('store');
var r1 = store.add('value', 'key');
r1.onerror = t.unreached_func('first add should succeed');
Expand Down
8 changes: 4 additions & 4 deletions IndexedDB/event-dispatch-active-flag.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
db.createObjectStore('store');
},
(t, db) => {
const tx = db.transaction('store');
const tx = db.transaction('store', 'readonly', {durability: 'relaxed'});
const release_tx = keep_alive(tx, 'store');

assert_true(is_transaction_active(tx, 'store'),
Expand Down Expand Up @@ -48,7 +48,7 @@
db.createObjectStore('store');
},
(t, db) => {
const tx = db.transaction('store');
const tx = db.transaction('store', 'readonly', {durability: 'relaxed'});
const release_tx = keep_alive(tx, 'store');
assert_true(is_transaction_active(tx, 'store'),
'Transaction should be active after creation');
Expand Down Expand Up @@ -82,7 +82,7 @@
db.createObjectStore('store');
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const release_tx = keep_alive(tx, 'store');
assert_true(is_transaction_active(tx, 'store'),
'Transaction should be active after creation');
Expand Down Expand Up @@ -119,7 +119,7 @@
db.createObjectStore('store');
},
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const release_tx = keep_alive(tx, 'store');
assert_true(is_transaction_active(tx, 'store'),
'Transaction should be active after creation');
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/fire-error-event-exception.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
db.createObjectStore('s');
},
(t, db) => {
const tx = db.transaction('s', 'readwrite');
const tx = db.transaction('s', 'readwrite', {durability: 'relaxed'});
tx.oncomplete = t.unreached_func('transaction should abort');
const store = tx.objectStore('s');
store.put(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/fire-success-event-exception.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
db.createObjectStore('s');
},
(t, db) => {
const tx = db.transaction('s');
const tx = db.transaction('s', 'readonly', {durability: 'relaxed'});
tx.oncomplete = t.unreached_func('transaction should abort');
const store = tx.objectStore('s');
const request = store.get(0);
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idb-binary-key-detached.htm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
indexeddb_test(
(t, db) => { db.createObjectStore('store'); },
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');

const array = new Uint8Array([1,2,3,4]);
Expand All @@ -32,7 +32,7 @@
indexeddb_test(
(t, db) => { db.createObjectStore('store'); },
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');

const array = new Uint8Array([1,2,3,4]);
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idb-binary-key-roundtrip.htm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// Verifies that a JavaScript value round-trips through IndexedDB as a key.
function check_key_roundtrip_and_done(t, db, key, key_buffer) {
const tx = db.transaction('store', 'readwrite');
const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'});
const store = tx.objectStore('store');

// Verify put with key
Expand Down
8 changes: 4 additions & 4 deletions IndexedDB/idbcursor-advance-continue-async.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").openCursor();

rq.onsuccess = t.step_func(function(e) {
if (!e.target.result) {
Expand Down Expand Up @@ -61,7 +61,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
if (!e.target.result) {
Expand Down Expand Up @@ -107,7 +107,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
if (!e.target.result) {
Expand Down Expand Up @@ -146,7 +146,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").openCursor();

rq.onsuccess = t.step_func(function(e) {
if (!e.target.result) {
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idbcursor-advance-exception-order.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
store.put('value', 'key');
},
(t, db) => {
const tx = db.transaction('s');
const tx = db.transaction('s', 'readonly', {durability: 'relaxed'});
const store = tx.objectStore('s');

const r = store.openKeyCursor();
Expand Down Expand Up @@ -66,7 +66,7 @@
store.put('value', 'key');
},
(t, db) => {
const tx = db.transaction('s');
const tx = db.transaction('s', 'readonly', {durability: 'relaxed'});
const store = tx.objectStore('s');

const r = store.openKeyCursor();
Expand Down
12 changes: 6 additions & 6 deletions IndexedDB/idbcursor-advance-invalid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
if (!e.target.result) {
Expand Down Expand Up @@ -54,7 +54,7 @@
indexeddb_test(
upgrade_func,
function(t, db) {
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
Expand Down Expand Up @@ -85,7 +85,7 @@
indexeddb_test(
upgrade_func,
function(t, db) {
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
Expand All @@ -111,7 +111,7 @@
indexeddb_test(
upgrade_func,
function(t, db) {
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
Expand All @@ -129,7 +129,7 @@
indexeddb_test(
upgrade_func,
function(t, db) {
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
Expand Down Expand Up @@ -167,7 +167,7 @@
upgrade_func,
function(t, db) {
var count = 0;
var rq = db.transaction("test").objectStore("test").index("index").openCursor();
var rq = db.transaction("test", "readonly", {durability: 'relaxed'}).objectStore("test").index("index").openCursor();

rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
Expand Down
Loading

0 comments on commit 8ce3ff8

Please sign in to comment.