Added GetBrowserWindow to nsWebCrawler, and changed nsViewerApp to only
call SetBrowserWindow() once and to have CloseWindow() check before setting the web crawler's browser window to NULL (doing so caused a crash)
This commit is contained in:
Родитель
ae131a0fc3
Коммит
c734dd1f9a
|
@ -584,7 +584,12 @@ nsViewerApp::OpenWindow()
|
|||
bw->SetApp(this);
|
||||
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
|
||||
bw->Show();
|
||||
mCrawler->SetBrowserWindow(bw);
|
||||
nsIBrowserWindow* bwCurrent;
|
||||
mCrawler->GetBrowserWindow(&bwCurrent);
|
||||
if (!bwCurrent) {
|
||||
mCrawler->SetBrowserWindow(bw);
|
||||
}
|
||||
NS_IF_RELEASE(bwCurrent);
|
||||
|
||||
if (mDoPurify) {
|
||||
for (PRInt32 i = 0; i < mRepeatCount; i++) {
|
||||
|
@ -617,9 +622,14 @@ nsViewerApp::OpenWindow()
|
|||
NS_IMETHODIMP
|
||||
nsViewerApp::CloseWindow(nsBrowserWindow* aBrowserWindow)
|
||||
{
|
||||
aBrowserWindow->Close();
|
||||
NS_RELEASE(aBrowserWindow);
|
||||
mCrawler->SetBrowserWindow(nsnull);
|
||||
aBrowserWindow->Close();
|
||||
nsIBrowserWindow* bw;
|
||||
mCrawler->GetBrowserWindow(&bw);
|
||||
if (bw == aBrowserWindow) {
|
||||
mCrawler->SetBrowserWindow(nsnull);
|
||||
}
|
||||
NS_IF_RELEASE(bw);
|
||||
NS_RELEASE(aBrowserWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -662,6 +662,13 @@ nsWebCrawler::SetBrowserWindow(nsIBrowserWindow* aWindow)
|
|||
NS_IF_ADDREF(mBrowser);
|
||||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::GetBrowserWindow(nsIBrowserWindow** aWindow)
|
||||
{
|
||||
NS_IF_ADDREF(mBrowser);
|
||||
*aWindow = mBrowser;
|
||||
}
|
||||
|
||||
static void
|
||||
TimerCallBack(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
void AddAvoidDomain(const nsString& aDomain);
|
||||
|
||||
void SetBrowserWindow(nsIBrowserWindow* aWindow);
|
||||
void GetBrowserWindow(nsIBrowserWindow** aWindow);
|
||||
|
||||
// Set the delay (by default, the timer is set to one second)
|
||||
void SetDelay(PRInt32 aSeconds) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче