diff --git a/mozilla/suite/debugQA/content/debugQAEditorOverlay.js b/mozilla/suite/debugQA/content/debugQAEditorOverlay.js index c0206f7e546..aee2fa194da 100644 --- a/mozilla/suite/debugQA/content/debugQAEditorOverlay.js +++ b/mozilla/suite/debugQA/content/debugQAEditorOverlay.js @@ -385,3 +385,69 @@ function EditorTableize() window._content.focus(); } +// --------------------------- TransactionManager --------------------------- + + +function DumpUndoStack() +{ + try { + var txmgr = editorShell.transactionManager; + + if (!txmgr) + { + dump("**** Editor has no TransactionManager!\n"); + return; + } + + dump("---------------------- BEGIN UNDO STACK DUMP\n"); + dump("\n"); + PrintTxnList(txmgr.getUndoList(), ""); + dump("\n"); + dump("Num Undo Items: " + txmgr.numberOfUndoItems + "\n"); + dump("---------------------- END UNDO STACK DUMP\n"); + } catch (e) { + dump("ERROR: DumpUndoStack() failed: " + e); + } +} + +function DumpRedoStack() +{ + try { + var txmgr = editorShell.transactionManager; + + if (!txmgr) + { + dump("**** Editor has no TransactionManager!\n"); + return; + } + + dump("---------------------- BEGIN REDO STACK DUMP\n"); + dump("\n"); + PrintTxnList(txmgr.getRedoList(), ""); + dump("\n"); + dump("Num Redo Items: " + txmgr.numberOfRedoItems + "\n"); + dump("---------------------- END REDO STACK DUMP\n"); + } catch (e) { + dump("ERROR: DumpUndoStack() failed: " + e); + } +} + +function PrintTxnList(txnList, prefixStr) +{ + var i; + + for (i=0 ; i < txnList.numItems; i++) + { + var txn = txnList.getItem(i); + var desc = "TXMgr Batch"; + + if (txn) + { + txn = txn.QueryInterface(Components.interfaces.nsPIEditorTransaction); + desc = txn.txnDescription; + } + dump(prefixStr + "+ " + desc + "\n"); + PrintTxnList(txnList.getChildListForItem(i), prefixStr + "| "); + } +} +