Skip to content

Commit 0254521

Browse files
author
Wolfgang Ginolas
committed
Add logging to the Office document parser
It can be enabled with localStorage.CryptPad_dev = "1" (in the correct iframe)
1 parent fc09b21 commit 0254521

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

sdkjs/common/HistoryCommon.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,6 +4880,29 @@
48804880
this.Class = Class;
48814881

48824882
this.Reverted = false;
4883+
4884+
// CryptPad: Add parser debug logging
4885+
if (localStorage.CryptPad_dev != "1") {
4886+
return;
4887+
}
4888+
if (this.Load) {
4889+
const origLoad = this.Load;
4890+
this.Load = function () {
4891+
const properties = {};
4892+
const keys = Object.keys(this);
4893+
for (let i = 0; i < keys.length; i++) {
4894+
const p = keys[i];
4895+
const firstChar = p.charAt(0);
4896+
if (firstChar.toUpperCase() === firstChar
4897+
&& p !== "Class"
4898+
&& typeof this[p] !== "function") {
4899+
properties[p] = ""+this[p];
4900+
}
4901+
}
4902+
console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties);
4903+
return Reflect.apply(origLoad, this, arguments);
4904+
};
4905+
}
48834906
}
48844907
CChangesBase.prototype.Type = window['AscDFH'].historyitem_Unknown_Unknown;
48854908
CChangesBase.prototype.GetType = function()

0 commit comments

Comments
 (0)