If you used a debugger (always do it) or simply look thoroughly, you would see a trivial infinite loop bug and a simple fix:
while (this.undos.length > 0) this.operations.push(this.undos.pop());