Fixing more of bug 283612. Make it possible to re-initialize the editor again, even when not used through midas. Regression from bug 209020. r=brade@comcast.net, sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2005-02-25 18:16:20 +00:00
Родитель 0c3d48cbf0
Коммит 76e0723cdc
2 изменённых файлов: 16 добавлений и 6 удалений

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

@ -95,6 +95,7 @@ nsEditingSession::nsEditingSession()
: mDoneSetup(PR_FALSE)
, mCanCreateEditor(PR_FALSE)
, mScriptsEnabled(PR_TRUE)
, mProgressListenerRegistered(PR_FALSE)
, mImageAnimationMode(0)
, mEditorFlags(0)
, mEditorStatus(eEditorOK)
@ -511,6 +512,8 @@ nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow)
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
if (webProgress) {
webProgress->RemoveProgressListener(this);
mProgressListenerRegistered = PR_FALSE;
}
}
@ -1215,7 +1218,7 @@ nsEditingSession::GetEditorDocShellFromWindow(nsIDOMWindow *aWindow,
nsresult
nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow)
{
if (mDoneSetup)
if (mDoneSetup || mProgressListenerRegistered)
return NS_OK;
mDoneSetup = PR_TRUE;
@ -1226,10 +1229,15 @@ nsEditingSession::PrepareForEditing(nsIDOMWindow *aWindow)
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
if (!webProgress) return NS_ERROR_FAILURE;
return webProgress->AddProgressListener(this,
nsresult rv =
webProgress->AddProgressListener(this,
(nsIWebProgress::NOTIFY_STATE_NETWORK |
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION));
mProgressListenerRegistered = NS_SUCCEEDED(rv);
return rv;
}
/*---------------------------------------------------------------------------

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

@ -141,6 +141,8 @@ protected:
// off, otherwise false.
PRPackedBool mScriptsEnabled;
PRPackedBool mProgressListenerRegistered;
// The image animation mode before it was turned off.
PRUint16 mImageAnimationMode;