forked from mirrors/gecko-dev
Automatic update from web-platform-tests [IndexedDB] Cleanup WPT directory Some common/resource files were in the root directory. This moves them to the /resources/ directory and fixes up include paths. Bug: 1218100 Change-Id: If84f7d1670e9416c95eb0fd96de63add4dcacedf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3661378 Auto-Submit: Ari Chivukula <arichiv@chromium.org> Reviewed-by: Ayu Ishii <ayui@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Cr-Commit-Position: refs/heads/main@{#1006619} -- wpt-commits: 96ea2c2b7bf09644db195f0d878074615faef9e4 wpt-pr: 34171
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
// META: script=resources/support-promises.js
|
|
|
|
setup({allow_uncaught_exception:true});
|
|
|
|
promise_test(async testCase => {
|
|
// Register an event listener that will prevent the intentionally thrown
|
|
// error from bubbling up to the window and failing the testharness. This
|
|
// is necessary because currently allow_uncaught_exception does not behave
|
|
// as expected for promise_test.
|
|
//
|
|
// Git issue: https://github.com/web-platform-tests/wpt/issues/14041
|
|
self.addEventListener('error', (event) => { event.preventDefault(); });
|
|
|
|
const db = await createDatabase(testCase, async db => {
|
|
await createBooksStore(testCase, db);
|
|
});
|
|
|
|
const txn = db.transaction(['books'], 'readwrite');
|
|
const objectStore = txn.objectStore('books');
|
|
const putRequest = objectStore.put({isbn:'one', title:'title'});
|
|
txn.commit();
|
|
putRequest.onsuccess = () => {
|
|
throw new Error('This error thrown after an explicit commit should not ' +
|
|
'prevent the transaction from committing.');
|
|
}
|
|
await promiseForTransaction(testCase, txn);
|
|
|
|
// Ensure that despite the uncaught error after the put request, the explicit
|
|
// commit still causes the request to be committed.
|
|
const txn2 = db.transaction(['books'], 'readwrite');
|
|
const objectStore2 = txn2.objectStore('books');
|
|
const getRequest = objectStore2.get('one');
|
|
await promiseForTransaction(testCase, txn2);
|
|
|
|
assert_equals(getRequest.result.title, 'title');
|
|
}, 'Any errors in callbacks that run after an explicit commit will not stop '
|
|
+ 'the commit from being processed.');
|