yathit / ydn-db

Javascript database module for Indexeddb, Web SQL and localStorage storage mechanisms supporting version migration, advanced query, SQL and transaction.
Apache License 2.0
503 stars 41 forks source link

iOS9 fails the unit tests on this site. #85

Closed JerryLumpkins closed 8 years ago

JerryLumpkins commented 8 years ago

When you run the unit tests specified on this site using an iPad running iOS9 it fails at least 3 of them. It also fails in the latest version of 10X.

Let us know when you've fixed your product.

yathit commented 8 years ago

These failing test are know issues and no plan to fix. The reason is it is not worth fixing them. We have tried as much possible. The suggested workaround is to use WebSQL in Safari. It is OK in most app.

JerryLumpkins commented 8 years ago

image

JerryLumpkins commented 8 years ago

You know, we are 4 days into no solution for any aspect of the fact that your product fails miserably in iOS9. Have you even tried to use it?

yathit commented 8 years ago

The miserable situation is the same if you use IndexedDB natively.

JerryLumpkins commented 8 years ago

We are not using indexeddb for this.:

var options = { mechanisms: ['websql'], // default ordering size: 50 * 1024 * 1024 // 50 MB }; var IEOption = { size: 50 * 1024 * 1024 // 50 MB };

var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false); var macOsx = (navigator.userAgent.match(/(Mac)/g) ? true : false); var iOSVer8 = (navigator.userAgent.match(/(OS 8)/g) ? true : false); var IE11 = !!navigator.userAgent.match(/Trident._rv[ :]_11./);

if (iOS == true || macOsx == true) { if (iOSVer8 == true) { db_mob_audit = new ydn.db.Storage('idb_mob_auditor', schema, options); } else if (macOsx == true) { db_mob_audit = new ydn.db.Storage('idb_mob_auditor', schema, options); } else { db_mob_audit = new ydn.db.Storage('idb_mob_auditor', schema); } }else { if (navigator.userAgent.search("IE") >= 0 || IE11 == true) { db_mob_audit = new ydn.db.Storage('idb_mob_auditor', schema, IEOption); } else { db_mob_audit = new ydn.db.Storage('idb_mob_auditor', schema); } }

This code was written prior to iOS9. We have added extra logic to determine if the os is iOS9, and use the appropriate options for it also. It just fails. We have been working with this for almost 3 years now. We aren't making some beginner's mistake.

We are getting prompted to approve of the 50MB of storage space. We click the option to approve it. The insertion of data starts. When it reaches 5 MB it stops with no message. I check the storage state, and it has 5 MB in it.

This is directly related to something that changed in iOS9.

yathit commented 8 years ago

Have you try removing size option? Probably it is not allow in iOS9.

JerryLumpkins commented 8 years ago

We need the space. The 50MB is a serious constraint that we keep hoping they will get rid of. On Android devices I have up to 20 percent of the available disk space.

JerryLumpkins commented 8 years ago

If we were to only have 5 MB, we can't do anything we are trying to do. Our web application uses appcache and client side data storage to allow the user to continue to use our product when there is no internet connection.

yathit commented 8 years ago

Suggested approach for opening ydn.db.Storage is just open without any options. Let the library select best options.

JerryLumpkins commented 8 years ago

Will it make the correct decision to use WebSQL without being provided the option? That didn't work previously.

yathit commented 8 years ago

@JerryLumpkins don't worry about storage limit option, it never get approve from W3C. You will get the storage as platform provide. So if user approve, your app will get 50 MB in iOS.

yathit commented 8 years ago

Will it make the correct decision to use WebSQL without being provided the option?

Yes. If you use codova with Sqlite plugin, Sqlite is preferred over WebSQL. So there are too many stuff. Let the library do.

JerryLumpkins commented 8 years ago

We don't want to keep asking the user to increase data storage space like 4 times during a single download. That's why we are asking for the max up front. IF you think it will work better without the hints we will try.

yathit commented 8 years ago

Please close if your issue is resolved.

JerryLumpkins commented 8 years ago

I will explore changing the option, and let you know what we find.

yathit commented 8 years ago

If you serious need 50 MB upfront, some people are writing dummy database the require storage. After then open the real database. So that is ugly workaround, since WebSQL silently fail (yes, silently fail) even if user approve the storage.

JerryLumpkins commented 8 years ago

I hear what you are saying, except that this has been working reliably for us for more than a year.

swapnil0545 commented 8 years ago

@yathit I have been working along with @JerryLumpkins on this issue. Webworker specific issue : Firstly I think we should see why the library is not working when we pass in the options parameter to the Storage Demo : http://52.24.87.119/demo/index2.html This issue is there in chrome as well. If we do not pass in the options parameter and let it choose for itself then it doesn't work on Safari but does on Chrome. Demo : http://52.24.87.119/demo/index.html

Here I refer chrome as : Windows Chrome Version (45.0.2454.101 m) and safari as : Mac OS X Yosemite - Safari 9.0(10601.1.56.2) and iPad Safari

yathit commented 8 years ago

I think if you want to open more than 5MB in ios, you have to open database in user event, such as button click callback. Could you try out? Thanks.

swapnil0545 commented 8 years ago

What we do is we create the schema from outside of the worker page also, from there it does ask for the storage prompt of 100mb on Mac Safari 9 and earlier versions. But we want to access the same schema in webworker also. But it is not able to open and use it.

yathit commented 8 years ago

It should be able to open in web worker if user already granted for the origin. On Oct 14, 2015 6:11 PM, "Swapnil Mhaske" notifications@github.com wrote:

What we do is we create the schema from outside of the worker page also, from there it does ask for the storage prompt of 100mb on Mac Safari 9 and earlier versions. But we want to access the same schema in webworker also. But it is not able to open and use it.

— Reply to this email directly or view it on GitHub https://github.com/yathit/ydn-db/issues/85#issuecomment-148002107.

swapnil0545 commented 8 years ago

Yes, but at this moment I am not able to create a schema with websql . It doesn't work when I pass var options = { mechanisms: ['websql'] }; http://52.24.87.119/demo2/index.html

JerryLumpkins commented 8 years ago

Yahit,

We are not wanting to ask for more than the 50 MB in iOS. But we want to ask for exactly 50 MB up front. We don't want the user to be prompted for 5, 10, and then 25. We want to have them approve the maximum allowed up front, and then not bother them any more.

yathit commented 8 years ago

Please open again if more information available.

My suggestion is use in main thread. Since all DB request are async (no UI block), background worker is not necessary.

yathit commented 8 years ago

indexedDB API support in web worker is coming to Safari (and iOS?). https://developer.apple.com/safari/technology-preview/release-notes/