diff --git a/htmlparser/robot/nsDebugRobot.cpp b/htmlparser/robot/nsDebugRobot.cpp
index 88d15ffa0e0..a2fe0e7990d 100644
--- a/htmlparser/robot/nsDebugRobot.cpp
+++ b/htmlparser/robot/nsDebugRobot.cpp
@@ -37,6 +37,7 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD ProcessLink(const nsString& aURLSpec);
+ NS_IMETHOD VerifyDirectory (const char * verify_dir);
};
@@ -48,6 +49,11 @@ static PRBool g_bHitTop;
NS_IMPL_ISUPPORTS(RobotSinkObserver, kIRobotSinkObserverIID);
+NS_IMETHODIMP RobotSinkObserver::VerifyDirectory(const char * verify_dir)
+{
+ return NS_OK;
+}
+
NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
{
if (!g_bHitTop) {
@@ -92,16 +98,25 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
return NS_OK;
}
-//----------------------------------------------------------------------
+extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir);
-extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww)
+//----------------------------------------------------------------------
+extern "C" NS_EXPORT int DebugRobot(
+ nsVoidArray * workList,
+ nsIWebWidget * ww,
+ int iMaxLoads,
+ char * verify_dir,
+ void (*yieldProc )(const char *)
+ )
{
if (nsnull==workList)
return -1;
+ g_iMaxProcess = iMaxLoads;
g_iProcessed = 0;
g_bHitTop = PR_FALSE;
g_duplicateList = new nsVoidArray();
RobotSinkObserver* myObserver = new RobotSinkObserver();
+ SetVerificationDirectory(verify_dir);
NS_ADDREF(myObserver);
g_workList = workList;
@@ -142,6 +157,8 @@ extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww)
parser->SetContentSink(sink);
parser->Parse(url);
+ if (yieldProc != NULL)
+ (*yieldProc)(url->GetSpec());
if (ww)
ww->LoadURL(url->GetSpec());
NS_RELEASE(sink);
diff --git a/htmlparser/robot/nsIRobotSinkObserver.h b/htmlparser/robot/nsIRobotSinkObserver.h
index da30b85edd6..68be54be43a 100644
--- a/htmlparser/robot/nsIRobotSinkObserver.h
+++ b/htmlparser/robot/nsIRobotSinkObserver.h
@@ -29,6 +29,7 @@ class nsString;
class nsIRobotSinkObserver : public nsISupports {
public:
NS_IMETHOD ProcessLink(const nsString& aURLSpec) = 0;
+ NS_IMETHOD VerifyDirectory(const char * verify_dir) = 0;
};
#endif /* nsIRobotSinkObserver_h___ */
diff --git a/htmlparser/src/nsHTMLParser.cpp b/htmlparser/src/nsHTMLParser.cpp
index 36a3d76c83e..749b55bb0c1 100644
--- a/htmlparser/src/nsHTMLParser.cpp
+++ b/htmlparser/src/nsHTMLParser.cpp
@@ -388,6 +388,25 @@ PRBool VerifyContextVector(PRInt32 aTags[],PRInt32 count,nsIDTD* aDTD) {
return result;
}
+/**
+ * This debug routine sets the verification directory. It overrides
+ * the value from PR_GetEnv()
+ *
+ * @update jevering 5/19/98
+ * @param
+ * @return
+ */
+
+#if defined(NS_DEBUG)
+extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir)
+{
+ if (verify_dir && PL_strlen(verify_dir))
+ gVerificationOutputDir = verify_dir;
+ else
+ gVerificationOutputDir = NULL;
+
+}
+#endif /* NS_DEBUG */
/**
* This is where we loop over the tokens created in the
diff --git a/parser/htmlparser/robot/nsDebugRobot.cpp b/parser/htmlparser/robot/nsDebugRobot.cpp
index 88d15ffa0e0..a2fe0e7990d 100644
--- a/parser/htmlparser/robot/nsDebugRobot.cpp
+++ b/parser/htmlparser/robot/nsDebugRobot.cpp
@@ -37,6 +37,7 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD ProcessLink(const nsString& aURLSpec);
+ NS_IMETHOD VerifyDirectory (const char * verify_dir);
};
@@ -48,6 +49,11 @@ static PRBool g_bHitTop;
NS_IMPL_ISUPPORTS(RobotSinkObserver, kIRobotSinkObserverIID);
+NS_IMETHODIMP RobotSinkObserver::VerifyDirectory(const char * verify_dir)
+{
+ return NS_OK;
+}
+
NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
{
if (!g_bHitTop) {
@@ -92,16 +98,25 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
return NS_OK;
}
-//----------------------------------------------------------------------
+extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir);
-extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww)
+//----------------------------------------------------------------------
+extern "C" NS_EXPORT int DebugRobot(
+ nsVoidArray * workList,
+ nsIWebWidget * ww,
+ int iMaxLoads,
+ char * verify_dir,
+ void (*yieldProc )(const char *)
+ )
{
if (nsnull==workList)
return -1;
+ g_iMaxProcess = iMaxLoads;
g_iProcessed = 0;
g_bHitTop = PR_FALSE;
g_duplicateList = new nsVoidArray();
RobotSinkObserver* myObserver = new RobotSinkObserver();
+ SetVerificationDirectory(verify_dir);
NS_ADDREF(myObserver);
g_workList = workList;
@@ -142,6 +157,8 @@ extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww)
parser->SetContentSink(sink);
parser->Parse(url);
+ if (yieldProc != NULL)
+ (*yieldProc)(url->GetSpec());
if (ww)
ww->LoadURL(url->GetSpec());
NS_RELEASE(sink);
diff --git a/parser/htmlparser/robot/nsIRobotSinkObserver.h b/parser/htmlparser/robot/nsIRobotSinkObserver.h
index da30b85edd6..68be54be43a 100644
--- a/parser/htmlparser/robot/nsIRobotSinkObserver.h
+++ b/parser/htmlparser/robot/nsIRobotSinkObserver.h
@@ -29,6 +29,7 @@ class nsString;
class nsIRobotSinkObserver : public nsISupports {
public:
NS_IMETHOD ProcessLink(const nsString& aURLSpec) = 0;
+ NS_IMETHOD VerifyDirectory(const char * verify_dir) = 0;
};
#endif /* nsIRobotSinkObserver_h___ */
diff --git a/parser/htmlparser/src/nsHTMLParser.cpp b/parser/htmlparser/src/nsHTMLParser.cpp
index 36a3d76c83e..749b55bb0c1 100644
--- a/parser/htmlparser/src/nsHTMLParser.cpp
+++ b/parser/htmlparser/src/nsHTMLParser.cpp
@@ -388,6 +388,25 @@ PRBool VerifyContextVector(PRInt32 aTags[],PRInt32 count,nsIDTD* aDTD) {
return result;
}
+/**
+ * This debug routine sets the verification directory. It overrides
+ * the value from PR_GetEnv()
+ *
+ * @update jevering 5/19/98
+ * @param
+ * @return
+ */
+
+#if defined(NS_DEBUG)
+extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir)
+{
+ if (verify_dir && PL_strlen(verify_dir))
+ gVerificationOutputDir = verify_dir;
+ else
+ gVerificationOutputDir = NULL;
+
+}
+#endif /* NS_DEBUG */
/**
* This is where we loop over the tokens created in the
diff --git a/webshell/tests/viewer/resources.h b/webshell/tests/viewer/resources.h
index 77cc61d5f18..b8dc9032ab4 100644
--- a/webshell/tests/viewer/resources.h
+++ b/webshell/tests/viewer/resources.h
@@ -44,7 +44,6 @@
#define VIEWER_DUMP_STYLE_SHEETS 40025
#define VIEWER_DUMP_STYLE_CONTEXTS 40026
#define VIEWER_DEBUGROBOT 40027
-#define VIEWER_DEBUGROBOT_UPDATE 40028
// Note: must be in ascending sequential order
#define VIEWER_ONE_COLUMN 40031
@@ -59,4 +58,12 @@
#define VIEWER_EDIT_SELECTALL 40204
#define VIEWER_EDIT_FINDINPAGE 40205
+/* Debug Robot dialog setup */
+
+#define IDD_DEBUGROBOT 101
+#define IDC_UPDATE_DISPLAY 40301
+#define IDC_VERIFICATION_DIRECTORY 40302
+#define IDC_PAGE_LOADS 40303
+#define IDC_STATIC -1
+
#endif /* resources_h___ */
diff --git a/webshell/tests/viewer/viewer.rc b/webshell/tests/viewer/viewer.rc
index f59fe213a8b..b00456df81f 100644
--- a/webshell/tests/viewer/viewer.rc
+++ b/webshell/tests/viewer/viewer.rc
@@ -69,7 +69,6 @@ VIEWER MENU DISCARDABLE
MENUITEM "Dump &Style Contexts", VIEWER_DUMP_STYLE_CONTEXTS
MENUITEM SEPARATOR
MENUITEM "Debu&g Robot", VIEWER_DEBUGROBOT
- MENUITEM "&Visual Debug Robot", VIEWER_DEBUGROBOT_UPDATE
}
POPUP "&Tools"
{
@@ -136,3 +135,20 @@ BEGIN
VK_F5, ID_COMMANDSEVALALL, VIRTKEY
VK_F10, ID_COMMANDSEVALSEL, VIRTKEY
END
+
+IDD_DEBUGROBOT DIALOG DISCARDABLE 0, 0, 246, 84
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Debug Robot Options"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "&Start",IDOK,67,57,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,127,57,50,14
+ CONTROL "&Update Display (Visual)",IDC_UPDATE_DISPLAY,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ EDITTEXT IDC_VERIFICATION_DIRECTORY,77,19,159,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_PAGE_LOADS,41,36,40,14,ES_AUTOHSCROLL
+ LTEXT "&Verification Directory",IDC_STATIC,7,21,70,8
+ LTEXT "&Stop after",IDC_STATIC,7,38,32,8
+ LTEXT "page loads",IDC_STATIC,84,38,36,8
+END
+
diff --git a/webshell/tests/viewer/winmain.cpp b/webshell/tests/viewer/winmain.cpp
index 0f88abdab45..2ba31ee7f17 100644
--- a/webshell/tests/viewer/winmain.cpp
+++ b/webshell/tests/viewer/winmain.cpp
@@ -46,12 +46,14 @@
#include "nsViewsCID.h"
#include "nsString.h"
#include "plevent.h"
+#include "prenv.h"
#include
#include "nsIScriptContext.h"
#include "nsDocLoader.h"
// DebugRobot call
-extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebWidget * ww);
+extern "C" NS_EXPORT int DebugRobot(
+ nsVoidArray * workList, nsIWebWidget * ww, int imax, char * verify_dir, void (*yieldProc)(const char *));
// Selection Repaint includes
#include "nsIPresShell.h"
@@ -71,6 +73,13 @@ static HANDLE gInstance, gPrevInstance;
static char* startURL;
static nsVoidArray* gWindows;
+// Debug Robot options
+static int gDebugRobotLoads = 5000;
+static char gVerifyDir[_MAX_PATH];
+static BOOL gVisualDebug = TRUE;
+
+#define DEBUG_EMPTY "(none)"
+
// Temporary Netlib stuff...
/* XXX: Don't include net.h... */
extern "C" {
@@ -375,11 +384,16 @@ CopyTextContent(WindowData* wd, HWND aHWnd)
}
}
+void yieldProc(const char * str)
+{
+}
+
long PASCAL
WndProc(HWND hWnd, UINT msg, WPARAM param, LPARAM lparam)
{
HMENU hMenu;
PRBool bVisual = PR_FALSE;
+ BOOL CreateRobotDialog(HWND hParent);
if (msg == WM_CREATE) {
LPCREATESTRUCT lpcs = (LPCREATESTRUCT) lparam;
@@ -468,21 +482,25 @@ WndProc(HWND hWnd, UINT msg, WPARAM param, LPARAM lparam)
wd->ww->DumpStyleContexts();
}
break;
-
- case VIEWER_DEBUGROBOT_UPDATE:
- bVisual = PR_TRUE;
case VIEWER_DEBUGROBOT:
if ((nsnull != wd) && (nsnull != wd->ww)) {
- nsIDocument* doc = wd->ww->GetDocument();
- if (nsnull!=doc) {
- const char * str = doc->GetDocumentURL()->GetSpec();
- nsVoidArray * gWorkList = new nsVoidArray();
- gWorkList->AppendElement(new nsString(str));
- DebugRobot(gWorkList, bVisual ? wd->ww : nsnull);
+ if (CreateRobotDialog(hWnd))
+ {
+ nsIDocument* doc = wd->ww->GetDocument();
+ if (nsnull!=doc) {
+ const char * str = doc->GetDocumentURL()->GetSpec();
+ nsVoidArray * gWorkList = new nsVoidArray();
+ gWorkList->AppendElement(new nsString(str));
+ DebugRobot(
+ gWorkList,
+ gVisualDebug ? wd->ww : nsnull,
+ gDebugRobotLoads,
+ PL_strdup(gVerifyDir),
+ yieldProc);
+ }
}
}
break;
-
case VIEWER_ONE_COLUMN:
case VIEWER_TWO_COLUMN:
case VIEWER_THREE_COLUMN:
@@ -740,6 +758,53 @@ WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCmdShow)
return msg.wParam;
}
+
+/* Debug Robot Dialog options */
+
+BOOL CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
+{
+ BOOL translated = FALSE;
+ HWND hwnd;
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ SetDlgItemInt(hDlg,IDC_PAGE_LOADS,5000,FALSE);
+ char * text = PR_GetEnv("VERIFY_PARSER");
+ SetDlgItemText(hDlg,IDC_VERIFICATION_DIRECTORY,text ? text : DEBUG_EMPTY);
+ hwnd = GetDlgItem(hDlg,IDC_UPDATE_DISPLAY);
+ SendMessage(hwnd,BM_SETCHECK,TRUE,0);
+ }
+ return FALSE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ gDebugRobotLoads = GetDlgItemInt(hDlg,IDC_PAGE_LOADS,&translated,FALSE);
+ GetDlgItemText(hDlg, IDC_VERIFICATION_DIRECTORY, gVerifyDir, sizeof(gVerifyDir));
+ if (!strcmp(gVerifyDir,DEBUG_EMPTY))
+ gVerifyDir[0] = '\0';
+ hwnd = GetDlgItem(hDlg,IDC_UPDATE_DISPLAY);
+ gVisualDebug = (BOOL)SendMessage(hwnd,BM_GETCHECK,0,0);
+ EndDialog(hDlg,IDOK);
+ break;
+ case IDCANCEL:
+ EndDialog(hDlg,IDCANCEL);
+ break;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+BOOL CreateRobotDialog(HWND hParent)
+{
+ BOOL result = (DialogBox(gInstance,MAKEINTRESOURCE(IDD_DEBUGROBOT),hParent,(DLGPROC)DlgProc) == IDOK);
+ return result;
+}
+
void main(int argc, char **argv)
{
if (argc > 1) {
@@ -747,3 +812,5 @@ void main(int argc, char **argv)
}
WinMain(GetModuleHandle(NULL), NULL, 0, SW_SHOW);
}
+
+