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
…38102)

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}

Co-authored-by: Mingyu Lei <leimy@chromium.org>
  • Loading branch information
chromium-wpt-export-bot and lozy219 authored Feb 27, 2023
1 parent 0bbb310 commit b49f71e
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) {

This comment has been minimized.

Copy link
@Giangpro89

Giangpro89 Apr 17, 2023

``#219

// Only create the object store once.
request.result.createObjectStore('store');
}
}
request.onversionchange = () => {
fail(t, 'unexpectedly received versionchange event.');
Expand Down

0 comments on commit b49f71e

Please sign in to comment.