diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 717097b32..ad8bb838b 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1631,7 +1631,7 @@ define([ Store.leavePad(null, data, function () {}); }; var conf = { - Cache: Cache, // XXX re-enable cache usage + Cache: Cache, // ICE pad cache onCacheStart: function () { postMessage(clientId, "PAD_CACHE"); }, @@ -2686,7 +2686,7 @@ define([ readOnly: false, validateKey: secret.keys.validateKey || undefined, crypto: Crypto.createEncryptor(secret.keys), - Cache: Cache, // XXX re-enable cache usage + Cache: Cache, // ICE drive cache userName: 'fs', logLevel: 1, ChainPad: ChainPad, diff --git a/www/common/outer/cache-store.js b/www/common/outer/cache-store.js index 7a0a50209..a7b1bd3d7 100644 --- a/www/common/outer/cache-store.js +++ b/www/common/outer/cache-store.js @@ -32,7 +32,7 @@ define([ if (!allowed) { return void cb('NOCACHE'); } cache.getItem(id, function (err, obj) { if (err || !obj || !obj.c) { - return void cb(err || 'EINVAL'); + return void cb(Util.serializeError(err || 'EINVAL')); } cb(null, obj.c); obj.t = +new Date(); @@ -50,7 +50,7 @@ define([ c: u8, t: (+new Date()) // 't' represent the "lastAccess" of this cache (get or set) }, function (err) { - cb(err); + cb(Util.serializeError(err)); }); }); }; @@ -64,7 +64,7 @@ define([ if (!allowed) { return void cb('NOCACHE'); } cache.getItem(id, function (err, obj) { if (err || !obj || !Array.isArray(obj.c)) { - return void cb(err || 'EINVAL'); + return void cb(Util.serializeError(err || 'EINVAL')); } cb(null, obj); obj.t = +new Date(); @@ -108,7 +108,7 @@ define([ c: val, t: (+new Date()) // 't' represent the "lastAccess" of this cache (get or set) }, function (err) { - if (err) { onError(err); } + if (err) { onError(Util.serializeError(err)); } }); }, 50); diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index 2ac98cdb7..374523e93 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -175,7 +175,7 @@ define([ ChainPad: ChainPad, classic: true, network: network, - Cache: Cache, // XXX re-enable cache usage + Cache: Cache, // ICE shared-folder cache metadata: { validateKey: secret.keys.validateKey || undefined, owners: owners diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 26bd32f3c..70d5acfcd 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -427,7 +427,7 @@ define([ channel: secret.channel, crypto: crypto, ChainPad: ChainPad, - Cache: Cache, // XXX re-enable cache usage + Cache: Cache, // ICE team cache metadata: { validateKey: secret.keys.validateKey || undefined, }, diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index ca760efb8..a4b2606d4 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -157,7 +157,22 @@ define([ var msgEv = _Util.mkEvent(); var iframe = $('#sbox-iframe')[0].contentWindow; var postMsg = function (data) { - iframe.postMessage(data, '*'); + try { + iframe.postMessage(data, '*'); + } catch (err) { + console.error(err, data); + if (data && data.error && data.error instanceof Error) { + data.error = Util.serializeError(data.error); + try { + iframe.postMessage(data, '*'); + } catch (err2) { + console.error("impossible serialization"); + throw err2; + } + } else { + throw err; + } + } }; var whenReady = waitFor(function (msg) { if (msg.source !== iframe) { return; }