[w3c/IndexedDB] Problem with test IndexedDB/idbobjectstore-rename-store.html (#113)

Problem with test IndexedDB/idbobjectstore-rename-store.html

ToT WebKit fails the 'IndexedDB object store rename covers key generator' part of this test.

The reason appears to be the test, not WebKit.

The test is as follows:

`promise_test(testCase => {
    return createDatabase(testCase, (database, transaction) => {
        createBooksStore(testCase, database);
    }).then(database => {
        const transaction = database.transaction('books', 'readwrite');
        const store = transaction.objectStore('books');
        return checkStoreGenerator(
            testCase, store, 345679,
            'The object store key generator should have the expected state ' +
            'before any renaming').then(() => database.close());
    }).then(() => renameBooksStore(testCase)
    ).then(database => {
        const transaction = database.transaction('renamed_books', 'readwrite');
        const store = transaction.objectStore('renamed_books');
        return checkStoreGenerator(
            testCase, store, 345680,
            'Renaming an object store should not change the state of its key ' +
            'generator').then(() => database.close());
    });
}, 'IndexedDB object store rename covers key generator');`

The problem is the first checkStoreGenerator line.

That returns a promise that resolves when an IDBRequest.onsuccess handler is called, and in response the test calls db.close().

But the readwrite transaction is still in progress at that point, so the db.close() call aborts the transaction.

This reverts the key generator value which then makes the next half of this test case fail.

When I edit the test to make it return a promise that resolves when the IDBTransaction.oncomplete handler is called, things work as expected and we pass.

I believe the test case is wrong, but am also open to somebody pointing out the language in the spec that says WebKit is wrong.

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

Received on Friday, 11 November 2016 07:17:20 UTC