Dexie.js: A null compound index value breaks Safari >= 10.1 (and iOS 10.3 beta)

If you specify a compound index, and then subsequently attempt to store a record in IDB and the value for that index is null, Safari >= 10.1 blows up with the error message:

UnknownError – "An unknown error occurred within Indexed Database."

This affects the iOS 10.3 beta as well.

On Chrome and Firefox, and Safari < 10.1 there is no error.

Code Sample

      db.version(1).stores({
        friends: "++id,name,age,shoeSize,[name+shoeSize]"
      });

      // ...
      // elsewhere in a transaction, this will except
      db.friends.add({name: "Mark", age: 29, shoeSize: null});

Test case

About this issue

Most upvoted comments

A patch has been pushed to the webkit repo, thanks @beidson ! Great speedy work.

Is there a way I can know when a Safari Tech Preview (on macOS or iOS beta channels) is available containing the fix, so we can test our app?

Same issue as @jeromejesse above, working on getting some sort of trace to you although our entire app & debugger crash.

As already mentioned, we already fixed this in WebKit, so don’t kill yourself trying to gather more data.

Try your case out in STP 27 or a WebKit nightly to verify.

We have a crash too on the Dexie toArray function. If we use this function only for get all entries on a table IndexedDB, the webview crash on iOS 10.3.

On iOS < 10.3 all is fine.

We suppose the patch fix this.

@beidson @dfahlander Done! I’ve posted the bug over at https://bugs.webkit.org/show_bug.cgi?id=170000

I’ve updated the test case to demonstrate how the “correct” behavior works as expected.