Skip to content

Commit

Permalink
WPT: Update IDB WPT helper to avoid duplicate object store creation
Browse files Browse the repository at this point in the history
In the WPT that requires creating IDB connection with different version,
we should not create the same object store for multiple times. This CL adds
a version check to ensure that it's only created when version equals to 1.

Bug: 1331187
Change-Id: I4d52cc0e2c56493db5bad59705822c3550fa886c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4178503
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1107329}
  • Loading branch information
lozy219 authored and chromium-wpt-export-bot committed Feb 20, 2023
1 parent d963c44 commit 60da07a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion IndexedDB/resources/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ async function createIndexedDBForTesting(rc, dbName, version) {
await rc.executeScript((dbName, version) => {
let request = indexedDB.open(dbName, version);
request.onupgradeneeded = () => {
request.result.createObjectStore('store');
if (version == 1) {
// Only create the object store once.
request.result.createObjectStore('store');
}
}
request.onversionchange = () => {
fail(t, 'unexpectedly received versionchange event.');
Expand Down

0 comments on commit 60da07a

Please sign in to comment.