Bug 3004 Remove debug robot from build removed robot from the build, this removes it from cvs NPOB toolkit changes r=luser, a=luser
deleted file mode 100644
--- a/parser/htmlparser/robot/Makefile.in
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla 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/MPL/
-#
-# 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.
-#
-# The Original Code is mozilla.org code.
-#
-# 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.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 MPL, 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 MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-LIBRARY_NAME = DebugRobot
-SHORT_LIBNAME = dbgrobot
-MOZILLA_INTERNAL_API = 1
-
-REQUIRES = xpcom \
- string \
- htmlparser \
- necko \
- docshell \
- uriloader \
- unicharutil \
- content \
- $(NULL)
-
-CPPSRCS = nsDebugRobot.cpp nsRobotSink.cpp
-
-ifdef ENABLE_TESTS
-DIRS = test
-endif
-
-EXTRA_DSO_LDOPTS += \
- $(MOZ_UNICHARUTIL_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/parser/htmlparser/robot/nsDebugRobot.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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.
- *
- * The Original Code is mozilla.org code.
- *
- * 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.
- *
- * Contributor(s):
- * Pierre Phaneuf <pp@ludusdesign.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#include "nsIRobotSink.h"
-#include "nsIRobotSinkObserver.h"
-#include "nsIParser.h"
-#include "nsIDocShell.h"
-#include "nsIWebNavigation.h"
-#include "nsIWebProgress.h"
-#include "nsIWebProgressListener.h"
-#include "nsWeakReference.h"
-#include "nsVoidArray.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsIURL.h"
-#include "nsIServiceManager.h"
-#include "nsIURL.h"
-#include "nsIIOService.h"
-#include "nsNetCID.h"
-#include "nsIComponentManager.h"
-#include "nsParserCIID.h"
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-
-class RobotSinkObserver : public nsIRobotSinkObserver {
-public:
- RobotSinkObserver() {
- }
-
- virtual ~RobotSinkObserver() {
- }
-
- NS_DECL_ISUPPORTS
-
- NS_IMETHOD ProcessLink(const nsString& aURLSpec);
- NS_IMETHOD VerifyDirectory (const char * verify_dir);
-
-};
-
-static nsVoidArray * g_workList;
-static nsVoidArray * g_duplicateList;
-static int g_iProcessed;
-static int g_iMaxProcess = 5000;
-static PRBool g_bHitTop;
-static PRBool g_bReadyForNextUrl;
-
-NS_IMPL_ISUPPORTS1(RobotSinkObserver, nsIRobotSinkObserver)
-
-NS_IMETHODIMP RobotSinkObserver::VerifyDirectory(const char * verify_dir)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
-{
- if (!g_bHitTop) {
-
- nsAutoString str;
- // Geez this is ugly. temporary hack to only process html files
- str.Truncate();
- nsString(aURLSpec).Right(str,1);
- if (!str.EqualsLiteral("/"))
- {
- str.Truncate();
- nsString(aURLSpec).Right(str,4);
- if (!str.EqualsLiteral("html"))
- {
- str.Truncate();
- nsString(aURLSpec).Right(str,3);
- if (!str.EqualsLiteral("htm"))
- return NS_OK;
- }
- }
- PRInt32 nCount = g_duplicateList->Count();
- if (nCount > 0)
- {
- for (PRInt32 n = 0; n < nCount; ++n)
- {
- nsString * pstr = (nsString *)g_duplicateList->ElementAt(n);
- if (pstr->Equals(aURLSpec)) {
- fputs ("Robot: (duplicate '",stdout);
- fputs (NS_LossyConvertUTF16toASCII(aURLSpec).get(),stdout);
- fputs ("')\n",stdout);
- return NS_OK;
- }
- }
- }
- g_duplicateList->AppendElement(new nsString(aURLSpec));
- str.Truncate();
- nsString(aURLSpec).Left(str,5);
- if (str.EqualsLiteral("http:")) {
- ++g_iProcessed;
- if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
- g_bHitTop = PR_TRUE;
- g_workList->AppendElement(new nsString(aURLSpec));
- }
- else {
- fputs ("Robot: (cannot process URL types '",stdout);
- fputs (NS_LossyConvertUTF16toASCII(aURLSpec).get(),stdout);
- fputs ("')\n",stdout);
- }
- }
- return NS_OK;
-}
-
-extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir);
-
-class CStreamListener: public nsIWebProgressListener,
- public nsSupportsWeakReference
-{
-public:
- CStreamListener() {
- }
-
- virtual ~CStreamListener() {
- }
-
- NS_DECL_ISUPPORTS
-
- // nsIWebProgressListener
- NS_DECL_NSIWEBPROGRESSLISTENER
-};
-
-// nsIWebProgressListener implementation
-NS_IMETHODIMP
-CStreamListener::OnStateChange(nsIWebProgress* aWebProgress,
- nsIRequest *aRequest,
- PRUint32 progressStateFlags,
- nsresult aStatus)
-{
- if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT)
- if (progressStateFlags & nsIWebProgressListener::STATE_STOP) {
- fputs("done.\n",stdout);
- g_bReadyForNextUrl = PR_TRUE;
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-CStreamListener::OnProgressChange(nsIWebProgress *aWebProgress,
- nsIRequest *aRequest,
- PRInt32 aCurSelfProgress,
- PRInt32 aMaxSelfProgress,
- PRInt32 aCurTotalProgress,
- PRInt32 aMaxTotalProgress)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-NS_IMETHODIMP
-CStreamListener::OnLocationChange(nsIWebProgress* aWebProgress,
- nsIRequest* aRequest,
- nsIURI *location)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-
-NS_IMETHODIMP
-CStreamListener::OnStatusChange(nsIWebProgress* aWebProgress,
- nsIRequest* aRequest,
- nsresult aStatus,
- const PRUnichar* aMessage)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-
-NS_IMETHODIMP
-CStreamListener::OnSecurityChange(nsIWebProgress *aWebProgress,
- nsIRequest *aRequest,
- PRUint32 state)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS2(CStreamListener,
- nsIWebProgressListener,
- nsISupportsWeakReference)
-
-extern "C" NS_EXPORT void DumpVectorRecord(void);
-//----------------------------------------------------------------------
-extern "C" NS_EXPORT int DebugRobot(
- nsVoidArray * workList,
- nsIDocShell * docShell,
- int iMaxLoads,
- char * verify_dir,
- void (*yieldProc )(const char *)
- )
-{
- int iCount = 1;
- CStreamListener * pl = new CStreamListener;
- NS_ADDREF(pl);
-
- if (nsnull==workList)
- return -1;
- g_iMaxProcess = iMaxLoads;
- g_iProcessed = 0;
- g_bHitTop = PR_FALSE;
- g_duplicateList = new nsVoidArray();
- RobotSinkObserver* myObserver = new RobotSinkObserver();
- NS_ADDREF(myObserver);
- g_workList = workList;
-
- for (;;) {
- PRInt32 n = g_workList->Count();
- if (0 == n) {
- break;
- }
- nsString* urlName = (nsString*) g_workList->ElementAt(n - 1);
- g_workList->RemoveElementAt(n - 1);
-
- // Create url
- nsIURI* url;
- nsresult rv;
- nsCOMPtr<nsIIOService> service(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
- if (NS_FAILED(rv)) return rv;
-
- nsIURI *uri = nsnull;
- NS_ConvertUTF16toUTF8 uriStr(*urlName);
- rv = service->NewURI(uriStr, nsnull, nsnull, &uri);
- if (NS_FAILED(rv)) return rv;
-
- rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
- NS_RELEASE(uri);
- if (NS_OK != rv) {
- printf("invalid URL: '");
- fputs(uriStr.get(), stdout);
- printf("'\n");
- NS_RELEASE(myObserver);
- return -1;
- }
-
- char str_num[25];
- sprintf (str_num,"%d",iCount++);
- fputs ("Robot: parsing(",stdout);
- fputs (str_num,stdout);
- fputs (") ",stdout);
- fputs (NS_LossyConvertUTF16toASCII(*urlName).get(),stdout);
- fputs ("...",stdout);
-
- delete urlName;
-
- nsIParser* parser;
-
- static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
- static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
-
- rv = CallCreateInstance(kCParserCID, &parser);
- if (NS_FAILED(rv)) {
- printf("can't make parser\n");
- NS_RELEASE(myObserver);
- return -1;
- }
-
- nsIRobotSink* sink;
- rv = NS_NewRobotSink(&sink);
- if (NS_OK != rv) {
- printf("can't make parser\n");
- NS_RELEASE(myObserver);
- return -1;
- }
- sink->Init(url);
- sink->AddObserver(myObserver);
-
- parser->SetContentSink(sink);
- g_bReadyForNextUrl = PR_FALSE;
-
- parser->Parse(url, nsnull);/* XXX hook up stream listener here! */
- while (!g_bReadyForNextUrl) {
- if (yieldProc != NULL) {
- nsCAutoString spec;
- (void)url->GetSpec(spec);
- (*yieldProc)(spec.get());
- }
- }
- g_bReadyForNextUrl = PR_FALSE;
- if (docShell) {
- nsCOMPtr<nsIWebProgress> progress(do_GetInterface(docShell, &rv));
- if (NS_FAILED(rv)) return rv;
-
- (void) progress->AddProgressListener(pl, nsIWebProgress::NOTIFY_STATE_DOCUMENT);
-
- nsCAutoString spec;
- (void)url->GetSpec(spec);
- NS_ConvertUTF8toUTF16 theSpec(spec);
- nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
- webNav->LoadURI(theSpec.get(),
- nsIWebNavigation::LOAD_FLAGS_NONE,
- nsnull,
- nsnull,
- nsnull);/* XXX hook up stream listener here! */
- while (!g_bReadyForNextUrl) {
- if (yieldProc != NULL) {
- (void)url->GetSpec(spec);
- (*yieldProc)(spec.get());
- }
- }
- }
-
- NS_RELEASE(sink);
- NS_RELEASE(parser);
- NS_RELEASE(url);
- }
-
- fputs ("Robot completed.\n", stdout);
-
- NS_RELEASE(pl);
- NS_RELEASE(myObserver);
-
- return 0;
-}
deleted file mode 100644
--- a/parser/htmlparser/robot/nsIRobotSink.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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.
- *
- * The Original Code is mozilla.org code.
- *
- * 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.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef nsIRobotSink_h___
-#define nsIRobotSink_h___
-
-#include "nsIHTMLContentSink.h"
-class nsIURI;
-class nsIRobotSinkObserver;
-
-/* 61256800-cfd8-11d1-9328-00805f8add32 */
-#define NS_IROBOTSINK_IID \
-{ 0x61256800, 0xcfd8, 0x11d1, \
- {0x93, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
-
-class nsIRobotSink : public nsIHTMLContentSink {
-public:
- NS_IMETHOD Init(nsIURI* aDocumentURL) = 0;
- NS_IMETHOD AddObserver(nsIRobotSinkObserver* aObserver) = 0;
- NS_IMETHOD RemoveObserver(nsIRobotSinkObserver* aObserver) = 0;
-
-};
-
-extern nsresult NS_NewRobotSink(nsIRobotSink** aInstancePtrResult);
-
-#endif /* nsIRobotSink_h___ */
deleted file mode 100644
--- a/parser/htmlparser/robot/nsIRobotSinkObserver.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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.
- *
- * The Original Code is mozilla.org code.
- *
- * 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.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef nsIRobotSinkObserver_h___
-#define nsIRobotSinkObserver_h___
-
-#include "nsISupports.h"
-class nsString;
-
-/* fab1d970-cfda-11d1-9328-00805f8add32 */
-#define NS_IROBOTSINKOBSERVER_IID \
-{ 0xfab1d970, 0xcfda, 0x11d1, \
- {0x93, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
-
-class nsIRobotSinkObserver : public nsISupports {
-public:
- NS_DECLARE_STATIC_IID_ACCESSOR(NS_IROBOTSINKOBSERVER_IID)
-
- NS_IMETHOD ProcessLink(const nsString& aURLSpec) = 0;
- NS_IMETHOD VerifyDirectory(const char * verify_dir) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIRobotSinkObserver, NS_IROBOTSINKOBSERVER_IID)
-
-#endif /* nsIRobotSinkObserver_h___ */
deleted file mode 100644
--- a/parser/htmlparser/robot/nsRobotSink.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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.
- *
- * The Original Code is mozilla.org code.
- *
- * 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.
- *
- * Contributor(s):
- * Pierre Phaneuf <pp@ludusdesign.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 MPL, 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 MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#include "nsIRobotSink.h"
-#include "nsIRobotSinkObserver.h"
-#include "nsIParserNode.h"
-#include "nsIParser.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsUnicharUtils.h"
-#include "nsIURL.h"
-#include "nsIURL.h"
-#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsNetCID.h"
-#include "nsCRT.h"
-#include "nsVoidArray.h"
-class nsIDocument;
-
-// TODO
-// - add in base tag support
-// - get links from other sources:
-// - LINK tag
-// - STYLE SRC
-// - IMG SRC
-// - LAYER SRC
-
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
-static NS_DEFINE_IID(kIRobotSinkIID, NS_IROBOTSINK_IID);
-
-class RobotSink : public nsIRobotSink {
-public:
- RobotSink();
- virtual ~RobotSink();
-
- NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
-
- // nsISupports
- NS_DECL_ISUPPORTS
-
- // nsIHTMLContentSink
- NS_IMETHOD OpenHead();
- NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
- NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
-
- NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
- NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
- NS_IMETHOD CloseTopmostContainer();
- NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
- NS_IMETHOD AddComment(const nsIParserNode& aNode);
- NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
- NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
- NS_IMETHOD WillTokenize(void) { return NS_OK; }
- NS_IMETHOD WillBuildModel(void) { return NS_OK; }
- NS_IMETHOD DidBuildModel(void) { return NS_OK; }
- NS_IMETHOD WillInterrupt(void) { return NS_OK; }
- NS_IMETHOD WillResume(void) { return NS_OK; }
- NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
- virtual void FlushPendingNotifications(mozFlushType aType) { }
- NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
- virtual nsISupports *GetTarget() { return nsnull; }
- NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
- NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
- NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
- NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
- NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-
- NS_IMETHOD BeginContext(PRInt32 aPosition){ return NS_OK; }
- NS_IMETHOD EndContext(PRInt32 aPosition){ return NS_OK; }
-
- // nsIRobotSink
- NS_IMETHOD Init(nsIURI* aDocumentURL);
- NS_IMETHOD AddObserver(nsIRobotSinkObserver* aObserver);
- NS_IMETHOD RemoveObserver(nsIRobotSinkObserver* aObserver);
-
- void ProcessLink(const nsString& aLink);
-
-protected:
- nsIURI* mDocumentURL;
- nsVoidArray mObservers;
-};
-
-nsresult NS_NewRobotSink(nsIRobotSink** aInstancePtrResult)
-{
- RobotSink* it = new RobotSink();
- if(it)
- return it->QueryInterface(kIRobotSinkIID, (void**) aInstancePtrResult);
- return NS_OK;
-}
-
-RobotSink::RobotSink()
-{
-}
-
-RobotSink::~RobotSink()
-{
- NS_IF_RELEASE(mDocumentURL);
- PRInt32 i, n = mObservers.Count();
- for (i = 0; i < n; ++i) {
- nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
- NS_RELEASE(cop);
- }
-}
-
-NS_IMPL_ADDREF(RobotSink)
-
-NS_IMPL_RELEASE(RobotSink)
-
-NS_IMETHODIMP RobotSink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
-{
- if (NULL == aInstancePtr) {
- return NS_ERROR_NULL_POINTER;
- }
- if (aIID.Equals(kIRobotSinkIID)) {
- *aInstancePtr = (void*) this;
- AddRef();
- return NS_OK;
- }
- if (aIID.Equals(kIHTMLContentSinkIID)) {
- *aInstancePtr = (void*) this;
- AddRef();
- return NS_OK;
- }
- if (aIID.Equals(kISupportsIID)) {
- *aInstancePtr = (void*) ((nsISupports*)this);
- AddRef();
- return NS_OK;
- }
- return NS_NOINTERFACE;
-}
-
-NS_IMETHODIMP RobotSink::OpenHead()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
-{
- nsAutoString tmp; tmp.Assign(aNode.GetText());
- ToLowerCase(tmp);
- if (tmp.EqualsLiteral("a")) {
- nsAutoString k, v;
- PRInt32 ac = aNode.GetAttributeCount();
- for (PRInt32 i = 0; i < ac; ++i) {
- // Get upper-cased key
- const nsAString& key = aNode.GetKeyAt(i);
- k.Assign(key);
- ToLowerCase(k);
- if (k.EqualsLiteral("href")) {
- // Get value and remove mandatory quotes
- v.Truncate();
- v.Append(aNode.GetValueAt(i));
- PRUnichar first = v.First();
- if ((first == '"') || (first == '\'')) {
- if (v.Last() == first) {
- v.Cut(0, 1);
- PRInt32 pos = v.Length() - 1;
- if (pos >= 0) {
- v.Cut(pos, 1);
- }
- } else {
- // Mismatched quotes - leave them in
- }
- }
- ProcessLink(v);
- }
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseContainer(const nsHTMLTag aTag)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseTopmostContainer()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-/**
- * This gets called by the parsing system when we find a comment
- * @update gess11/9/98
- * @param aNode contains a comment token
- * @return error code
- */
-NS_IMETHODIMP RobotSink::AddComment(const nsIParserNode& aNode) {
- nsresult result= NS_OK;
- return result;
-}
-
-/**
- * This gets called by the parsing system when we find a PI
- * @update gess11/9/98
- * @param aNode contains a comment token
- * @return error code
- */
-NS_IMETHODIMP RobotSink::AddProcessingInstruction(const nsIParserNode& aNode) {
- nsresult result= NS_OK;
- return result;
-}
-
-/**
- * This gets called by the parser when it encounters
- * a DOCTYPE declaration in the HTML document.
- */
-
-NS_IMETHODIMP
-RobotSink::AddDocTypeDecl(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::Init(nsIURI* aDocumentURL)
-{
- NS_IF_RELEASE(mDocumentURL);
- mDocumentURL = aDocumentURL;
- NS_IF_ADDREF(aDocumentURL);
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::AddObserver(nsIRobotSinkObserver* aObserver)
-{
- if (mObservers.AppendElement(aObserver)) {
- NS_ADDREF(aObserver);
- return NS_OK;
- }
- return NS_ERROR_OUT_OF_MEMORY;
-}
-
-NS_IMETHODIMP RobotSink::RemoveObserver(nsIRobotSinkObserver* aObserver)
-{
- if (mObservers.RemoveElement(aObserver)) {
- NS_RELEASE(aObserver);
- return NS_OK;
- }
- //XXX return NS_ERROR_NOT_FOUND;
- return NS_OK;
-}
-
-void RobotSink::ProcessLink(const nsString& aLink)
-{
- nsAutoString absURLSpec; absURLSpec.Assign(aLink);
-
- // Make link absolute
- // XXX base tag handling
- nsIURI* docURL = mDocumentURL;
- if (nsnull != docURL) {
- nsIURI* absurl;
- nsresult rv;
- nsCOMPtr<nsIIOService> service(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
- if (NS_FAILED(rv)) return;
-
- nsIURI *uri = nsnull, *baseUri = nsnull;
-
- rv = mDocumentURL->QueryInterface(NS_GET_IID(nsIURI), (void**)&baseUri);
- if (NS_FAILED(rv)) return;
-
- NS_ConvertUTF16toUTF8 uriStr(aLink);
- rv = service->NewURI(uriStr, nsnull, baseUri, &uri);
- NS_RELEASE(baseUri);
- if (NS_FAILED(rv)) return;
-
- rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&absurl);
- NS_RELEASE(uri);
-
- if (NS_OK == rv) {
- absURLSpec.Truncate();
- nsCAutoString str;
- absurl->GetSpec(str);
- absURLSpec = NS_ConvertUTF8toUTF16(str);
- }
- }
-
- // Now give link to robot observers
- PRInt32 i, n = mObservers.Count();
- for (i = 0; i < n; ++i) {
- nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
- cop->ProcessLink(absURLSpec);
- }
-}
-
-
deleted file mode 100644
--- a/parser/htmlparser/robot/test/Makefile.in
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla 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/MPL/
-#
-# 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.
-#
-# The Original Code is mozilla.org code.
-#
-# 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.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 MPL, 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 MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-PROGRAM = htmlrobot$(BIN_SUFFIX)
-MOZILLA_INTERNAL_API = 1
-
-REQUIRES = xpcom \
- string \
- $(NULL)
-
-CPPSRCS = RobotMain.cpp
-
-ifeq ($(USE_SHORT_LIBNAME),1)
-ROBOT_LIB = dbgrobot
-else
-ROBOT_LIB = DebugRobot
-endif
-
-LIBS = \
- $(call EXPAND_LIBNAME_PATH,$(ROBOT_LIB),..) \
- $(MOZ_UNICHARUTIL_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
-
-include $(topsrcdir)/config/config.mk
-
-include $(topsrcdir)/config/rules.mk
-
-ifdef ($(OS_ARCH),WINNT)
-ifdef GNU_CC
-LDFLAGS += -SUBSYSTEM:CONSOLE
-OS_LIBS += shell32.lib
-endif
-endif
-
deleted file mode 100644
--- a/parser/htmlparser/robot/test/RobotMain.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "nsXPCOM.h"
-#include "nsVoidArray.h"
-#include "nsString.h"
-class nsIDocShell;
-
-//XXXbz is this even used? There is no DebugRobot() with this
-//signature in the tree!
-
-extern "C" NS_EXPORT int DebugRobot(
- nsVoidArray * workList,
- nsIDocShell * docShell,
- int iMaxLoads,
- char * verify_dir,
- void (*yieldProc )(const char *)
- );
-
-int main(int argc, char **argv)
-{
- nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
- if (NS_FAILED(rv)) {
- printf("NS_InitXPCOM2 failed\n");
- return 1;
- }
-
- nsVoidArray * gWorkList = new nsVoidArray();
- if(gWorkList) {
- int i;
- for (i = 1; i < argc; ++i) {
- nsString *tempString = new nsString;
- tempString->AssignWithConversion(argv[i]);
- gWorkList->AppendElement(tempString);
- }
- }
-
- return DebugRobot(gWorkList, nsnull, 50, nsnull, nsnull);
-}
-
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -101,18 +101,16 @@ MAKEFILES_gfx="
gfx/src/photon/Makefile
gfx/src/windows/Makefile
gfx/src/thebes/Makefile
gfx/tests/Makefile
"
MAKEFILES_htmlparser="
parser/htmlparser/Makefile
- parser/htmlparser/robot/Makefile
- parser/htmlparser/robot/test/Makefile
parser/htmlparser/public/Makefile
parser/htmlparser/src/Makefile
parser/htmlparser/tests/Makefile
parser/htmlparser/tests/grabpage/Makefile
parser/htmlparser/tests/logparse/Makefile
parser/htmlparser/tests/html/Makefile
parser/htmlparser/tests/outsinks/Makefile
"