{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3382","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3382/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3382/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3382/events","html_url":"https://github.com/pouchdb/pouchdb/issues/3382","id":54070841,"number":3382,"title":"SecurityError DOM Exception 18 on Chrome for iOS on iPhone","user":{"login":"jkndrkn","id":91959,"avatar_url":"https://avatars.githubusercontent.com/u/91959?v=3","gravatar_id":"","url":"https://api.github.com/users/jkndrkn","html_url":"https://github.com/jkndrkn","followers_url":"https://api.github.com/users/jkndrkn/followers","following_url":"https://api.github.com/users/jkndrkn/following{/other_user}","gists_url":"https://api.github.com/users/jkndrkn/gists{/gist_id}","starred_url":"https://api.github.com/users/jkndrkn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkndrkn/subscriptions","organizations_url":"https://api.github.com/users/jkndrkn/orgs","repos_url":"https://api.github.com/users/jkndrkn/repos","events_url":"https://api.github.com/users/jkndrkn/events{/privacy}","received_events_url":"https://api.github.com/users/jkndrkn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-12T16:03:59Z","updated_at":"2015-01-14T16:37:53Z","closed_at":null,"body":"Hi there. I really appreciate the work that goes into PouchDB. Working with it has been great so far. I've had one major issue with it so far, though.\r\n\r\nI am using PouchDB 3.2.1 on a web application targeted for Chrome on iOS. The below error also appears in PouchDB 3.2.0.\r\n\r\nWhen trying to create a connection to a local database on Chrome on iOS, PouchDB uses that browser's WebSQL database. This, however, fails intermittently with SecurityError: DOM Exception 18 when running the application on both iPhone 5 and iPhone 5s. I have not been able to reproduce this error on my iPad 5 yet.\r\n\r\nI am creating a new PouchDB database as follows:\r\n\r\n    var localDBName = \"dbd8008497c6f368d\";\r\n    self.localPouch = new PouchDB(localDBName, {size: 50});\r\n\r\nI have also tried setting size to 49, 1, and 0 and not setting size at all.\r\n\r\n    Here is a stacktrace sourced from BugSnag:\r\n    \r\n    [native code]:4232 openDatabase\r\n    http://192.168.1.144:8000/app/bower_components/pouchdb/dist/pouchdb.js:4232:48 openDB\r\n    http://192.168.1.144:8000/app/bower_components/pouchdb/dist/pouchdb.js:4275:18 WebSqlPouch\r\n    http://192.168.1.144:8000/app/bower_components/pouchdb/dist/pouchdb.js:5655:40\r\n    [native code]:0 Promise\r\n    http://192.168.1.144:8000/app/bower_components/pouchdb/dist/pouchdb.js:5570:28 PouchDB\r\n\r\nHere is the code near line 4232 of pouchdb.js:\r\n\r\n    var cachedDatabases = {};\r\n    \r\n    var openDBFunction = (typeof navigator !== 'undefined' &&\r\n          navigator.sqlitePlugin &&\r\n          navigator.sqlitePlugin.openDatabase) ?\r\n        navigator.sqlitePlugin.openDatabase.bind(navigator.sqlitePlugin) :\r\n          (typeof sqlitePlugin !== 'undefined' && sqlitePlugin.openDatabase) ?\r\n        sqlitePlugin.openDatabase.bind(sqlitePlugin) :\r\n          (typeof openDatabase !== 'undefined') ?\r\n        openDatabase :\r\n        null;\r\n    \r\n    function openDB(name, version, desc, size) {\r\n      var db = cachedDatabases[name];\r\n      if (!db) {\r\n        db = cachedDatabases[name] = openDBFunction(name, version, desc, size);\r\n      }\r\n      return db;\r\n    }\r\n\r\nRefreshing the the browser page does not fix the issue. Neither does closing the browser tab and re-opening the page. The only way I can fix the issue is by force-quitting the browser and relaunching the application. However, this is not an acceptable workaround for our users.\r\n\r\nThis question is also posted to stackoverflow: http://stackoverflow.com/questions/27905453/overcoming-securityerror-dom-exception-18-in-pouchdb-on-mobile-chrome-for-ios"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/69945758","html_url":"https://github.com/pouchdb/pouchdb/issues/3382#issuecomment-69945758","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3382","id":69945758,"user":{"login":"jkndrkn","id":91959,"avatar_url":"https://avatars.githubusercontent.com/u/91959?v=3","gravatar_id":"","url":"https://api.github.com/users/jkndrkn","html_url":"https://github.com/jkndrkn","followers_url":"https://api.github.com/users/jkndrkn/followers","following_url":"https://api.github.com/users/jkndrkn/following{/other_user}","gists_url":"https://api.github.com/users/jkndrkn/gists{/gist_id}","starred_url":"https://api.github.com/users/jkndrkn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkndrkn/subscriptions","organizations_url":"https://api.github.com/users/jkndrkn/orgs","repos_url":"https://api.github.com/users/jkndrkn/repos","events_url":"https://api.github.com/users/jkndrkn/events{/privacy}","received_events_url":"https://api.github.com/users/jkndrkn/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T16:37:53Z","updated_at":"2015-01-14T16:37:53Z","body":"OK, this should work: http://bl.ocks.org/jkndrkn/fd0074554047c3c0d8ac\r\n\r\nI changed the \"size\" to 50000000 (50 million instead of 5 million) and removed the callback. I was able to have Chrome in iOS show DOM Exception 18."}}