From 7be0209a8ff938a0fc4f851fe22d1db66bd80b91 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Wed, 24 Jul 2002 03:35:40 +0000 Subject: [PATCH] Reduce memory cost of using HTML Source multiple times by reducing undo buffer usage. b=158860, r=brade, sr=kin, a=asa/drivers --- editor/ui/composer/content/editor.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editor/ui/composer/content/editor.js b/editor/ui/composer/content/editor.js index 2f00f5da93cd..cf5032b9acba 100644 --- a/editor/ui/composer/content/editor.js +++ b/editor/ui/composer/content/editor.js @@ -1562,6 +1562,13 @@ function SetEditMode(mode) // Only rebuild document if a change was made in source window if (gHTMLSourceChanged) { + // Reduce the undo count so we don't use too much memory + // during multiple uses of source window + // (reinserting entire doc caches all nodes) + try { + gEditor.transactionManager.maxTransactionCount = 2; + } catch (e) {} + gEditor.beginTransaction(); try { // We are comming from edit source mode, @@ -1594,6 +1601,10 @@ function SetEditMode(mode) } gEditor.endTransaction(); + // Restore unlimited undo count + try { + gEditor.transactionManager.maxTransactionCount = -1; + } catch (e) {} } else { // We don't need to call this again, so remove handler gSourceContentWindow.removeEventListener("input", oninputHTMLSource, false);