From c5e8af16d8dad6de73d8c2ebb9b7796d6d45bfd1 Mon Sep 17 00:00:00 2001 From: "joki%netscape.com" Date: Wed, 9 Sep 1998 01:19:11 +0000 Subject: [PATCH] Remove duplicate functionality of nsIBrowserWindow and nsIWebShellContainer. git-svn-id: svn://10.0.0.236/trunk@9586 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 51 +++++++++----- mozilla/dom/src/base/nsGlobalWindow.cpp | 70 +++++++++++-------- .../embed/ActiveX/WebShellContainer.cpp | 24 ------- .../embed/ActiveX/WebShellContainer.h | 3 - mozilla/webshell/public/nsIBrowserWindow.h | 6 +- mozilla/webshell/public/nsIWebShell.h | 9 +-- mozilla/webshell/src/nsWebShell.cpp | 51 +++++++++----- .../webshell/tests/viewer/nsBrowserWindow.cpp | 27 +------ .../webshell/tests/viewer/nsBrowserWindow.h | 5 +- mozilla/webshell/tests/viewer/nsViewerApp.cpp | 8 +-- .../webshell/tests/viewer/nsWebCrawler.cpp | 7 +- 11 files changed, 125 insertions(+), 136 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 487913f98a0..49c9dc22915 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -43,6 +43,7 @@ #include "nsIRefreshUrl.h" #include "nsITimer.h" #include "jsurl.h" +#include "nsIBrowserWindow.h" #include "prlog.h" @@ -182,7 +183,6 @@ public: NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus); - NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec); NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell); // nsILinkHandler @@ -291,6 +291,7 @@ static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_I static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); static NS_DEFINE_IID(kRefreshURLIID, NS_IREFRESHURL_IID); static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID); +static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); // XXX not sure static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID); @@ -1210,10 +1211,22 @@ nsWebShell::SetTitle(const PRUnichar* aTitle) mTitle = aTitle; // Title's set on the top level web-shell are passed ont to the container - if (nsnull == mParent) { - if (nsnull != mContainer) { - mContainer->SetTitle(aTitle); + nsIWebShell *rootWebShell; + + GetRootWebShell(rootWebShell); + + if (nsnull != rootWebShell) { + nsIWebShellContainer *rootContainer; + rootWebShell->GetContainer(rootContainer); + if (nsnull != rootContainer) { + nsIBrowserWindow *browserWindow; + if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow)) { + browserWindow->SetTitle(aTitle); + NS_RELEASE(browserWindow); + } + NS_RELEASE(rootContainer); } + NS_RELEASE(rootWebShell); } return NS_OK; @@ -1271,15 +1284,6 @@ nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStat return NS_OK; } -NS_IMETHODIMP -nsWebShell::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) -{ - if (nsnull != mContainer) { - return mContainer->OverLink(aShell, aURLSpec, aTargetSpec); - } - return NS_OK; -} - NS_IMETHODIMP nsWebShell::NewWebShell(nsIWebShell *&aNewWebShell) { @@ -1455,10 +1459,23 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv mOverURL = aURLSpec; mOverTarget = aTargetSpec; - // XXX: Should the IWebShell being passed out be the target WebShell? - if (nsnull != mContainer) { - mContainer->OverLink(this, aURLSpec, aTargetSpec); - } + // Get the browser window and setStatus + nsIWebShell *rootWebShell; + GetRootWebShell(rootWebShell); + + if (nsnull != rootWebShell) { + nsIWebShellContainer *rootContainer; + rootWebShell->GetContainer(rootContainer); + if (nsnull != rootContainer) { + nsIBrowserWindow *browserWindow; + if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow)) { + browserWindow->SetStatus(aURLSpec); + NS_RELEASE(browserWindow); + } + NS_RELEASE(rootContainer); + } + NS_RELEASE(rootWebShell); + } } return NS_OK; } diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index ae420cf1a0c..3b356e19514 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -1023,52 +1023,61 @@ GlobalWindowImpl::Open(JSContext *cx, mChrome = (PRUint32)~0; } - nsIBrowserWindow *mNewWindow, *mBrowser; - nsIScriptGlobalObject *mNewGlobalObject = nsnull; + nsIBrowserWindow *newWindow = nsnull; + nsIScriptGlobalObject *newGlobalObject = nsnull; + nsIWebShell *newWebShell; + nsIWebShellContainer *webShellContainer, *newContainer; /* XXX check for existing window of same name. If exists, set url and * update chrome */ - - if (NS_OK == GetBrowserWindowInterface(mBrowser)) { - mBrowser->OpenWindow(mChrome, mNewWindow); - mNewWindow->LoadURL(mAbsURL); - //How should we do default size/pos - mNewWindow->SizeTo(mWidth ? mWidth : 620, mHeight ? mHeight : 400); - mNewWindow->MoveTo(mLeft, mTop); - mNewWindow->Show(); + if (NS_OK == mWebShell->GetContainer(webShellContainer)) { + if (NS_OK == webShellContainer->NewWebShell(newWebShell)) { + if (NS_OK == newWebShell->GetContainer(newContainer) && nsnull != newContainer) { + newContainer->QueryInterface(kIBrowserWindowIID, (void**)&newWindow); + NS_RELEASE(newContainer); + } + } + NS_RELEASE(webShellContainer); + } - NS_RELEASE(mBrowser); + if (nsnull != newWindow) { + //How should we do default size/pos + newWindow->SetChrome(mChrome); + newWindow->SizeTo(mWidth ? mWidth : 620, mHeight ? mHeight : 400); + newWindow->MoveTo(mLeft, mTop); + + newWebShell->LoadURL(mAbsURL); + + newWindow->Show(); /* Get win obj */ - nsIWebShell *mNewWebShell = nsnull; - nsIScriptContextOwner *mNewContextOwner = nsnull; + nsIScriptContextOwner *newContextOwner = nsnull; - if (NS_OK != mNewWindow->GetWebShell(mNewWebShell) || - NS_OK != mNewWebShell->QueryInterface(kIScriptContextOwnerIID, (void**)&mNewContextOwner) || - NS_OK != mNewContextOwner->GetScriptGlobalObject(&mNewGlobalObject)) { + if (NS_OK != newWebShell->QueryInterface(kIScriptContextOwnerIID, (void**)&newContextOwner) || + NS_OK != newContextOwner->GetScriptGlobalObject(&newGlobalObject)) { - NS_IF_RELEASE(mNewWindow); - NS_IF_RELEASE(mNewWebShell); - NS_IF_RELEASE(mNewContextOwner); + NS_IF_RELEASE(newWindow); + NS_IF_RELEASE(newWebShell); + NS_IF_RELEASE(newContextOwner); return NS_ERROR_FAILURE; } - mNewWebShell->SetName(mName); + newWebShell->SetName(mName); - NS_RELEASE(mNewWindow); - NS_RELEASE(mNewWebShell); - NS_RELEASE(mNewContextOwner); + NS_RELEASE(newWindow); + NS_RELEASE(newWebShell); + NS_RELEASE(newContextOwner); } - nsIDOMWindow *mNewDOMWindow; - if (nsnull != mNewGlobalObject && NS_OK == mNewGlobalObject->QueryInterface(kIDOMWindowIID, (void**)&mNewDOMWindow)) { - *aReturn = mNewDOMWindow; + nsIDOMWindow *newDOMWindow; + if (nsnull != newGlobalObject && NS_OK == newGlobalObject->QueryInterface(kIDOMWindowIID, (void**)&newDOMWindow)) { + *aReturn = newDOMWindow; } /* Set opener */ - mNewGlobalObject->SetOpenerWindow(this); + newGlobalObject->SetOpenerWindow(this); - NS_IF_RELEASE(mNewGlobalObject); + NS_IF_RELEASE(newGlobalObject); return NS_OK; } @@ -1378,7 +1387,10 @@ GlobalWindowImpl::HandleDOMEvent(nsIPresContext& aPresContext, } //Capturing stage - + /*if (mEventCapturer) { + mEventCapturer->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); + }*/ + //Local handling stage if (nsnull != mListenerManager) { mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, aEventStatus); diff --git a/mozilla/webshell/embed/ActiveX/WebShellContainer.cpp b/mozilla/webshell/embed/ActiveX/WebShellContainer.cpp index d2583f42e27..2460abdf096 100644 --- a/mozilla/webshell/embed/ActiveX/WebShellContainer.cpp +++ b/mozilla/webshell/embed/ActiveX/WebShellContainer.cpp @@ -57,20 +57,6 @@ nsresult CWebShellContainer::QueryInterface(const nsIID& aIID, void** aInstanceP return NS_NOINTERFACE; } -NS_IMETHODIMP -CWebShellContainer::SetTitle(const PRUnichar* aTitle) -{ - m_sTitle = aTitle; - return NS_OK; -} - -NS_IMETHODIMP -CWebShellContainer::GetTitle(PRUnichar** aResult) -{ - *aResult = m_sTitle; - return NS_OK; -} - NS_IMETHODIMP CWebShellContainer::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) { @@ -107,16 +93,6 @@ CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt return NS_OK; } -NS_IMETHODIMP -CWebShellContainer::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) -{ -// if (nsnull != mStatus) -// { -// mStatus->SetText(aURLSpec); -// } - return NS_OK; -} - NS_IMETHODIMP CWebShellContainer::NewWebShell(nsIWebShell *&aNewWebShell) { diff --git a/mozilla/webshell/embed/ActiveX/WebShellContainer.h b/mozilla/webshell/embed/ActiveX/WebShellContainer.h index ef74972135c..2f83855d9e2 100644 --- a/mozilla/webshell/embed/ActiveX/WebShellContainer.h +++ b/mozilla/webshell/embed/ActiveX/WebShellContainer.h @@ -18,13 +18,10 @@ public: NS_DECL_ISUPPORTS // nsIWebShellContainer - NS_IMETHOD SetTitle(const PRUnichar* aTitle); - NS_IMETHOD GetTitle(PRUnichar** aResult); NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason); NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus); - NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec); NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell); }; diff --git a/mozilla/webshell/public/nsIBrowserWindow.h b/mozilla/webshell/public/nsIBrowserWindow.h index 43b19848edf..b1f74aecf2a 100644 --- a/mozilla/webshell/public/nsIBrowserWindow.h +++ b/mozilla/webshell/public/nsIBrowserWindow.h @@ -72,14 +72,10 @@ public: NS_IMETHOD Close() = 0; - NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow) = 0; - - NS_IMETHOD ChangeChrome(PRUint32 aNewChromeMask) = 0; + NS_IMETHOD SetChrome(PRUint32 aNewChromeMask) = 0; NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult) = 0; - NS_IMETHOD LoadURL(const PRUnichar* aURL) = 0; - NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0; NS_IMETHOD GetTitle(PRUnichar** aResult) = 0; diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index b0769dababb..c64d96a9134 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -56,10 +56,6 @@ typedef enum { // Container for web shell's class nsIWebShellContainer : public nsISupports { public: - NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0; - - NS_IMETHOD GetTitle(PRUnichar** aResult) = 0; - // History control NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) = 0; NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) = 0; @@ -68,13 +64,10 @@ public: NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) = 0; NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus) = 0; - NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) = 0; - //instances NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell) = 0; - // Chrome control -// NS_IMETHOD SetHistoryIndex(PRInt32 aIndex, PRInt32 aMaxIndex) = 0; + // NS_IMETHOD SetHistoryIndex(PRInt32 aIndex, PRInt32 aMaxIndex) = 0; // Link traversing control }; diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 487913f98a0..49c9dc22915 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -43,6 +43,7 @@ #include "nsIRefreshUrl.h" #include "nsITimer.h" #include "jsurl.h" +#include "nsIBrowserWindow.h" #include "prlog.h" @@ -182,7 +183,6 @@ public: NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus); - NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec); NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell); // nsILinkHandler @@ -291,6 +291,7 @@ static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_I static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); static NS_DEFINE_IID(kRefreshURLIID, NS_IREFRESHURL_IID); static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID); +static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); // XXX not sure static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID); @@ -1210,10 +1211,22 @@ nsWebShell::SetTitle(const PRUnichar* aTitle) mTitle = aTitle; // Title's set on the top level web-shell are passed ont to the container - if (nsnull == mParent) { - if (nsnull != mContainer) { - mContainer->SetTitle(aTitle); + nsIWebShell *rootWebShell; + + GetRootWebShell(rootWebShell); + + if (nsnull != rootWebShell) { + nsIWebShellContainer *rootContainer; + rootWebShell->GetContainer(rootContainer); + if (nsnull != rootContainer) { + nsIBrowserWindow *browserWindow; + if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow)) { + browserWindow->SetTitle(aTitle); + NS_RELEASE(browserWindow); + } + NS_RELEASE(rootContainer); } + NS_RELEASE(rootWebShell); } return NS_OK; @@ -1271,15 +1284,6 @@ nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStat return NS_OK; } -NS_IMETHODIMP -nsWebShell::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) -{ - if (nsnull != mContainer) { - return mContainer->OverLink(aShell, aURLSpec, aTargetSpec); - } - return NS_OK; -} - NS_IMETHODIMP nsWebShell::NewWebShell(nsIWebShell *&aNewWebShell) { @@ -1455,10 +1459,23 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv mOverURL = aURLSpec; mOverTarget = aTargetSpec; - // XXX: Should the IWebShell being passed out be the target WebShell? - if (nsnull != mContainer) { - mContainer->OverLink(this, aURLSpec, aTargetSpec); - } + // Get the browser window and setStatus + nsIWebShell *rootWebShell; + GetRootWebShell(rootWebShell); + + if (nsnull != rootWebShell) { + nsIWebShellContainer *rootContainer; + rootWebShell->GetContainer(rootContainer); + if (nsnull != rootContainer) { + nsIBrowserWindow *browserWindow; + if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow)) { + browserWindow->SetStatus(aURLSpec); + NS_RELEASE(browserWindow); + } + NS_RELEASE(rootContainer); + } + NS_RELEASE(rootWebShell); + } } return NS_OK; } diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index aab8f1080ef..46bc6767727 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -349,7 +349,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID) url.Append("/test"); url.Append(ix, 10); url.Append(".html"); - LoadURL(url); + mWebShell->LoadURL(url); } break; case JS_CONSOLE: @@ -455,7 +455,7 @@ nsBrowserWindow::DoFileOpen() PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile); // Ask the Web widget to load the file URL - LoadURL(nsString(lpszFileURL)); + mWebShell->LoadURL(nsString(lpszFileURL)); delete lpszFileURL; } } @@ -1072,13 +1072,7 @@ nsBrowserWindow::Close() } NS_IMETHODIMP -nsBrowserWindow::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow) -{ - return mApp->OpenWindow(aNewChromeMask, aNewWindow); -} - -NS_IMETHODIMP -nsBrowserWindow::ChangeChrome(PRUint32 aChromeMask) +nsBrowserWindow::SetChrome(PRUint32 aChromeMask) { // XXX write me mChromeMask = aChromeMask; @@ -1092,12 +1086,6 @@ nsBrowserWindow::GetChrome(PRUint32& aChromeMaskResult) return NS_OK; } -NS_IMETHODIMP -nsBrowserWindow::LoadURL(const PRUnichar* aURL) -{ - return mWebShell->LoadURL(aURL, nsnull); -} - NS_IMETHODIMP nsBrowserWindow::GetWebShell(nsIWebShell*& aResult) { @@ -1175,15 +1163,6 @@ nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 return NS_OK; } -NS_IMETHODIMP -nsBrowserWindow::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) -{ - if (nsnull != mStatus) { - mStatus->SetText(aURLSpec); - } - return NS_OK; -} - NS_IMETHODIMP nsBrowserWindow::NewWebShell(nsIWebShell *&aNewWebShell) { diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.h b/mozilla/webshell/tests/viewer/nsBrowserWindow.h index 6be16cd1686..b1ad7fbfa2b 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.h +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.h @@ -72,10 +72,8 @@ public: NS_IMETHOD Show(); NS_IMETHOD Hide(); NS_IMETHOD Close(); - NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow); - NS_IMETHOD ChangeChrome(PRUint32 aNewChromeMask); + NS_IMETHOD SetChrome(PRUint32 aNewChromeMask); NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult); - NS_IMETHOD LoadURL(const PRUnichar* aURL); NS_IMETHOD SetTitle(const PRUnichar* aTitle); NS_IMETHOD GetTitle(PRUnichar** aResult); NS_IMETHOD SetStatus(const PRUnichar* aStatus); @@ -93,7 +91,6 @@ public: NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus); - NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec); NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell); // nsINetSupport diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index 12233325fb1..5c81243e6bb 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -434,7 +434,7 @@ nsViewerApp::OpenWindow() mCrawler->Start(); } else { - bw->LoadURL(mStartURL); + bw->GoTo(mStartURL); } return NS_OK; @@ -977,7 +977,7 @@ nsEventStatus PR_CALLBACK HandleSiteEvent(nsGUIEvent *aEvent) if (gWinData) { nsString urlStr(gTop100List[--gTop100Pointer]); mSiteLabel->SetLabel(urlStr); - gWinData->LoadURL(urlStr); + gWinData->GoTo(urlStr); } } else { mSitePrevBtn->Enable(PR_FALSE); @@ -991,7 +991,7 @@ nsEventStatus PR_CALLBACK HandleSiteEvent(nsGUIEvent *aEvent) if (gWinData) { nsString urlStr(gTop100List[gTop100Pointer]); mSiteLabel->SetLabel(urlStr); - gWinData->LoadURL(urlStr); + gWinData->GoTo(urlStr); } mSitePrevBtn->Enable(PR_TRUE); } else { @@ -1126,7 +1126,7 @@ PRBool CreateSiteDialog(nsIWidget * aParent) mSitePrevBtn->Enable(PR_FALSE); if (gWinData) { nsString urlStr(gTop100List[gTop100Pointer]); - gWinData->LoadURL(urlStr); + gWinData->GoTo(urlStr); mSiteLabel->SetLabel(urlStr); } diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index a4876a14a1a..fedf80f0652 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -590,7 +590,12 @@ nsWebCrawler::LoadNextURL() mPendingURLs.RemoveElementAt(0); if (OkToLoad(*url)) { RecordLoadedURL(*url); - mBrowser->LoadURL(*url); + + nsIWebShell* webShell; + mBrowser->GetWebShell(webShell); + webShell->LoadURL(*url); + NS_RELEASE(webShell); + if (mMaxPages > 0) { --mMaxPages; }