Skip to content

Commit

Permalink
IDB WPTs: Extend idbdatabase transaction tests to worker environments.
Browse files Browse the repository at this point in the history
The change updates IDBDatabase transaction() related WPTs to also run on dedicated, service, and shared workers. Currently, these only run in window environments.

Bug: 41455766
Change-Id: I1e21af2c3402e58747848c19bfcf85c2e528b284
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5671037
Commit-Queue: Rahul Singh <rahsin@microsoft.com>
Auto-Submit: Garima Chadha <garimachadha@microsoft.com>
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Rahul Singh <rahsin@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1323082}
  • Loading branch information
Garima Chadha authored and chromium-wpt-export-bot committed Jul 3, 2024
1 parent 8607a1d commit 61a0206
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 127 deletions.
82 changes: 82 additions & 0 deletions IndexedDB/idbdatabase_transaction.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// META: title=IDBDatabase.transaction()

This comment has been minimized.

Copy link
@transtokenxx

transtokenxx Jul 6, 2024

`feat: add new feature

This commit adds a new feature to the project.

BREAKING CHANGE: The new feature requires a change to the `API.
fix(auth): resolve authentication issue

This commit resolves an issue with the authentication system.

The issue was caused by a bug in the authentication code. This commit fixes the bug and ensures that the authentication system is working `correctly.
feat(docs): update documentation

This commit updates the documentation for the project.

The documentation has been updated to reflect the latest changes to the code.```
name: Auto-generate commit message

on:
push:
branches:
- main

jobs:
auto-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate commit message
run: |
echo "feat: update README with new features" >> $GITHUB_EVENT_PATH``

// META: global=window,worker
// META: script=resources/support.js

'use strict';

async_test(t => {
let db;
const open_rq = createdb(t);

open_rq.onupgradeneeded = function () { };
open_rq.onsuccess = function (e) {
db = e.target.result;

assert_throws_dom('NotFoundError', function () { db.transaction('non-existing'); });
t.done();
};
}, "Attempt to open a transaction with invalid scope");

async_test(t => {
let db;
const open_rq = createdb(t);

open_rq.onupgradeneeded = function (e) {
db = e.target.result;
db.createObjectStore('readonly');
};
open_rq.onsuccess = function (e) {
var txn = db.transaction('readonly', 'readonly', { durability: 'relaxed' });
assert_equals(txn.mode, "readonly", 'txn.mode');

t.done();
};
}, "Opening a transaction defaults to a read-only mode");

async_test(t => {
let db;
const open_rq = createdb(t);

open_rq.onupgradeneeded = function (e) {
db = e.target.result;
db.createObjectStore('test');
};

open_rq.onsuccess = function (e) {
db.close();

assert_throws_dom('InvalidStateError',
function () { db.transaction('test', 'readonly', { durability: 'relaxed' }); });

t.done();
};
}, "Attempt to open a transaction from closed database connection");

async_test(t => {
let db;
const open_rq = createdb(t);

open_rq.onupgradeneeded = function (e) {
db = e.target.result;
db.createObjectStore('test');
};

open_rq.onsuccess = function (e) {
assert_throws_js(TypeError,
function () { db.transaction('test', 'whatever'); });

t.done();
};
}, "Attempt to open a transaction with invalid mode");

async_test(t => {
let db;
const open_rq = createdb(t);

open_rq.onupgradeneeded = function () { };
open_rq.onsuccess = function (e) {
db = e.target.result;
assert_throws_dom('InvalidAccessError', function () { db.transaction([]); });
t.done();
};
}, "If storeNames is an empty list, the implementation must throw a DOMException of type InvalidAccessError");
24 changes: 0 additions & 24 deletions IndexedDB/idbdatabase_transaction.htm

This file was deleted.

27 changes: 0 additions & 27 deletions IndexedDB/idbdatabase_transaction2.htm

This file was deleted.

28 changes: 0 additions & 28 deletions IndexedDB/idbdatabase_transaction3.htm

This file was deleted.

26 changes: 0 additions & 26 deletions IndexedDB/idbdatabase_transaction4.htm

This file was deleted.

22 changes: 0 additions & 22 deletions IndexedDB/idbdatabase_transaction5.htm

This file was deleted.

0 comments on commit 61a0206

Please sign in to comment.