1998-05-14 05:08:06 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-09-26 04:40:45 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-05-14 05:08:06 +04:00
|
|
|
*
|
2001-09-26 04:40:45 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-05-14 05:08:06 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-26 04:40:45 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-26 04:40:45 +04:00
|
|
|
* Contributor(s):
|
2000-01-11 23:49:15 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
2001-09-26 04:40:45 +04:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-05-14 05:08:06 +04:00
|
|
|
#include "nsIRobotSink.h"
|
|
|
|
#include "nsIRobotSinkObserver.h"
|
|
|
|
#include "nsIParser.h"
|
2000-03-29 10:13:07 +04:00
|
|
|
#include "nsIDocShell.h"
|
2001-05-05 00:15:38 +04:00
|
|
|
#include "nsIWebNavigation.h"
|
|
|
|
#include "nsIWebProgress.h"
|
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsWeakReference.h"
|
1998-05-14 05:08:06 +04:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
#include "nsString.h"
|
2001-09-29 12:28:41 +04:00
|
|
|
#include "nsReadableUtils.h"
|
1998-05-14 05:08:06 +04:00
|
|
|
#include "nsIURL.h"
|
1999-06-18 21:34:08 +04:00
|
|
|
#include "nsIServiceManager.h"
|
1999-06-23 07:29:44 +04:00
|
|
|
#include "nsIURL.h"
|
1999-06-18 21:34:08 +04:00
|
|
|
#include "nsIIOService.h"
|
2001-04-10 10:01:08 +04:00
|
|
|
#include "nsNetCID.h"
|
1999-03-09 12:44:27 +03:00
|
|
|
#include "nsIComponentManager.h"
|
1998-07-31 02:42:27 +04:00
|
|
|
#include "nsParserCIID.h"
|
2001-05-05 00:15:38 +04:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
1998-05-14 05:08:06 +04:00
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
1998-05-14 05:08:06 +04:00
|
|
|
|
|
|
|
class RobotSinkObserver : public nsIRobotSinkObserver {
|
|
|
|
public:
|
|
|
|
RobotSinkObserver() {
|
2002-09-07 21:13:19 +04:00
|
|
|
NS_INIT_ISUPPORTS();
|
1998-05-14 05:08:06 +04:00
|
|
|
}
|
|
|
|
|
1999-05-13 06:25:13 +04:00
|
|
|
virtual ~RobotSinkObserver() {
|
1998-05-14 05:08:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD ProcessLink(const nsString& aURLSpec);
|
1998-05-19 23:06:59 +04:00
|
|
|
NS_IMETHOD VerifyDirectory (const char * verify_dir);
|
1998-05-15 01:47:33 +04:00
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
};
|
|
|
|
|
1998-05-15 01:47:33 +04:00
|
|
|
static nsVoidArray * g_workList;
|
|
|
|
static nsVoidArray * g_duplicateList;
|
|
|
|
static int g_iProcessed;
|
|
|
|
static int g_iMaxProcess = 5000;
|
|
|
|
static PRBool g_bHitTop;
|
1998-05-28 04:21:34 +04:00
|
|
|
static PRBool g_bReadyForNextUrl;
|
1998-05-15 01:47:33 +04:00
|
|
|
|
2001-08-21 05:48:11 +04:00
|
|
|
NS_IMPL_ISUPPORTS1(RobotSinkObserver, nsIRobotSinkObserver)
|
1998-05-14 05:08:06 +04:00
|
|
|
|
1998-05-19 23:06:59 +04:00
|
|
|
NS_IMETHODIMP RobotSinkObserver::VerifyDirectory(const char * verify_dir)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|
|
|
{
|
1998-05-15 01:47:33 +04:00
|
|
|
if (!g_bHitTop) {
|
|
|
|
|
1998-06-04 05:19:25 +04:00
|
|
|
nsAutoString str;
|
1998-06-12 05:35:36 +04:00
|
|
|
// Geez this is ugly. temporary hack to only process html files
|
1998-06-04 05:19:25 +04:00
|
|
|
str.Truncate();
|
|
|
|
nsString(aURLSpec).Right(str,1);
|
2001-12-16 14:58:03 +03:00
|
|
|
if (!str.Equals(NS_LITERAL_STRING("/")))
|
1998-06-04 05:19:25 +04:00
|
|
|
{
|
|
|
|
str.Truncate();
|
|
|
|
nsString(aURLSpec).Right(str,4);
|
2001-12-16 14:58:03 +03:00
|
|
|
if (!str.Equals(NS_LITERAL_STRING("html")))
|
1998-06-04 05:19:25 +04:00
|
|
|
{
|
|
|
|
str.Truncate();
|
|
|
|
nsString(aURLSpec).Right(str,3);
|
2001-12-16 14:58:03 +03:00
|
|
|
if (!str.Equals(NS_LITERAL_STRING("htm")))
|
1998-06-04 05:19:25 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
1998-05-15 01:47:33 +04:00
|
|
|
PRInt32 nCount = g_duplicateList->Count();
|
|
|
|
if (nCount > 0)
|
|
|
|
{
|
2002-09-04 02:23:22 +04:00
|
|
|
for (PRInt32 n = 0; n < nCount; ++n)
|
1998-05-15 01:47:33 +04:00
|
|
|
{
|
|
|
|
nsString * pstr = (nsString *)g_duplicateList->ElementAt(n);
|
|
|
|
if (pstr->Equals(aURLSpec)) {
|
1998-06-12 05:35:36 +04:00
|
|
|
fputs ("Robot: (duplicate '",stdout);
|
2001-10-16 07:53:44 +04:00
|
|
|
fputs (NS_LossyConvertUCS2toASCII(aURLSpec).get(),stdout);
|
1998-05-15 01:47:33 +04:00
|
|
|
fputs ("')\n",stdout);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_duplicateList->AppendElement(new nsString(aURLSpec));
|
|
|
|
str.Truncate();
|
|
|
|
nsString(aURLSpec).Left(str,5);
|
2001-12-16 14:58:03 +03:00
|
|
|
if (str.Equals(NS_LITERAL_STRING("http:"))) {
|
2002-09-04 02:23:22 +04:00
|
|
|
++g_iProcessed;
|
1998-06-12 05:35:36 +04:00
|
|
|
if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
|
1998-05-15 01:47:33 +04:00
|
|
|
g_bHitTop = PR_TRUE;
|
|
|
|
g_workList->AppendElement(new nsString(aURLSpec));
|
|
|
|
}
|
|
|
|
else {
|
1998-06-12 05:35:36 +04:00
|
|
|
fputs ("Robot: (cannot process URL types '",stdout);
|
2001-10-16 07:53:44 +04:00
|
|
|
fputs (NS_LossyConvertUCS2toASCII(aURLSpec).get(),stdout);
|
1998-05-15 01:47:33 +04:00
|
|
|
fputs ("')\n",stdout);
|
|
|
|
}
|
|
|
|
}
|
1998-05-14 05:08:06 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-05-19 23:06:59 +04:00
|
|
|
extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir);
|
1998-05-14 05:08:06 +04:00
|
|
|
|
2001-05-05 00:15:38 +04:00
|
|
|
class CStreamListener: public nsIWebProgressListener,
|
|
|
|
public nsSupportsWeakReference
|
1998-06-04 05:19:25 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CStreamListener() {
|
2002-09-07 21:13:19 +04:00
|
|
|
NS_INIT_ISUPPORTS();
|
1998-07-01 15:11:44 +04:00
|
|
|
|
1998-06-04 05:19:25 +04:00
|
|
|
}
|
|
|
|
|
1999-05-13 06:25:13 +04:00
|
|
|
virtual ~CStreamListener() {
|
1998-06-04 05:19:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2001-05-05 00:15:38 +04:00
|
|
|
// nsIWebProgressListener
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
1998-06-04 05:19:25 +04:00
|
|
|
};
|
|
|
|
|
2001-05-05 00:15:38 +04:00
|
|
|
// nsIWebProgressListener implementation
|
1999-10-05 08:04:16 +04:00
|
|
|
NS_IMETHODIMP
|
2001-05-05 00:15:38 +04:00
|
|
|
CStreamListener::OnStateChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
2002-05-17 00:57:37 +04:00
|
|
|
PRUint32 progressStateFlags,
|
|
|
|
nsresult aStatus)
|
|
|
|
{
|
2001-05-05 00:15:38 +04:00
|
|
|
if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT)
|
|
|
|
if (progressStateFlags & nsIWebProgressListener::STATE_STOP) {
|
|
|
|
fputs("done.\n",stdout);
|
|
|
|
g_bReadyForNextUrl = PR_TRUE;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
1999-09-16 05:16:22 +04:00
|
|
|
}
|
|
|
|
|
1999-10-05 08:04:16 +04:00
|
|
|
NS_IMETHODIMP
|
2001-05-05 00:15:38 +04:00
|
|
|
CStreamListener::OnProgressChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
PRInt32 aCurSelfProgress,
|
|
|
|
PRInt32 aMaxSelfProgress,
|
|
|
|
PRInt32 aCurTotalProgress,
|
2002-05-17 00:57:37 +04:00
|
|
|
PRInt32 aMaxTotalProgress)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
|
|
|
return NS_OK;
|
1999-10-05 08:04:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-05-05 00:15:38 +04:00
|
|
|
CStreamListener::OnLocationChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
2002-05-17 00:57:37 +04:00
|
|
|
nsIURI *location)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
|
|
|
return NS_OK;
|
1999-10-05 08:04:16 +04:00
|
|
|
}
|
|
|
|
|
1998-06-04 05:19:25 +04:00
|
|
|
|
1999-10-05 08:04:16 +04:00
|
|
|
NS_IMETHODIMP
|
2001-05-05 00:15:38 +04:00
|
|
|
CStreamListener::OnStatusChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
|
|
|
nsresult aStatus,
|
2002-05-17 00:57:37 +04:00
|
|
|
const PRUnichar* aMessage)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
|
|
|
return NS_OK;
|
1999-10-05 08:04:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-05 00:15:38 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
CStreamListener::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
2002-05-17 00:57:37 +04:00
|
|
|
PRUint32 state)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
|
|
|
return NS_OK;
|
1998-06-04 05:19:25 +04:00
|
|
|
}
|
|
|
|
|
2001-05-05 00:15:38 +04:00
|
|
|
NS_IMPL_ISUPPORTS2(CStreamListener,
|
|
|
|
nsIWebProgressListener,
|
|
|
|
nsISupportsWeakReference)
|
1998-06-04 05:19:25 +04:00
|
|
|
|
1998-06-12 05:35:36 +04:00
|
|
|
extern "C" NS_EXPORT void DumpVectorRecord(void);
|
1998-05-19 23:06:59 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
extern "C" NS_EXPORT int DebugRobot(
|
|
|
|
nsVoidArray * workList,
|
2000-03-29 10:13:07 +04:00
|
|
|
nsIDocShell * docShell,
|
1998-05-19 23:06:59 +04:00
|
|
|
int iMaxLoads,
|
|
|
|
char * verify_dir,
|
|
|
|
void (*yieldProc )(const char *)
|
|
|
|
)
|
1998-05-14 05:08:06 +04:00
|
|
|
{
|
1998-06-12 05:35:36 +04:00
|
|
|
int iCount = 1;
|
1998-06-04 05:19:25 +04:00
|
|
|
CStreamListener * pl = new CStreamListener;
|
|
|
|
NS_ADDREF(pl);
|
1998-07-01 15:11:44 +04:00
|
|
|
|
1998-05-15 01:47:33 +04:00
|
|
|
if (nsnull==workList)
|
|
|
|
return -1;
|
1998-05-19 23:06:59 +04:00
|
|
|
g_iMaxProcess = iMaxLoads;
|
1998-05-15 01:47:33 +04:00
|
|
|
g_iProcessed = 0;
|
|
|
|
g_bHitTop = PR_FALSE;
|
|
|
|
g_duplicateList = new nsVoidArray();
|
1998-05-14 05:08:06 +04:00
|
|
|
RobotSinkObserver* myObserver = new RobotSinkObserver();
|
|
|
|
NS_ADDREF(myObserver);
|
1998-05-15 01:47:33 +04:00
|
|
|
g_workList = workList;
|
1998-05-14 05:08:06 +04:00
|
|
|
|
1998-07-30 03:43:20 +04:00
|
|
|
/*
|
1998-06-25 05:42:50 +04:00
|
|
|
nsIDTDDebug * pIDTDDebug;
|
|
|
|
nsresult rval = NS_NewDTDDebug(&pIDTDDebug);
|
1998-06-19 03:26:55 +04:00
|
|
|
if (NS_OK != rval) {
|
|
|
|
fputs("Cannot create parser debugger.\n", stdout);
|
|
|
|
NS_RELEASE(myObserver);
|
|
|
|
return -1;
|
|
|
|
}
|
1998-06-25 05:42:50 +04:00
|
|
|
pIDTDDebug->SetVerificationDirectory(verify_dir);
|
1998-07-30 03:43:20 +04:00
|
|
|
*/
|
1998-06-19 03:26:55 +04:00
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
for (;;) {
|
1998-05-15 01:47:33 +04:00
|
|
|
PRInt32 n = g_workList->Count();
|
1998-05-14 05:08:06 +04:00
|
|
|
if (0 == n) {
|
|
|
|
break;
|
|
|
|
}
|
1998-05-15 01:47:33 +04:00
|
|
|
nsString* urlName = (nsString*) g_workList->ElementAt(n - 1);
|
|
|
|
g_workList->RemoveElementAt(n - 1);
|
1998-05-14 05:08:06 +04:00
|
|
|
|
|
|
|
// Create url
|
1999-06-23 07:29:44 +04:00
|
|
|
nsIURI* url;
|
1999-06-18 21:34:08 +04:00
|
|
|
nsresult rv;
|
2001-07-25 11:54:28 +04:00
|
|
|
nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID, &rv));
|
1999-06-18 21:34:08 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
nsIURI *uri = nsnull;
|
2002-03-06 10:48:55 +03:00
|
|
|
NS_ConvertUCS2toUTF8 uriStr(*urlName);
|
|
|
|
rv = service->NewURI(uriStr, nsnull, nsnull, &uri);
|
1999-06-18 21:34:08 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2000-01-11 23:49:15 +03:00
|
|
|
rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
|
1999-06-18 21:34:08 +04:00
|
|
|
NS_RELEASE(uri);
|
1998-05-14 05:08:06 +04:00
|
|
|
if (NS_OK != rv) {
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("invalid URL: '");
|
2002-03-06 10:48:55 +03:00
|
|
|
fputs(uriStr.get(), stdout);
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("'\n");
|
1998-06-19 03:26:55 +04:00
|
|
|
NS_RELEASE(myObserver);
|
1998-05-14 05:08:06 +04:00
|
|
|
return -1;
|
|
|
|
}
|
1998-06-12 05:35:36 +04:00
|
|
|
|
|
|
|
char str_num[25];
|
|
|
|
sprintf (str_num,"%d",iCount++);
|
|
|
|
fputs ("Robot: parsing(",stdout);
|
|
|
|
fputs (str_num,stdout);
|
|
|
|
fputs (") ",stdout);
|
2001-10-16 07:53:44 +04:00
|
|
|
fputs (NS_LossyConvertUCS2toASCII(*urlName).get(),stdout);
|
1998-06-12 05:35:36 +04:00
|
|
|
fputs ("...",stdout);
|
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
delete urlName;
|
|
|
|
|
|
|
|
nsIParser* parser;
|
1998-07-31 02:42:27 +04:00
|
|
|
|
|
|
|
static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
|
2001-03-11 00:02:12 +03:00
|
|
|
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
1998-07-31 02:42:27 +04:00
|
|
|
|
1999-03-09 12:44:27 +03:00
|
|
|
rv = nsComponentManager::CreateInstance(kCParserCID,
|
1998-07-31 02:42:27 +04:00
|
|
|
nsnull,
|
|
|
|
kCParserIID,
|
|
|
|
(void **)&parser);
|
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
if (NS_OK != rv) {
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("can't make parser\n");
|
1998-06-19 03:26:55 +04:00
|
|
|
NS_RELEASE(myObserver);
|
1998-05-14 05:08:06 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIRobotSink* sink;
|
|
|
|
rv = NS_NewRobotSink(&sink);
|
|
|
|
if (NS_OK != rv) {
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("can't make parser\n");
|
1998-06-19 03:26:55 +04:00
|
|
|
NS_RELEASE(myObserver);
|
1998-05-14 05:08:06 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
sink->Init(url);
|
|
|
|
sink->AddObserver(myObserver);
|
|
|
|
|
|
|
|
parser->SetContentSink(sink);
|
1998-11-26 05:55:59 +03:00
|
|
|
g_bReadyForNextUrl = PR_FALSE;
|
1998-06-25 05:42:50 +04:00
|
|
|
|
1999-10-05 08:04:16 +04:00
|
|
|
parser->Parse(url, nsnull,PR_TRUE);/* XXX hook up stream listener here! */
|
1998-05-28 04:21:34 +04:00
|
|
|
while (!g_bReadyForNextUrl) {
|
1998-12-16 08:40:20 +03:00
|
|
|
if (yieldProc != NULL) {
|
2002-03-06 10:48:55 +03:00
|
|
|
nsCAutoString spec;
|
|
|
|
(void)url->GetSpec(spec);
|
|
|
|
(*yieldProc)(spec.get());
|
1998-12-16 08:40:20 +03:00
|
|
|
}
|
1998-05-28 04:21:34 +04:00
|
|
|
}
|
1998-06-04 05:19:25 +04:00
|
|
|
g_bReadyForNextUrl = PR_FALSE;
|
2000-03-29 10:13:07 +04:00
|
|
|
if (docShell) {
|
2001-05-05 00:15:38 +04:00
|
|
|
nsCOMPtr<nsIWebProgress> progress(do_GetInterface(docShell, &rv));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2002-05-17 00:57:37 +04:00
|
|
|
(void) progress->AddProgressListener(pl, nsIWebProgress::NOTIFY_STATE_DOCUMENT);
|
1999-10-05 08:04:16 +04:00
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
nsCAutoString spec;
|
|
|
|
(void)url->GetSpec(spec);
|
|
|
|
NS_ConvertUTF8toUCS2 theSpec(spec);
|
2000-03-29 10:13:07 +04:00
|
|
|
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
|
2001-12-01 01:35:33 +03:00
|
|
|
webNav->LoadURI(theSpec.get(),
|
|
|
|
nsIWebNavigation::LOAD_FLAGS_NONE,
|
|
|
|
nsnull,
|
|
|
|
nsnull,
|
|
|
|
nsnull);/* XXX hook up stream listener here! */
|
1998-06-04 05:19:25 +04:00
|
|
|
while (!g_bReadyForNextUrl) {
|
1998-12-16 08:40:20 +03:00
|
|
|
if (yieldProc != NULL) {
|
2002-03-06 10:48:55 +03:00
|
|
|
(void)url->GetSpec(spec);
|
|
|
|
(*yieldProc)(spec.get());
|
1998-12-16 08:40:20 +03:00
|
|
|
}
|
1998-06-04 05:19:25 +04:00
|
|
|
}
|
|
|
|
}
|
1998-05-28 04:21:34 +04:00
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
NS_RELEASE(sink);
|
|
|
|
NS_RELEASE(parser);
|
|
|
|
NS_RELEASE(url);
|
|
|
|
}
|
|
|
|
|
1998-06-12 05:35:36 +04:00
|
|
|
fputs ("Robot completed.\n", stdout);
|
|
|
|
|
1998-06-04 05:19:25 +04:00
|
|
|
NS_RELEASE(pl);
|
1998-05-14 05:08:06 +04:00
|
|
|
NS_RELEASE(myObserver);
|
|
|
|
|
1998-07-30 03:43:20 +04:00
|
|
|
// pIDTDDebug->DumpVectorRecord();
|
|
|
|
//NS_RELEASE(pIDTDDebug);
|
1998-06-12 05:35:36 +04:00
|
|
|
|
1998-05-14 05:08:06 +04:00
|
|
|
return 0;
|
|
|
|
}
|