From 5a901403711356b82dafd44dec4bd4f90203b6ed Mon Sep 17 00:00:00 2001 From: Willem Date: Sat, 23 Jan 2016 19:25:20 +0100 Subject: [PATCH] Fixed websql on android 4.x --- README.md | 4 +++- es5-ff-spa-loader.js | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a755c98..899bbb5 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,8 @@ A javascript library providing server defined loading of assets for a single pag * Iceweasel 43 * Opera 12 Presto * IE 11 Edge - * Android 5 in Cordova + * Android 5.1.1 in Cordova + Site + * Android 4.2.2 in Cordova + Site ## Todo @@ -185,6 +186,7 @@ Add unit tests for any new or changed functionality. Lint and test your code. ### 0.1.1 * Moved websql delete timeout to cleanServerlUrl for faster boot. +* Fixed websql db-size and db-name for older androids. * Added more jsdoc ### 0.1.0 diff --git a/es5-ff-spa-loader.js b/es5-ff-spa-loader.js index 427e028..a142a6a 100644 --- a/es5-ff-spa-loader.js +++ b/es5-ff-spa-loader.js @@ -174,8 +174,8 @@ }, websql: function(opt) { if (opt === undefined) { opt = {}; } - if (opt.name === undefined) { opt.name = 'ffSpaLoader.db'; } - if (opt.size === undefined) { opt.size = -1; } + if (opt.name === undefined) { opt.name = 'FFSpaLoader'; } + if (opt.size === undefined) { opt.size = 4 * 1024 * 1024; } // reg 4MB let user do higher if (opt.version === undefined) { opt.version = '1.0'; } if (opt.openDatabase === undefined) { opt.openDatabase = rootWindow.openDatabase; } var nullDataHandler = function(cb) { @@ -292,10 +292,10 @@ try { var stack = err.stack || ''; - stack = stack.split('\n').map(function (line) { return line.trim(); }); + stack = stack.split('\n').map(function (line) { return line.trim()+'\n'; }); var stackText = stack.splice(stack[0] === 'Error' ? 2 : 1); - var traceTag = document.createElement('div'); + var traceTag = document.createElement('pre'); traceTag.appendChild(document.createTextNode(stackText)); rootTag.appendChild(traceTag); } catch (stackError) {