Removing IsModal,ShowModal,ExitModalLoop methods from nsIDocShellTreeOwner. General API cleanup. bug 70481 r=ccarlen,hyatt,vidur

This commit is contained in:
danm%netscape.com 2006-04-20 03:37:11 +00:00
Родитель 1dcea04d7c
Коммит 846b77f4e4
2 изменённых файлов: 25 добавлений и 16 удалений

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

@ -52,7 +52,9 @@
#include "nsIScriptGlobalObject.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIEventQueueService.h"
#include "nsIInterfaceRequestor.h"
#endif
static const char* kLoadAsData = "loadAsData";
@ -275,8 +277,8 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
Abort();
}
#ifdef IMPLEMENT_SYNC_LOAD
if (mDocShellTreeOwner) {
mDocShellTreeOwner->ExitModalLoop(NS_OK);
if (mChromeWindow) {
mChromeWindow->ExitModalEventLoop(NS_OK);
}
#endif
}
@ -1242,9 +1244,16 @@ nsXMLHttpRequest::Send(nsISupports *body)
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(docshell);
if (!item) return NS_ERROR_FAILURE;
rv = item->GetTreeOwner(getter_AddRefs(mDocShellTreeOwner));
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
rv = item->GetTreeOwner(getter_AddRefs(treeOwner));
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
nsCOMPtr<nsIInterfaceRequestor> treeRequestor(do_GetInterface(treeOwner));
if (!treeRequestor) return NS_ERROR_FAILURE;
treeRequestor->GetInterface(NS_GET_IID(nsIWebBrowserChrome), getter_AddRefs(mChromeWindow));
if (!mChromeWindow) return NS_ERROR_FAILURE;
eventQService = do_GetService(kEventQueueServiceCID);
if(!eventQService ||
NS_FAILED(eventQService->PushThreadEventQueue(getter_AddRefs(modalEventQueue)))) {
@ -1288,8 +1297,8 @@ nsXMLHttpRequest::Send(nsISupports *body)
#ifdef IMPLEMENT_SYNC_LOAD
// If we're synchronous, spin an event loop here and wait
if (!mAsync && mDocShellTreeOwner) {
rv = mDocShellTreeOwner->ShowModal();
if (!mAsync && mChromeWindow) {
rv = mChromeWindow->ShowAsModal();
eventQService->PopThreadEventQueue(modalEventQueue);
@ -1326,9 +1335,9 @@ nsXMLHttpRequest::Load(nsIDOMEvent* aEvent)
{
mStatus = XML_HTTP_REQUEST_COMPLETED;
#ifdef IMPLEMENT_SYNC_LOAD
if (mDocShellTreeOwner) {
mDocShellTreeOwner->ExitModalLoop(NS_OK);
mDocShellTreeOwner = 0;
if (mChromeWindow) {
mChromeWindow->ExitModalEventLoop(NS_OK);
mChromeWindow = 0;
}
#endif
if (mLoadEventListeners) {
@ -1360,9 +1369,9 @@ nsXMLHttpRequest::Abort(nsIDOMEvent* aEvent)
{
mStatus = XML_HTTP_REQUEST_ABORTED;
#ifdef IMPLEMENT_SYNC_LOAD
if (mDocShellTreeOwner) {
mDocShellTreeOwner->ExitModalLoop(NS_OK);
mDocShellTreeOwner = 0;
if (mChromeWindow) {
mChromeWindow->ExitModalEventLoop(NS_OK);
mChromeWindow = 0;
}
#endif
@ -1374,9 +1383,9 @@ nsXMLHttpRequest::Error(nsIDOMEvent* aEvent)
{
mStatus = XML_HTTP_REQUEST_ABORTED;
#ifdef IMPLEMENT_SYNC_LOAD
if (mDocShellTreeOwner) {
mDocShellTreeOwner->ExitModalLoop(NS_OK);
mDocShellTreeOwner = 0;
if (mChromeWindow) {
mChromeWindow->ExitModalEventLoop(NS_OK);
mChromeWindow = 0;
}
#endif
if (mErrorEventListeners) {

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

@ -37,7 +37,7 @@
#include "nsIDocument.h"
#include "nsIStreamListener.h"
#ifdef IMPLEMENT_SYNC_LOAD
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserChrome.h"
#endif
#include "nsWeakReference.h"
#include "nsISupportsArray.h"
@ -101,7 +101,7 @@ protected:
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIDocument> mBaseDocument;
#ifdef IMPLEMENT_SYNC_LOAD
nsCOMPtr<nsIDocShellTreeOwner> mDocShellTreeOwner;
nsCOMPtr<nsIWebBrowserChrome> mChromeWindow;
#endif
nsCOMPtr<nsISupportsArray> mLoadEventListeners;
nsCOMPtr<nsISupportsArray> mErrorEventListeners;