From 0aae61f72e2f0ad3d7d3feaceb2d77b229e85510 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 12 Dec 2017 14:18:22 +0100 Subject: [PATCH 1/5] Anonymous RPC GET_FILE_SIZE does not work correctly unless at least one authenticated RPC has been called first. Also RPC failures (throw error) are silent in the logs --- rpc.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/rpc.js b/rpc.js index a4821524b..410e5f22b 100644 --- a/rpc.js +++ b/rpc.js @@ -1057,11 +1057,9 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function) } }; - var rpc = function ( - ctx /*:{ store: Object }*/, - data /*:Array>*/, - respond /*:(?string, ?Array)=>void*/) - { + var rpc0 = function (ctx, data, respond) { + if (!Env.msgStore) { Env.msgStore = ctx.store; } + if (!Array.isArray(data)) { return void respond('INVALID_ARG_FORMAT'); } @@ -1140,8 +1138,6 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function) Respond('E_ACCESS_DENIED'); }; - if (!Env.msgStore) { Env.msgStore = ctx.store; } - var handleMessage = function (privileged) { if (config.logRPC) { console.log(msg[0]); } switch (msg[0]) { @@ -1272,6 +1268,19 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function) handleMessage(session.privilege); }; + var rpc = function ( + ctx /*:{ store: Object }*/, + data /*:Array>*/, + respond /*:(?string, ?Array)=>void*/) + { + try { + return rpc0(ctx, data, respond); + } catch (e) { + console.log("Error from RPC with data " + JSON.stringify(data)); + console.log(e.stack); + } + }; + var updateLimitDaily = function () { updateLimits(config, undefined, function (e) { if (e) { From 8582f92892d6d0fb75dbeefb7c0fab73d5f8dff6 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 12 Dec 2017 14:30:10 +0100 Subject: [PATCH 2/5] Attempt to handle the possible scenario where we are overwriting an existing pad with the initial content. --- www/common/sframe-app-framework.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 5b4d075be..526e45678 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -253,6 +253,13 @@ define([ newContent = normalize(newContent); contentUpdate(newContent); } else { + if (!cpNfInner.metadataMgr.getPrivateData().isNewFile) { + // We're getting 'new pad' but there is an existing file + // We don't know exactly why this can happen but under no circumstances + // should we overwrite the content, so lets just try again. + common.gotoURL(); + return; + } console.log('updating title'); title.updateTitle(title.defaultTitle); evOnDefaultContentNeeded.fire(); From 15ccf7e54db9c2cc5c7b9c096c85f2729e50c8f2 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 12 Dec 2017 14:39:03 +0100 Subject: [PATCH 3/5] try to fix saucelabs --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9fe64ca63..c756e5452 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,4 +26,5 @@ addons: sauce_connect: username: "cjdelisle" access_key: - secure: "pgGh8YGXLPq6fpdwwK2jnjRtwXPbVWQ/HIFvwX7E6HBpzxxcF2edE8sCdonWW9TP2LQisZFmVLqoSnZWMnjBr2CBAMKMFvaHQDJDQCo4v3BXkID7KgqyKmNcwW+FPfSJ5MxNBro8/GE/awkhZzJLYGUTS5zi/gVuIUwdi6cHI8s=" + secure: "pgGh8YGXLPq6fpdwwK2jnjRtwXPbVWQ/HIFvwX7E6HBpzxxcF2edE8sCdonWW9TP2LQisZFmVLqoSnZWMnjBr2CBAMKMFvaHQDJDQCo4v3BXkID7KgqyKmNcwW+FPfSJ5MxNBro8/GE/awkhZzJLYGUTS5zi/gVuIUwdi6cHI8s="i + tunnel_domains: localhost From 6bcc72ff835054bf449d7ece9b845942e2d43657 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Dec 2017 14:45:25 +0100 Subject: [PATCH 4/5] Fix pads using an old URL --- www/common/sframe-common-outer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index a5ad06e03..fc132b8cb 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -150,6 +150,7 @@ define([ if (!secret.keys) { isNewHash = false; secret.keys = secret.key; + readOnly = false; } var parsed = Utils.Hash.parsePadUrl(window.location.href); if (!parsed.type) { throw new Error(); } From e82e32d2738a9afff43c472571be830db0151201 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 12 Dec 2017 14:50:09 +0100 Subject: [PATCH 5/5] Remove saucelabs because it's broken --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c756e5452..0440c2a1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,3 @@ before_script: - ./node_modules/bower/bin/bower install - node ./server.js & - sleep 2 -addons: - sauce_connect: - username: "cjdelisle" - access_key: - secure: "pgGh8YGXLPq6fpdwwK2jnjRtwXPbVWQ/HIFvwX7E6HBpzxxcF2edE8sCdonWW9TP2LQisZFmVLqoSnZWMnjBr2CBAMKMFvaHQDJDQCo4v3BXkID7KgqyKmNcwW+FPfSJ5MxNBro8/GE/awkhZzJLYGUTS5zi/gVuIUwdi6cHI8s="i - tunnel_domains: localhost