diff --git a/resources/static/shared/modules/interaction_data.js b/resources/static/shared/modules/interaction_data.js index 458478ed645672d646fc768a615114a80735b4dd..1ad832138c3305ed70db299a482483b8f54efb41 100644 --- a/resources/static/shared/modules/interaction_data.js +++ b/resources/static/shared/modules/interaction_data.js @@ -96,10 +96,21 @@ BrowserID.Modules.InteractionData = (function() { function publishStored(oncomplete) { var data = storage.get(); + // XXX: should we even try to post data if it's larger than some reasonable + // threshold? if (data && data.length !== 0) { network.sendInteractionData(data, function() { storage.clear(); complete(oncomplete, true); + }, function(status) { + // if the server returns a 413 error, (too much data posted), then + // let's clear our local storage and move on. This does mean we + // loose some interaction data, but it shouldn't be statistically + // significant. + if (status && status.network && status.network.status === 413) { + storage.clear(); + } + complete(oncomplete, false); }); } else {