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

git-svn-id: svn://10.0.0.236/trunk@169863 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.jstenback.com 2005-02-25 18:16:20 +00:00
parent 397d4d4f73
commit ac6af19e15
2 changed files with 16 additions and 6 deletions

View File

@ -95,6 +95,7 @@ nsEditingSession::nsEditingSession()
: mDoneSetup(PR_FALSE)
, mCanCreateEditor(PR_FALSE)
, mScriptsEnabled(PR_TRUE)
, mProgressListenerRegistered(PR_FALSE)
, mImageAnimationMode(0)
, mEditorFlags(0)
, mEditorStatus(eEditorOK)
@ -186,7 +187,7 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
// set the flag on the docShell to say that it's editable
rv = editorDocShell->MakeEditable(aDoAfterUriLoad);
if (NS_FAILED(rv)) return rv;
// Setup commands common to plaintext and html editors,
// including the document creation observers
// the first is an editor controller
@ -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,
(nsIWebProgress::NOTIFY_STATE_NETWORK |
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION));
nsresult rv =
webProgress->AddProgressListener(this,
(nsIWebProgress::NOTIFY_STATE_NETWORK |
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION));
mProgressListenerRegistered = NS_SUCCEEDED(rv);
return rv;
}
/*---------------------------------------------------------------------------

View File

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