зеркало из https://github.com/mozilla/gecko-dev.git
Bug 429172. Return the docshell's script global object as soon as the document's content viewer has been Closed(). r+sr=sicking,a=beltzner
This commit is contained in:
Родитель
d77bc4044c
Коммит
979dbc9b21
|
@ -97,8 +97,8 @@ class nsFrameLoader;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xaa79d9ba, 0x73a3, 0x42af, \
|
||||
{ 0xad, 0xb0, 0x3a, 0x57, 0xe1, 0x8d, 0xa8, 0xa2 } }
|
||||
{ 0x680f5dac, 0x8863, 0x4c80, \
|
||||
{ 0xbb, 0xe4, 0x21, 0x35, 0xbd, 0x8f, 0x83, 0x9a } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -789,7 +789,13 @@ public:
|
|||
*/
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
virtual void SaveState() = 0;
|
||||
/**
|
||||
* Notify the document that its associated ContentViewer is no longer
|
||||
* the current viewer for the docshell. The document might still
|
||||
* be rendered in "zombie state" until the next document is ready.
|
||||
* The document should save form control state.
|
||||
*/
|
||||
virtual void RemovedFromDocShell() = 0;
|
||||
|
||||
/**
|
||||
* Get the layout history state that should be used to save and restore state
|
||||
|
|
|
@ -2553,7 +2553,10 @@ nsDocument::GetScriptGlobalObject() const
|
|||
// ScriptGlobalObject. We can, however, try to obtain it for the
|
||||
// caller through our docshell.
|
||||
|
||||
if (mIsGoingAway) {
|
||||
// We actually need to start returning the docshell's script global
|
||||
// object as soon as nsDocumentViewer::Close has called
|
||||
// RemovedFromDocShell on us.
|
||||
if (mRemovedFromDocShell) {
|
||||
nsCOMPtr<nsIInterfaceRequestor> requestor =
|
||||
do_QueryReferent(mDocumentContainer);
|
||||
if (requestor) {
|
||||
|
@ -5580,7 +5583,7 @@ nsDocument::Destroy()
|
|||
|
||||
mIsGoingAway = PR_TRUE;
|
||||
|
||||
SaveState();
|
||||
RemovedFromDocShell();
|
||||
|
||||
PRUint32 i, count = mChildren.ChildCount();
|
||||
for (i = 0; i < count; ++i) {
|
||||
|
@ -5600,12 +5603,12 @@ nsDocument::Destroy()
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::SaveState()
|
||||
nsDocument::RemovedFromDocShell()
|
||||
{
|
||||
if (mSavedState)
|
||||
if (mRemovedFromDocShell)
|
||||
return;
|
||||
|
||||
mSavedState = PR_TRUE;
|
||||
mRemovedFromDocShell = PR_TRUE;
|
||||
|
||||
PRUint32 i, count = mChildren.ChildCount();
|
||||
for (i = 0; i < count; ++i) {
|
||||
|
|
|
@ -631,7 +631,7 @@ public:
|
|||
|
||||
virtual NS_HIDDEN_(PRBool) CanSavePresentation(nsIRequest *aNewRequest);
|
||||
virtual NS_HIDDEN_(void) Destroy();
|
||||
virtual NS_HIDDEN_(void) SaveState();
|
||||
virtual NS_HIDDEN_(void) RemovedFromDocShell();
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsILayoutHistoryState>) GetLayoutHistoryState() const;
|
||||
|
||||
virtual NS_HIDDEN_(void) BlockOnload();
|
||||
|
@ -775,8 +775,10 @@ protected:
|
|||
|
||||
// True if the document has been detached from its content viewer.
|
||||
PRPackedBool mIsGoingAway:1;
|
||||
// True if we've already saved form control state
|
||||
PRPackedBool mSavedState:1;
|
||||
// True if our content viewer has been removed from the docshell
|
||||
// (it may still be displayed, but in zombie state). Form control data
|
||||
// has been saved.
|
||||
PRPackedBool mRemovedFromDocShell:1;
|
||||
// True if the document is being destroyed.
|
||||
PRPackedBool mInDestructor:1;
|
||||
// True if the document "page" is not hidden
|
||||
|
|
|
@ -1319,7 +1319,7 @@ DocumentViewerImpl::Close(nsISHEntry *aSHEntry)
|
|||
mDocument->SetScriptGlobalObject(nsnull);
|
||||
|
||||
if (!mSHEntry)
|
||||
mDocument->SaveState();
|
||||
mDocument->RemovedFromDocShell();
|
||||
}
|
||||
|
||||
if (mFocusListener && mDocument) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче