Skip to content

Commit 25e4fdf

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 63bab5c commit 25e4fdf

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
@@ -4866,6 +4866,29 @@
48664866
this.Class = Class;
48674867

48684868
this.Reverted = false;
4869+
4870+
// CryptPad: Add parser debug logging
4871+
if (localStorage.CryptPad_dev != "1") {
4872+
return;
4873+
}
4874+
if (this.Load) {
4875+
const origLoad = this.Load;
4876+
this.Load = function () {
4877+
const properties = {};
4878+
const keys = Object.keys(this);
4879+
for (let i = 0; i < keys.length; i++) {
4880+
const p = keys[i];
4881+
const firstChar = p.charAt(0);
4882+
if (firstChar.toUpperCase() === firstChar
4883+
&& p !== "Class"
4884+
&& typeof this[p] !== "function") {
4885+
properties[p] = ""+this[p];
4886+
}
4887+
}
4888+
console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties);
4889+
return Reflect.apply(origLoad, this, arguments);
4890+
};
4891+
}
48694892
}
48704893
CChangesBase.prototype.Type = window['AscDFH'].historyitem_Unknown_Unknown;
48714894
CChangesBase.prototype.GetType = function()

0 commit comments

Comments
 (0)