Fire the EndLoadURL(...) notification after all of the URLs have been loaded by the doc loader...

This commit is contained in:
rpotts%netscape.com 1998-10-01 21:49:50 +00:00
Родитель 0247e6fff4
Коммит 98bab44460
2 изменённых файлов: 82 добавлений и 38 удалений

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

@ -1643,26 +1643,54 @@ nsWebShell::ReleaseScriptContext(nsIScriptContext *aContext)
NS_IMETHODIMP NS_IMETHODIMP
nsWebShell::OnConnectionsComplete() nsWebShell::OnConnectionsComplete()
{ {
nsresult ret = NS_ERROR_FAILURE; nsIDocumentViewer* docViewer;
nsresult rv = NS_ERROR_FAILURE;
if (nsnull != mScriptGlobal) { if (nsnull != mScriptGlobal) {
nsIDocumentViewer *mDocViewer;
if (nsnull != mContentViewer && if (nsnull != mContentViewer &&
NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&mDocViewer)) { NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer)) {
nsIPresContext *mPresContext; nsIPresContext *presContext;
if (NS_OK == mDocViewer->GetPresContext(mPresContext)) { if (NS_OK == docViewer->GetPresContext(presContext)) {
nsEventStatus mStatus = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent mEvent; nsMouseEvent event;
mEvent.eventStructType = NS_EVENT; event.eventStructType = NS_EVENT;
mEvent.message = NS_PAGE_LOAD; event.message = NS_PAGE_LOAD;
ret = mScriptGlobal->HandleDOMEvent(*mPresContext, &mEvent, nsnull, DOM_EVENT_INIT, mStatus); rv = mScriptGlobal->HandleDOMEvent(*presContext, &event, nsnull, DOM_EVENT_INIT, status);
NS_RELEASE(mPresContext); NS_RELEASE(presContext);
} }
NS_RELEASE(mDocViewer); NS_RELEASE(docViewer);
} }
} }
return ret;
/*
*Fire the EndLoadURL(...) notification...
*/
if ((nsnull != mContainer) && (nsnull != mContentViewer)) {
nsIDocument* document;
rv = mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer);
if (NS_SUCCEEDED(rv)) {
rv = docViewer->GetDocument(document);
if (NS_SUCCEEDED(rv)) {
nsAutoString urlString;
nsIURL* url;
url = document->GetDocumentURL();
if (nsnull != url) {
urlString = url->GetSpec();
/* XXX: The load status needs to be passed in... */
rv = mContainer->EndLoadURL(this, urlString, /* XXX */ 0 );
NS_RELEASE(url);
}
NS_RELEASE(document);
}
NS_RELEASE(docViewer);
}
}
return rv;
} }
/* For use with redirect/refresh url api */ /* For use with redirect/refresh url api */
@ -1833,12 +1861,6 @@ nsWebShell::OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg)
if (nsnull != mObserver) { if (nsnull != mObserver) {
rv = mObserver->OnStopBinding(aURL, aStatus, aMsg); rv = mObserver->OnStopBinding(aURL, aStatus, aMsg);
} }
if (nsnull != mContainer) {
nsAutoString urlString(aURL->GetSpec());
rv = mContainer->EndLoadURL(this, urlString, aStatus);
}
return rv; return rv;
} }

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

@ -1643,26 +1643,54 @@ nsWebShell::ReleaseScriptContext(nsIScriptContext *aContext)
NS_IMETHODIMP NS_IMETHODIMP
nsWebShell::OnConnectionsComplete() nsWebShell::OnConnectionsComplete()
{ {
nsresult ret = NS_ERROR_FAILURE; nsIDocumentViewer* docViewer;
nsresult rv = NS_ERROR_FAILURE;
if (nsnull != mScriptGlobal) { if (nsnull != mScriptGlobal) {
nsIDocumentViewer *mDocViewer;
if (nsnull != mContentViewer && if (nsnull != mContentViewer &&
NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&mDocViewer)) { NS_OK == mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer)) {
nsIPresContext *mPresContext; nsIPresContext *presContext;
if (NS_OK == mDocViewer->GetPresContext(mPresContext)) { if (NS_OK == docViewer->GetPresContext(presContext)) {
nsEventStatus mStatus = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent mEvent; nsMouseEvent event;
mEvent.eventStructType = NS_EVENT; event.eventStructType = NS_EVENT;
mEvent.message = NS_PAGE_LOAD; event.message = NS_PAGE_LOAD;
ret = mScriptGlobal->HandleDOMEvent(*mPresContext, &mEvent, nsnull, DOM_EVENT_INIT, mStatus); rv = mScriptGlobal->HandleDOMEvent(*presContext, &event, nsnull, DOM_EVENT_INIT, status);
NS_RELEASE(mPresContext); NS_RELEASE(presContext);
} }
NS_RELEASE(mDocViewer); NS_RELEASE(docViewer);
} }
} }
return ret;
/*
*Fire the EndLoadURL(...) notification...
*/
if ((nsnull != mContainer) && (nsnull != mContentViewer)) {
nsIDocument* document;
rv = mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer);
if (NS_SUCCEEDED(rv)) {
rv = docViewer->GetDocument(document);
if (NS_SUCCEEDED(rv)) {
nsAutoString urlString;
nsIURL* url;
url = document->GetDocumentURL();
if (nsnull != url) {
urlString = url->GetSpec();
/* XXX: The load status needs to be passed in... */
rv = mContainer->EndLoadURL(this, urlString, /* XXX */ 0 );
NS_RELEASE(url);
}
NS_RELEASE(document);
}
NS_RELEASE(docViewer);
}
}
return rv;
} }
/* For use with redirect/refresh url api */ /* For use with redirect/refresh url api */
@ -1833,12 +1861,6 @@ nsWebShell::OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg)
if (nsnull != mObserver) { if (nsnull != mObserver) {
rv = mObserver->OnStopBinding(aURL, aStatus, aMsg); rv = mObserver->OnStopBinding(aURL, aStatus, aMsg);
} }
if (nsnull != mContainer) {
nsAutoString urlString(aURL->GetSpec());
rv = mContainer->EndLoadURL(this, urlString, aStatus);
}
return rv; return rv;
} }