[Webkit-unassigned] [Bug 247053] New: IDBObjectStore.put() deletes object on unique index violation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 26 02:18:50 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=247053

            Bug ID: 247053
           Summary: IDBObjectStore.put() deletes object on unique index
                    violation
           Product: WebKit
           Version: Safari 16
          Hardware: Mac (Intel)
                OS: macOS 12
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: david.fahlander at gmail.com

Calling IDBObjectStore.put(object) resulting in a constraint violation, should leave the database as if the operation did not take place, but if the operation fails due to a violation of a unique index, the end result will be a deletion of the object.

Repro link: https://jsitor.com/0oBx-UC93

The repro has an object store "users" with primary key "id" and unique index on property "username".
First, it adds two objects in the object store:

{id: 1, username: "foo"}
{id: 2, username: "bar"}

Then, it does a put operation with {id: 1, username: "bar"}, which would violate the uniqueness of the username index because "bar" is already occupied by the second object (with id 2).

After that transaction has ended (auto-committed), the repro will list all users in the database and only find the second entry.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221026/330c1756/attachment.htm>


More information about the webkit-unassigned mailing list