Fixes to make the automated document loader work again...

This commit is contained in:
rpotts 1998-07-02 23:39:38 +00:00
parent 88c65ac5b7
commit 104c6a4b05
3 changed files with 24 additions and 10 deletions

View File

@ -21,11 +21,15 @@
#include "nsITimerCallback.h"
#include "nsVoidArray.h"
#include "plstr.h"
#include "nsIWebWidget.h"
#include "nsRepository.h"
#include "nsIDocumentLoader.h"
#include "resources.h"
#include "nsString.h"
#include "nsViewer.h"
static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID);
static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID);
/*
This class loads creates and loads URLs until finished.
When the doc counter reaches zero, the DocLoader (optionally)
@ -33,17 +37,18 @@
*/
nsDocLoader::nsDocLoader(nsIWebWidget* aWebWidget, nsViewer* aViewer, PRInt32 aSeconds, PRBool aPostExit)
nsDocLoader::nsDocLoader(nsIViewerContainer* aContainer, nsViewer* aViewer, PRInt32 aSeconds, PRBool aPostExit)
{
mStart = PR_FALSE;
mDelay = aSeconds;
mPostExit = aPostExit;
mDocNum = 0;
mWebWidget = aWebWidget;
mContainer = aContainer;
mViewer = aViewer;
mTimers = new nsVoidArray();
mURLList = new nsVoidArray();
NSRepository::CreateInstance(kCDocumentLoaderCID, nsnull, kIDocumentLoaderIID, (void**)&mDocLoader);
}
nsDocLoader::~nsDocLoader()
@ -66,6 +71,7 @@ nsDocLoader::~nsDocLoader()
mTimers = nsnull;
}
NS_RELEASE(mDocLoader);
}
// Set the delay (by default, the timer is set to one second)
@ -196,7 +202,13 @@ void nsDocLoader::DoAction(PRInt32 aDocNum)
{
nsString* url = (nsString*)mURLList->ElementAt(aDocNum);
if (url)
mWebWidget->LoadURL(*url, nsnull);
/// mWebWidget->LoadURL(*url, nsnull);
mDocLoader->LoadURL(*url, // URL string
nsnull, // Command
mContainer, // Container
nsnull, // Post Data
nsnull, // Extra Info...
nsnull); // Observer
}
}

View File

@ -22,7 +22,8 @@
#include "nsISupports.h"
class nsIWebWidget;
class nsIViewerContainer;
class nsIDocumentLoader;
class nsITimer;
class nsVoidArray;
class nsString;
@ -37,7 +38,7 @@ class nsViewer;
class nsDocLoader
{
public:
nsDocLoader(nsIWebWidget* aWebWidget, nsViewer* aViewer, PRInt32 aSeconds=1, PRBool aPostExit=PR_TRUE);
nsDocLoader(nsIViewerContainer* aContainer, nsViewer* aViewer, PRInt32 aSeconds=1, PRBool aPostExit=PR_TRUE);
virtual ~nsDocLoader();
// Add a URL to the doc loader
@ -84,7 +85,8 @@ class nsDocLoader
PRBool mStart;
PRInt32 mDelay;
PRBool mPostExit;
nsIWebWidget* mWebWidget;
nsIViewerContainer* mContainer;
nsIDocumentLoader* mDocLoader;
nsViewer* mViewer;
nsVoidArray* mURLList;

View File

@ -1229,7 +1229,7 @@ nsDocLoader* nsViewer::SetupViewer(nsIWidget **aMainWindow, int argc, char **arg
// Determine if we should run the purify test
nsDocLoader* dl = nsnull;
if (gDoPurify) {
dl = new nsDocLoader(wd->observer->mWebWidget, this, gDelay);
dl = new nsDocLoader(wd->observer, this, gDelay);
// Add the documents to the loader
for (PRInt32 i=0; i<gRepeatCount; i++)
@ -1239,7 +1239,7 @@ nsDocLoader* nsViewer::SetupViewer(nsIWidget **aMainWindow, int argc, char **arg
dl->StartTimedLoading();
}
else if (gLoadTestFromFile) {
dl = new nsDocLoader(wd->observer->mWebWidget, this, gDelay);
dl = new nsDocLoader(wd->observer, this, gDelay);
for (PRInt32 i=0; i<gRepeatCount; i++)
AddTestDocsFromFile(dl, gInputFileName);
dl->StartTimedLoading();