Fix for bug 388183 (Reloading this testcase causes crash [@
authorpeterv@propagandism.org
Wed, 18 Jul 2007 02:46:41 -0700
changeset 3606 11a09cc5ce2fde68d4c327a8b8475b543699e614
parent 3605 8fdaaac41ead43e4a3717dadbb1a56ba63d50f2e
child 3607 c8bd7becfd03aa55d2ca46393bc64d053577291b
push idunknown
push userunknown
push dateunknown
bugs388183
milestone1.9a7pre
Fix for bug 388183 (Reloading this testcase causes crash [@ nsHTMLDocument::ChangeContentEditableCount] with null editor), now with correct whitespace. r/sr=jst.
content/html/document/src/nsHTMLDocument.cpp
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -3759,35 +3759,35 @@ nsHTMLDocument::ChangeContentEditableCou
 
       nsCOMPtr<nsIEditorDocShell> editorDocShell =
         do_QueryInterface(docshell, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsCOMPtr<nsIEditor> editor;
       editorDocShell->GetEditor(getter_AddRefs(editor));
       if (editor) {
-      nsCOMPtr<nsIDOMRange> range;
-      rv = NS_NewRange(getter_AddRefs(range));
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      rv = range->SelectNode(node);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      nsCOMPtr<nsIInlineSpellChecker> spellChecker;
-      rv = editor->GetInlineSpellChecker(PR_FALSE,
-                                         getter_AddRefs(spellChecker));
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      if (spellChecker) {
-        rv = spellChecker->SpellCheckRange(range);
+        nsCOMPtr<nsIDOMRange> range;
+        rv = NS_NewRange(getter_AddRefs(range));
+        NS_ENSURE_SUCCESS(rv, rv);
+
+        rv = range->SelectNode(node);
         NS_ENSURE_SUCCESS(rv, rv);
+
+        nsCOMPtr<nsIInlineSpellChecker> spellChecker;
+        rv = editor->GetInlineSpellChecker(PR_FALSE,
+                                           getter_AddRefs(spellChecker));
+        NS_ENSURE_SUCCESS(rv, rv);
+
+        if (spellChecker) {
+          rv = spellChecker->SpellCheckRange(range);
+          NS_ENSURE_SUCCESS(rv, rv);
+        }
       }
     }
   }
-  }
 
   return NS_OK;
 }
 
 static void
 NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument,
                           PRBool aEditable)
 {
@@ -3827,19 +3827,19 @@ nsHTMLDocument::TurnEditingOff()
   // turn editing off
   rv = editSession->TearDownEditorOnWindow(window, PR_TRUE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIEditor> editor;
   editorDocShell->GetEditor(getter_AddRefs(editor));
   nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(editor);
   if (editorss) {
-  editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource:/res/contenteditable.css"));
+    editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource:/res/contenteditable.css"));
     if (mEditingState == eDesignMode)
-    editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource:/res/designmode.css"));
+      editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource:/res/designmode.css"));
   }
 
   if (mEditingState == eDesignMode) {
     rv = docshell->SetAllowJavascript(mScriptsEnabled);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = docshell->SetAllowPlugins(mPluginsEnabled);
     NS_ENSURE_SUCCESS(rv, rv);