From 828a685ba836bc2978af4efdd2cad3679b99adf7 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Mon, 9 Oct 2017 14:12:55 +0300 Subject: [PATCH] Fix broken browser fight logging --- www/common/sframe-app-framework.js | 35 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 738d1ab70..986630487 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -162,24 +162,23 @@ define([ /* pushing back over the wire is necessary, but it can result in a feedback loop, which we call a browser fight */ - if (module.logFights) { - // what changed? - var op = TextPatcher.diff(newContentStrNoMeta, newContent2StrNoMeta); - // log the changes - TextPatcher.log(newContentStrNoMeta, op); - var sop = JSON.stringify(TextPatcher.format(newContentStrNoMeta, op)); - - var index = module.fights.indexOf(sop); - if (index === -1) { - module.fights.push(sop); - console.log("Found a new type of browser disagreement"); - console.log("You can inspect the list in your " + - "console at `REALTIME_MODULE.fights`"); - console.log(module.fights); - } else { - console.log("Encountered a known browser disagreement: " + - "available at `REALTIME_MODULE.fights[%s]`", index); - } + // what changed? + var op = TextPatcher.diff(newContentStrNoMeta, newContent2StrNoMeta); + // log the changes + TextPatcher.log(newContentStrNoMeta, op); + var sop = JSON.stringify(TextPatcher.format(newContentStrNoMeta, op)); + + var fights = window.CryptPad_fights = window.CryptPad_fights || []; + var index = fights.indexOf(sop); + if (index === -1) { + fights.push(sop); + console.log("Found a new type of browser disagreement"); + console.log("You can inspect the list in your " + + "console at `REALTIME_MODULE.fights`"); + console.log(fights); + } else { + console.log("Encountered a known browser disagreement: " + + "available at `REALTIME_MODULE.fights[%s]`", index); } } }