Bug 198278

Summary: Cannot store blobs in IndexedDB on iOS in Private Browsing mode
Product: WebKit Reporter: jordan.michael.last
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Severity: Normal CC: ap, beidson, cdumez, ggaren, sihui_liu, youennf
Priority: P2    
Version: Safari 12   
Hardware: iPhone / iPad   
OS: Unspecified   

Description jordan.michael.last 2019-05-27 11:28:25 PDT
As far as I know you cannot store blobs in IndexedDB on iOS. It would be nice to have this feature. One good thing about blobs is that they store their mime type with them, and require fewer steps from database to use after being stored.
Comment 1 Chris Dumez 2019-05-27 12:15:00 PDT
Do you have a test page that reproduces this issue? What sort of error are you getting?
Comment 2 jordan.michael.last 2019-05-27 19:21:43 PDT
Here is the live test page: https://lastmjs.github.io/safari-blob-indexed-db-test

The code is found here: https://github.com/lastmjs/safari-blob-indexed-db-test

All the test page does is fetch an mp3 file and try to store the blob in IndexedDB. I've set a console.log and an alert for the error. All the alert says is "null". I'm not sure how to see what the console.log says. I have limited access to iOS devices.
Comment 3 jordan.michael.last 2019-05-27 19:23:01 PDT
Sorry, the test page fetches the audio file, tries to store the blob in IndexedDB, then tries to retrieve the file and set the src of the audio element to the object url created from window.URL.createObjectURL. If the example is successful, you should be able to click play on the audio element and hear Alexander Graham Bell's voice.
Comment 4 jordan.michael.last 2019-05-27 19:31:06 PDT
It looks like the iOS device I was testing on is on iOS version 12.0.1. I tested it on another phone with version 12.2, and the test page works. I'll do some more testing and report back. It would be nice if someone could independently reproduce my results.
Comment 5 Chris Dumez 2019-05-27 19:51:14 PDT
The bug does not reproduce for me on iOS 12.4 beta. This likely has been fixed already?
Comment 6 jordan.michael.last 2019-05-27 21:09:57 PDT
Seems likely, I've tested it on two 12.2 devices now and it works.
Comment 7 jordan.michael.last 2019-06-04 23:14:43 PDT
I've done some more testing:

12.2 works fine
12.3 works fine
12.3.1 does not work with an explicit error: DataCloneError: Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.

The behavior seems inconsistent across versions, and Chris you say it's working on 12.4 beta? Is there any way to get a confirmation that it is indeed fixed in 12.4 and will continue to be supported thereafter, officially?
Comment 8 Chris Dumez 2019-06-05 08:52:25 PDT
I have just confirmed that the test page (https://lastmjs.github.io/safari-blob-indexed-db-test) works as expected on iOS 13 beta 1.
Comment 9 jordan.michael.last 2019-06-05 09:37:52 PDT
Thanks for everything!
Comment 10 jordan.michael.last 2019-08-21 20:49:00 PDT
So I'm not so sure this is fixed. I went to an Apple store to test downloads on https://podcrypt.app, and I started getting the same exact error again. This was yesterday. I tested on multiple devices and all were on iOS 12.4 (16G77), and all failed with the "DataCloneError: Failed to store record in an IDBObjectStore: BlobURLs are not yet supported."

I have access to another device at home with iOS 12.4 (16G77), and the error does not throw. What's going on here? I'm not confident iOS 13 has this fixed since some versions seem to work, some don't, and even the same version on different devices are not consistent in their behavior.
Comment 11 jordan.michael.last 2019-09-09 22:11:52 PDT
I think I know my issue...the devices at the Apple store are set to private mode by default, and private mode does not have support for IndexedDB blobs. So, non-private mode definitely works in 12.4