Fix for bug 388183 (Reloading this testcase causes crash [@

nsHTMLDocument::ChangeContentEditableCount] with null editor). r/sr=jst.
This commit is contained in:
peterv@propagandism.org 2007-07-18 02:44:22 -07:00
Родитель 689c29a2d6
Коммит c7e7da4017
1 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -3762,9 +3762,8 @@ nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditor> editor;
rv = editorDocShell->GetEditor(getter_AddRefs(editor));
NS_ENSURE_SUCCESS(rv, rv);
editorDocShell->GetEditor(getter_AddRefs(editor));
if (editor) {
nsCOMPtr<nsIDOMRange> range;
rv = NS_NewRange(getter_AddRefs(range));
NS_ENSURE_SUCCESS(rv, rv);
@ -3783,6 +3782,7 @@ nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement,
}
}
}
}
return NS_OK;
}
@ -3821,10 +3821,6 @@ nsHTMLDocument::TurnEditingOff()
do_QueryInterface(docshell, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditor> editor;
rv = editorDocShell->GetEditor(getter_AddRefs(editor));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditingSession> editSession = do_GetInterface(docshell, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -3832,13 +3828,16 @@ nsHTMLDocument::TurnEditingOff()
rv = editSession->TearDownEditorOnWindow(window, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(editor, &rv);
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"));
if (mEditingState == eDesignMode) {
if (mEditingState == eDesignMode)
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource:/res/designmode.css"));
}
if (mEditingState == eDesignMode) {
rv = docshell->SetAllowJavascript(mScriptsEnabled);
NS_ENSURE_SUCCESS(rv, rv);
@ -3907,8 +3906,9 @@ nsHTMLDocument::EditingStateChanged()
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEditor> editor;
rv = editorDocShell->GetEditor(getter_AddRefs(editor));
NS_ENSURE_SUCCESS(rv, rv);
editorDocShell->GetEditor(getter_AddRefs(editor));
if (!editor)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(editor, &rv);
NS_ENSURE_SUCCESS(rv, rv);