зеркало из https://github.com/mozilla/pjs.git
Bug #21358 --> Make sure we only call the on load handler ONCE per document. This prevents a nasty loop if
the onload handler tries to load an ftp url. r=travis a=jar
This commit is contained in:
Родитель
15fa5b3235
Коммит
42800f579b
|
@ -73,7 +73,8 @@ nsDocShell::nsDocShell() :
|
|||
mTreeOwner(nsnull),
|
||||
mChromeEventHandler(nsnull),
|
||||
mCurrentScrollbarPref(-1,-1),
|
||||
mDefaultScrollbarPref(-1,-1)
|
||||
mDefaultScrollbarPref(-1,-1),
|
||||
mEODForCurrentDocument (PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -1893,7 +1894,7 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
|||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(SetupNewViewer(viewer), NS_ERROR_FAILURE);
|
||||
|
||||
mEODForCurrentDocument = PR_FALSE; // clear the current flag
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,6 +199,11 @@ protected:
|
|||
nsPoint mDefaultScrollbarPref; // persistent across doc loads
|
||||
PRBool mUpdateHistoryOnLoad;
|
||||
PRBool mInitialPageLoad;
|
||||
// this flag is for bug #21358. a docshell may load many urls
|
||||
// which don't result in new documents being created (i.e. a new content viewer)
|
||||
// we want to make sure we don't call a on load event more than once for a given
|
||||
// content viewer.
|
||||
PRBool mEODForCurrentDocument;
|
||||
|
||||
/* WEAK REFERENCES BELOW HERE.
|
||||
Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||
|
|
|
@ -2667,7 +2667,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
if (loader == mDocLoader) {
|
||||
mProcessedEndDocumentLoad = PR_TRUE;
|
||||
|
||||
if (mScriptGlobal) {
|
||||
if (mScriptGlobal && !mEODForCurrentDocument) {
|
||||
nsIDocumentViewer* docViewer;
|
||||
if (nsnull != mContentViewer &&
|
||||
NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer)) {
|
||||
|
@ -2685,6 +2685,8 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
}
|
||||
}
|
||||
|
||||
mEODForCurrentDocument = PR_TRUE;
|
||||
|
||||
// Fire the EndLoadURL of the web shell container
|
||||
if (nsnull != aURL) {
|
||||
nsAutoString urlString;
|
||||
|
|
|
@ -2667,7 +2667,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
if (loader == mDocLoader) {
|
||||
mProcessedEndDocumentLoad = PR_TRUE;
|
||||
|
||||
if (mScriptGlobal) {
|
||||
if (mScriptGlobal && !mEODForCurrentDocument) {
|
||||
nsIDocumentViewer* docViewer;
|
||||
if (nsnull != mContentViewer &&
|
||||
NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer)) {
|
||||
|
@ -2685,6 +2685,8 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
}
|
||||
}
|
||||
|
||||
mEODForCurrentDocument = PR_TRUE;
|
||||
|
||||
// Fire the EndLoadURL of the web shell container
|
||||
if (nsnull != aURL) {
|
||||
nsAutoString urlString;
|
||||
|
|
Загрузка…
Ссылка в новой задаче