Bug 1266815 - Part 1. Unnecessary DetachEditorFromWindow call from nsEditingSession. r=masayuki
nsIContent::GetDesiredIMEState sets IMEState::DISABLED, so IME doesn't work well.
Actually, DetachEditorFromWindow is called twice. One is from nsEditingSession::StartDocumentLoad, and another is from nsDocShell::FirePageHideNotification.
When navigating to next, OnStateChange(..., STATE_START) is called. Even if next page is external viewer such as launching another application, STAT_START is called. So even if launching external application, DetachEditorFromWindow is called. So it means that editor is detached from docshell.
nsIContent::GetDesiredIMEState uses nsIEditor, but editor is detached state, so it cannot get nsIEditor.
When navigating to next content on internel viewer such HTML, nsDocShell::CreateContentViewer is called, then FirePageHideNotification is called.
So it is unnecessary to call DetachEditorFromWindow from nsEditorSession. And its call causes this issue.
MozReview-Commit-ID: Lf5Rhzm1PNF
--- a/editor/composer/nsEditingSession.cpp
+++ b/editor/composer/nsEditingSession.cpp
@@ -899,27 +899,16 @@ nsEditingSession::StartDocumentLoad(nsIW
bool aIsToBeMadeEditable)
{
#ifdef NOISY_DOC_LOADING
printf("======= StartDocumentLoad ========\n");
#endif
NS_ENSURE_ARG_POINTER(aWebProgress);
- // If we have an editor here, then we got a reload after making the editor.
- // We need to blow it away and make a new one at the end of the load.
- nsCOMPtr<mozIDOMWindowProxy> domWindow;
- aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
- if (domWindow)
- {
- nsIDocShell *docShell = nsPIDOMWindowOuter::From(domWindow)->GetDocShell();
- NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
- docShell->DetachEditorFromWindow();
- }
-
if (aIsToBeMadeEditable)
mEditorStatus = eEditorCreationInProgress;
return NS_OK;
}
/*---------------------------------------------------------------------------