Bug 637631 DOM manipulation marks blank page as undoably modified r=ehsan
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Wed, 02 Mar 2011 00:01:07 +0000
changeset 7237 0a0ea3bfcb9c72593ce4ee819b9aaa9672a8f347
parent 7236 d815044142c8bf75cb4c961619054bb7f76336c2
child 7238 f06490cf5786df3590e16e77580225c93ea22ec2
push idunknown
push userunknown
push dateunknown
reviewersehsan
bugs637631
Bug 637631 DOM manipulation marks blank page as undoably modified r=ehsan
editor/ui/composer/content/editor.js
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -413,17 +413,20 @@ var gEditorDocumentObserver =
           editor.returnInParagraphCreatesNewParagraph = gPrefs.getBoolPref(kCRInParagraphsPref);
 
           // Set focus to content window if not a mail composer
           // Race conditions prevent us from setting focus here
           //   when loading a url into blank window
           setTimeout(SetFocusOnStartup, 0);
 
           // Call EditorSetDefaultPrefsAndDoctype first so it gets the default author before initing toolbars
+          editor.enableUndo(false);
+          editor.documentCharacterSet = prefCharsetString;
           EditorSetDefaultPrefsAndDoctype();
+          editor.enableUndo(true);
 
           // We may load a text document into an html editor,
           //   so be sure editortype is set correctly
           // XXX We really should use the "real" plaintext editor for this!
           if (editor.contentsMIMEType == "text/plain")
           {
             try {
               GetCurrentEditorElement().editortype = "text";
@@ -2457,22 +2460,17 @@ function EditorSetDefaultPrefsAndDoctype
     var prefCharsetString = 0;
     try
     {
       prefCharsetString = gPrefs.getComplexValue("intl.charset.default",
                                                  Components.interfaces.nsIPrefLocalizedString).data;
     }
     catch (ex) {}
     if ( prefCharsetString && prefCharsetString != 0)
-    {
-      editor.enableUndo(false);
-      editor.documentCharacterSet = prefCharsetString;
       editor.resetModificationCount();
-      editor.enableUndo(true);
-    }
 
     var node = 0;
     var listlength = nodelist.length;
 
     // let's start by assuming we have an author in case we don't have the pref
     var authorFound = false;
     for (var i = 0; i < listlength && !authorFound; i++)
     {