[w3c/IndexedDB] Possible wrong WPT test? (Issue #442)

stelar7 created an issue (w3c/IndexedDB#442)

[Open a database connection](https://w3c.github.io/IndexedDB/#open-a-database-connection) step 6, creates a new database, and step 10.6 runs the [upgrade a database](https://www.w3.org/TR/IndexedDB/#upgrade-a-database)

The WPT test for [IDBFactory.databases()](https://wpt.live/IndexedDB/get-databases.any.html) has a test for `Ensure that databases() doesn't pick up changes that haven't commited.`

It tests by:
* Creating a database
* Creating another database, but this time calling IDBFactory.databases() in `onupgradeneeded`

As far as i can see, the database should exist before any attempts to upgrade the database.

As such, the result of this
```
  const db1 = await createNamedDatabase(testCase, "DB1", ()=>{});
  let databases_promise1;
  const db2 = await createNamedDatabase(testCase, "DB2", async () => {
    databases_promise1 = indexedDB.databases();

    // Give databases() operation a chance to fetch all current info about
    // existing databases. This must be a sync sleep since await would trigger
    // auto commit of the upgrade transaction.
    sleep_sync(1000);
  });
  const databases_result1 = await databases_promise1;
```

`databases_result1.length` should be 2, not 1

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/442
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/IndexedDB/issues/442@github.com>

Received on Thursday, 13 March 2025 09:33:58 UTC