Bug 474389. Fix the 'set up editor after this load' setup, which hasn't really worked for a while, except for initial loads in the window. r+sr=peterv

This commit is contained in:
Boris Zbarsky 2009-01-23 10:16:10 -05:00
Родитель 82c2898aab
Коммит c0c69ccd9b
4 изменённых файлов: 12 добавлений и 15 удалений

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

@ -5502,21 +5502,24 @@ nsDocShell::ReattachEditorToWindow(nsISHEntry *aSHEntry)
}
void
nsDocShell::DetachEditorFromWindow(nsISHEntry *aSHEntry)
nsDocShell::DetachEditorFromWindow()
{
if (!mEditorData)
if (!mEditorData || mEditorData->WaitingForLoad()) {
// If there's nothing to detach, or if the editor data is actually set
// up for the _new_ page that's coming in, don't detach.
return;
}
NS_ASSERTION(!aSHEntry || !aSHEntry->HasDetachedEditor(),
NS_ASSERTION(!mOSHE || !mOSHE->HasDetachedEditor(),
"Detaching editor when it's already detached.");
nsresult res = mEditorData->DetachFromWindow();
NS_ASSERTION(NS_SUCCEEDED(res), "Failed to detach editor");
if (NS_SUCCEEDED(res)) {
// Make aSHEntry hold the owning ref to the editor data.
if (aSHEntry)
aSHEntry->SetEditorData(mEditorData.forget());
// Make mOSHE hold the owning ref to the editor data.
if (mOSHE)
mOSHE->SetEditorData(mEditorData.forget());
else
mEditorData = nsnull;
}
@ -5529,13 +5532,6 @@ nsDocShell::DetachEditorFromWindow(nsISHEntry *aSHEntry)
"Window is still editable after detaching editor.");
}
#endif // DEBUG
}
void
nsDocShell::DetachEditorFromWindow()
{
DetachEditorFromWindow(mOSHE);
}
nsresult

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

@ -554,7 +554,6 @@ protected:
PRBool IsOKToLoadURI(nsIURI* aURI);
void ReattachEditorToWindow(nsISHEntry *aSHEntry);
void DetachEditorFromWindow(nsISHEntry *aSHEntry);
nsresult GetSessionStorageForURI(nsIURI* aURI,
PRBool create,

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

@ -73,6 +73,7 @@ public:
void TearDownEditor();
nsresult DetachFromWindow();
nsresult ReattachToWindow(nsIDocShell *aDocShell);
PRBool WaitingForLoad() const { return mMakeEditable; }
protected:

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

@ -464,7 +464,8 @@ interface nsIDocShell : nsISupports
/**
* Disconnects this docshell's editor from its window, and stores the
* editor data in the open document's session history entry.
* editor data in the open document's session history entry. This
* should be called only during page transitions.
*/
[noscript, notxpcom] void DetachEditorFromWindow();