diff --git a/karma.conf.js b/karma.conf.js index 2745ce9..715efa9 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -52,7 +52,7 @@ module.exports = function(config) { // - PhantomJS // - IE (only Windows) // CLI --browsers Chrome,Firefox,Safari - browsers: ['PhantomJS'], + browsers: ['Chrome'], // If browser does not capture in given timeout [ms], kill it // CLI --capture-timeout 5000 diff --git a/src/JSONC.js b/src/JSONC.js index 8372433..a33b989 100644 --- a/src/JSONC.js +++ b/src/JSONC.js @@ -272,7 +272,27 @@ */ JSONC.pack = function (json, bCompress) { var str = JSON.stringify((bCompress ? JSONC.compress(json) : json)); - return Base64.encode(String.fromCharCode.apply(String, gzip.zip(str,{level:9}))); + var zipped = gzip.zip(str,{level:9}); + var data; + try{ + data = String.fromCharCode.apply(String,zipped); + }catch(e){ + if(e instanceof RangeError){ + //Hit the max number of arguments for the JS engine + data = (function(buffer) { + var binary = ''; + var bytes = new Uint8Array(buffer); + var len = bytes.byteLength; + for (var i=0; i