Update of the debug plugin. Not part of the build

This commit is contained in:
dcone%netscape.com 2002-05-23 21:06:49 +00:00
Родитель a1a907e242
Коммит cf7c66e034
9 изменённых файлов: 188 добавлений и 27 удалений

Просмотреть файл

@ -43,6 +43,14 @@
interface nsIDebugObject : nsISupports interface nsIDebugObject : nsISupports
{ {
/**
* creates a directory.. only locally
* @param
* @param
*/
void CreateDirectory(in wstring aDirectoryPath, in unsigned long aFlags);
/** /**
* Dumps the content of a window * Dumps the content of a window
* @param * @param

Просмотреть файл

@ -30,6 +30,9 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
/* readonly attribute string version; */ /* readonly attribute string version; */
NS_IMETHOD GetVersion(char * *aVersion) = 0; NS_IMETHOD GetVersion(char * *aVersion) = 0;
/* void CreateDirectory (in wstring aDirPath, in unsigned long aFlags, [retval] out long aResult); */
NS_IMETHOD CreateDirectory(const PRUnichar *aDirPath, PRUint32 aFlags, PRInt32 *aResult) = 0;
/* void DumpLayout (in nsISupports aWindow, in wstring aFilePath, in wstring aFileName, in unsigned long aFlags, [retval] out long aResult); */ /* void DumpLayout (in nsISupports aWindow, in wstring aFilePath, in wstring aFileName, in unsigned long aFlags, [retval] out long aResult); */
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) = 0; NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) = 0;
@ -47,6 +50,7 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
/* Use this macro when declaring classes that implement this interface. */ /* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDEBUGPLUGIN \ #define NS_DECL_NSIDEBUGPLUGIN \
NS_IMETHOD GetVersion(char * *aVersion); \ NS_IMETHOD GetVersion(char * *aVersion); \
NS_IMETHOD CreateDirectory(const PRUnichar *aDirPath, PRUint32 aFlags, PRInt32 *aResult); \
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult); \ NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult); \
NS_IMETHOD StartDirectorySearch(const char *aFilePath); \ NS_IMETHOD StartDirectorySearch(const char *aFilePath); \
NS_IMETHOD GetNextFileInDirectory(char **aFileName); \ NS_IMETHOD GetNextFileInDirectory(char **aFileName); \
@ -55,6 +59,7 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
/* Use this macro to declare functions that forward the behavior of this interface to another object. */ /* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDEBUGPLUGIN(_to) \ #define NS_FORWARD_NSIDEBUGPLUGIN(_to) \
NS_IMETHOD GetVersion(char * *aVersion) { return _to GetVersion(aVersion); } \ NS_IMETHOD GetVersion(char * *aVersion) { return _to GetVersion(aVersion); } \
NS_IMETHOD CreateDirectory(const PRUnichar *aDirPath, PRUint32 aFlags, PRInt32 *aResult) { return _to CreateDirectory(aDirPath, aFlags, aResult); } \
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) { return _to DumpLayout(aWindow, aFilePath, aFileName, aFlags, aResult); } \ NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) { return _to DumpLayout(aWindow, aFilePath, aFileName, aFlags, aResult); } \
NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return _to StartDirectorySearch(aFilePath); } \ NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return _to StartDirectorySearch(aFilePath); } \
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return _to GetNextFileInDirectory(aFileName); } \ NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return _to GetNextFileInDirectory(aFileName); } \
@ -63,6 +68,7 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDEBUGPLUGIN(_to) \ #define NS_FORWARD_SAFE_NSIDEBUGPLUGIN(_to) \
NS_IMETHOD GetVersion(char * *aVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetVersion(aVersion); } \ NS_IMETHOD GetVersion(char * *aVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetVersion(aVersion); } \
NS_IMETHOD CreateDirectory(const PRUnichar *aDirPath, PRUint32 aFlags, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateDirectory(aDirPath, aFlags, aResult); } \
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->DumpLayout(aWindow, aFilePath, aFileName, aFlags, aResult); } \ NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->DumpLayout(aWindow, aFilePath, aFileName, aFlags, aResult); } \
NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->StartDirectorySearch(aFilePath); } \ NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->StartDirectorySearch(aFilePath); } \
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextFileInDirectory(aFileName); } \ NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextFileInDirectory(aFileName); } \
@ -103,6 +109,12 @@ NS_IMETHODIMP nsDebugPlugin::GetVersion(char * *aVersion)
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
/* void CreateDirectory (in wstring aDirPath, in unsigned long aFlags, [retval] out long aResult); */
NS_IMETHODIMP nsDebugPlugin::CreateDirectory(const PRUnichar *aDirPath, PRUint32 aFlags, PRInt32 *aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void DumpLayout (in nsISupports aWindow, in wstring aFilePath, in wstring aFileName, in unsigned long aFlags, [retval] out long aResult); */ /* void DumpLayout (in nsISupports aWindow, in wstring aFilePath, in wstring aFileName, in unsigned long aFlags, [retval] out long aResult); */
NS_IMETHODIMP nsDebugPlugin::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) NS_IMETHODIMP nsDebugPlugin::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult)
{ {

Просмотреть файл

@ -25,6 +25,7 @@
[scriptable, uuid(482e1890-1fe5-11d5-9cf8-0060b0fbd8ac)] [scriptable, uuid(482e1890-1fe5-11d5-9cf8-0060b0fbd8ac)]
interface nsIDebugPlugin : nsISupports { interface nsIDebugPlugin : nsISupports {
readonly attribute string version; readonly attribute string version;
void CreateDirectory(in wstring aDirPath,in unsigned long aFlags,[retval] out long aResult);
void DumpLayout(in nsISupports aWindow,in wstring aFilePath,in wstring aFileName,in unsigned long aFlags,[retval] out long aResult ); void DumpLayout(in nsISupports aWindow,in wstring aFilePath,in wstring aFileName,in unsigned long aFlags,[retval] out long aResult );
void StartDirectorySearch(in string aFilePath); void StartDirectorySearch(in string aFilePath);
void GetNextFileInDirectory([retval] out string aFileName); void GetNextFileInDirectory([retval] out string aFileName);

Просмотреть файл

@ -117,6 +117,20 @@ NS_IMETHODIMP nsScriptablePeer::GetVersion(char * *aVersion)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsScriptablePeer::CreateDirectory(const PRUnichar *aFilePath,PRUint32 aFlags, PRInt32 *aResult)
{
nsresult rv = NS_OK;
PRBool retVal;
if ( mPlugin ) {
mPlugin->CreateDirectory(aFilePath,aFlags,&retVal);
}
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, NS_IMETHODIMP nsScriptablePeer::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName,
PRUint32 aFlags, PRInt32 *aResult) PRUint32 aFlags, PRInt32 *aResult)
{ {
@ -127,8 +141,10 @@ PRBool retVal;
mPlugin->OutPutLayoutFrames(aWindow,aFilePath,aFileName,aFlags,&retVal); mPlugin->OutPutLayoutFrames(aWindow,aFilePath,aFileName,aFlags,&retVal);
if (retVal == NS_OK) { if (retVal == NS_OK) {
*aResult= 0; *aResult= 0;
} else if ( retVal == NS_ERROR_FILE_INVALID_PATH ) {
*aResult = 2; // fatal error.. stop exection
} else { } else {
*aResult = 1; *aResult = 1; // did not load.. keep going
} }
} }
return rv; return rv;

Просмотреть файл

@ -192,6 +192,23 @@ void nsPluginInstance::OutPutLayoutFrames(nsISupports *aWindow, const PRUnichar
//----------------------------------------------------- //-----------------------------------------------------
void nsPluginInstance::CreateDirectory(const PRUnichar *aBasePath, PRUint32 aFlags, PRInt32 *aRetVal)
{
nsIDebugObject *theDebugObject=NULL;
*aRetVal = NS_ERROR_FAILURE;
if (gServiceManager) {
// get service using its contract id and use it to allocate the memory
gServiceManager->GetServiceByContractID("@mozilla.org/debug/debugobject;1", NS_GET_IID(nsIDebugObject), (void **)&theDebugObject);
if(theDebugObject){
*aRetVal = theDebugObject->CreateDirectory(aBasePath, aFlags);
}
}
}
//-----------------------------------------------------
void nsPluginInstance::CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath, void nsPluginInstance::CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath,
const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal) const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal)
{ {

Просмотреть файл

@ -61,6 +61,7 @@ public:
// locals // locals
void getVersion(char* *aVersion); void getVersion(char* *aVersion);
void CreateDirectory(const PRUnichar *aFilePath, PRUint32 aFlags, PRInt32 *aRetVal);
void OutPutLayoutFrames(nsISupports *aWindow,const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aRetVal); void OutPutLayoutFrames(nsISupports *aWindow,const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aRetVal);
void CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath, void CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath,
const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal); const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal);

Просмотреть файл

@ -31,6 +31,7 @@ var origWidth;
var origHeight; var origHeight;
var dirType; var dirType;
var curIndex; var curIndex;
var dumpStyle;
var myArray = new Array(9); var myArray = new Array(9);
@ -211,11 +212,9 @@ RestoreWindow();
function ShowDirectories() function ShowDirectories()
{ {
for(i=0;i<(myArray.length);i+=3){ for(i=0;i<(myArray.length);i+=3){
WriteOutput( myArray[i], false, "normal" ,false,true ); WriteOutput( myArray[i], false, "normal" ,false,true );
} }
} }
//============================================================================= //=============================================================================
@ -245,6 +244,7 @@ function runTests()
testType = 4; testType = 4;
} }
if ( dirType == 1 ) { if ( dirType == 1 ) {
ClearOutput(); ClearOutput();
WriteOutput( "Starting Single Directory Tests",true,"normal",true,false ); WriteOutput( "Starting Single Directory Tests",true,"normal",true,false );
@ -256,12 +256,23 @@ function runTests()
baseDir = document.TestForm.baseDir.value; baseDir = document.TestForm.baseDir.value;
verDir = document.TestForm.verDir.value; verDir = document.TestForm.verDir.value;
// create the output directories
if ( testType == 1 ) {
dirURL = "file:///"+ baseDir;
err = embed.CreateDirectory(dirURL,0);
}
if ( (testType == 1) || (testType == 2) ) {
dirURL = "file:///"+ verDir;
err = embed.CreateDirectory(dirURL,0);
}
DumpFrames(true,0,testType); DumpFrames(true,0,testType);
} else if (dirType == 2) { } else if (dirType == 2) {
ClearOutput(); ClearOutput();
WriteOutput( "Starting Directory Tests",true,"normal",true,false ); WriteOutput( "Starting Directory Tests",true,"normal",true,false );
curIndex = 0; curIndex = 0;
DumpDirectoryies(testType,0); DumpDirectoryies(testType);
} }
} }
@ -280,6 +291,19 @@ function DumpDirectoryies(aTestType)
verDir = myArray[curIndex+2]; verDir = myArray[curIndex+2];
baseExt = document.TestForm.baseExt.value; baseExt = document.TestForm.baseExt.value;
verExt = document.TestForm.verExt.value; verExt = document.TestForm.verExt.value;
// create the output directories
if ( testType == 1 ) {
dirURL = "file:///"+ baseDir;
err = embed.CreateDirectory(dirURL,0);
}
if ( (testType == 1) || (testType == 2) ) {
dirURL = "file:///"+ verDir;
err = embed.CreateDirectory(dirURL,0);
}
WriteOutput( "New Directory" , false, "normal" ,true, true ); WriteOutput( "New Directory" , false, "normal" ,true, true );
DumpFrames(true,0,aTestType); DumpFrames(true,0,aTestType);
} else { } else {
@ -305,6 +329,11 @@ var loadingFlag;
outputWindow = window; outputWindow = window;
theWindow = window.open(filename,0); theWindow = window.open(filename,0);
placeWindows(outputWindow,theWindow); placeWindows(outputWindow,theWindow);
}
if ( document.getElementById('ds').checked ) {
dumpStyle = 1;
} else {
dumpStyle = 0;
} }
started = true; started = true;
} else { } else {
@ -319,22 +348,24 @@ var loadingFlag;
if (aTestType==1) { if (aTestType==1) {
// baseline // baseline
outputfilename = outputfilename.replace (".html",baseExt); outputfilename = outputfilename.replace (".html",baseExt);
loading = embed.DumpLayout(theWindow,baseDir,outputfilename,0); loading = embed.DumpLayout(theWindow,baseDir,outputfilename,dumpStyle);
} else if ((aTestType==2)|| (aTestType==3) ) { } else if ((aTestType==2)|| (aTestType==3) ) {
// verify // verify
outputfilename = outputfilename.replace (".html",verExt); outputfilename = outputfilename.replace (".html",verExt);
loading = embed.DumpLayout(theWindow,verDir,outputfilename,0); loading = embed.DumpLayout(theWindow,verDir,outputfilename,dumpStyle);
} else if (aTestType==4) { } else if (aTestType==4) {
// just compare // just compare
outputfilename = outputfilename.replace (".html",verExt); outputfilename = outputfilename.replace (".html",verExt);
loading = 0; loading = 0;
} }
if (loading != 0) { if (loading == 1) {
// page was not loaded
testtype = aTestType; testtype = aTestType;
setTimeout("DumpFrames(false,filename,testtype)",1000); setTimeout("DumpFrames(false,filename,testtype,dumpStyle)",250);
break; break;
} else { } else if (loading == 0) {
// successful in loading the page
if ( aTestType<4 ){ if ( aTestType<4 ){
WriteOutput("Writing File " + "\""+outputfilename+"\"",false,"success",true,true ); WriteOutput("Writing File " + "\""+outputfilename+"\"",false,"success",true,true );
} }
@ -357,6 +388,10 @@ var loadingFlag;
DumpDirectoryies(aTestType); DumpDirectoryies(aTestType);
} }
} }
} else {
// fatal error.. break
WriteOutput("FATAL ERROR" + "\""+outputfilename+"\"",false,"failure",true,true );
break;
} }
} }
} }
@ -453,10 +488,17 @@ var loadingFlag;
</td) </td)
<td> <td>
Run Compare Run Compare
<input id="rc" type="radio" name="testType" value="runvercomp" > <input id="rc" type="radio" name="testType" value="runcomp" >
</td) </td)
</tr> </tr>
<tr>
<td>
Dump Style
<input id="ds" type="checkbox" name="styleDump" value="dumpStyle" checked >
</td>
</tr>
<tr> <tr>
<td> <td>
<input type=button value="Run Tests" onclick='runTests()'> <input type=button value="Run Tests" onclick='runTests()'>
@ -471,11 +513,9 @@ var loadingFlag;
<table> <table>
</form> </form>
</center> </center>
<h3 id="status"> OUTPUT IDLE </h3> <h4 id="status"> OUTPUT IDLE </h4>
<div id="output" align="left" style="overflow:auto; width:700; height:100; border:solid red"> <div id="output" align="left" style="overflow:auto; width:700; height:100; border:solid red">
</div> </div>

Просмотреть файл

@ -60,7 +60,8 @@
#include "nsStyleStruct.h" #include "nsStyleStruct.h"
#include "nsIFrameUtil.h" #include "nsIFrameUtil.h"
#include "nsLayoutCID.h" #include "nsLayoutCID.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject) NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject)
static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID); static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID);
@ -83,6 +84,34 @@ nsDebugObject::~nsDebugObject()
} }
/** ---------------------------------------------------
* See documentation in nsDebugObject.h
* @update 5/16/02 dwc
*/
NS_IMETHODIMP
nsDebugObject::CreateDirectory( const PRUnichar *aFilePath, PRUint32 aFlags)
{
nsresult rv,result = NS_ERROR_FAILURE;
nsCAutoString dirPathAS;
PRBool exists = PR_TRUE;
// see if the directory exists, if not create it
dirPathAS.AssignWithConversion(aFilePath);
char* dirPath = ToNewCString(dirPathAS);
nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
rv = NS_InitFileFromURLSpec( localFile,nsDependentCString(dirPath));
if ( rv == NS_OK) {
rv = localFile->Exists(&exists);
if (!exists){
rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0600);
}
}
return result;
}
/** --------------------------------------------------- /** ---------------------------------------------------
* See documentation in nsDebugObject.h * See documentation in nsDebugObject.h
* @update 5/16/02 dwc * @update 5/16/02 dwc
@ -114,7 +143,6 @@ PRBool stillLoading;
docShell->GetPresShell(getter_AddRefs(presShell)); docShell->GetPresShell(getter_AddRefs(presShell));
presShell->GetRootFrame(&root); presShell->GetRootFrame(&root);
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) { if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
// create the string for the output // create the string for the output
nsCAutoString outputPath; nsCAutoString outputPath;
outputPath.AssignWithConversion(aFilePath); outputPath.AssignWithConversion(aFilePath);
@ -128,12 +156,17 @@ PRBool stillLoading;
FILE* fp = fopen(filePath, "wt"); FILE* fp = fopen(filePath, "wt");
presShell->GetPresContext(&thePC); if ( fp ) {
presShell->GetPresContext(&thePC);
fdbg->DumpRegressionData(thePC, fp, 0, dumpStyle); fdbg->DumpRegressionData(thePC, fp, 0, dumpStyle);
fclose(fp); fclose(fp);
delete filePath; delete filePath;
result = NS_OK; // the document is now loaded, and the frames are dumped. result = NS_OK; // the document is now loaded, and the frames are dumped.
} else {
result = NS_ERROR_FILE_INVALID_PATH;
}
} }
} }
} }

Просмотреть файл

@ -60,7 +60,8 @@
#include "nsStyleStruct.h" #include "nsStyleStruct.h"
#include "nsIFrameUtil.h" #include "nsIFrameUtil.h"
#include "nsLayoutCID.h" #include "nsLayoutCID.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject) NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject)
static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID); static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID);
@ -83,6 +84,34 @@ nsDebugObject::~nsDebugObject()
} }
/** ---------------------------------------------------
* See documentation in nsDebugObject.h
* @update 5/16/02 dwc
*/
NS_IMETHODIMP
nsDebugObject::CreateDirectory( const PRUnichar *aFilePath, PRUint32 aFlags)
{
nsresult rv,result = NS_ERROR_FAILURE;
nsCAutoString dirPathAS;
PRBool exists = PR_TRUE;
// see if the directory exists, if not create it
dirPathAS.AssignWithConversion(aFilePath);
char* dirPath = ToNewCString(dirPathAS);
nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
rv = NS_InitFileFromURLSpec( localFile,nsDependentCString(dirPath));
if ( rv == NS_OK) {
rv = localFile->Exists(&exists);
if (!exists){
rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0600);
}
}
return result;
}
/** --------------------------------------------------- /** ---------------------------------------------------
* See documentation in nsDebugObject.h * See documentation in nsDebugObject.h
* @update 5/16/02 dwc * @update 5/16/02 dwc
@ -114,7 +143,6 @@ PRBool stillLoading;
docShell->GetPresShell(getter_AddRefs(presShell)); docShell->GetPresShell(getter_AddRefs(presShell));
presShell->GetRootFrame(&root); presShell->GetRootFrame(&root);
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) { if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
// create the string for the output // create the string for the output
nsCAutoString outputPath; nsCAutoString outputPath;
outputPath.AssignWithConversion(aFilePath); outputPath.AssignWithConversion(aFilePath);
@ -128,12 +156,17 @@ PRBool stillLoading;
FILE* fp = fopen(filePath, "wt"); FILE* fp = fopen(filePath, "wt");
presShell->GetPresContext(&thePC); if ( fp ) {
presShell->GetPresContext(&thePC);
fdbg->DumpRegressionData(thePC, fp, 0, dumpStyle); fdbg->DumpRegressionData(thePC, fp, 0, dumpStyle);
fclose(fp); fclose(fp);
delete filePath; delete filePath;
result = NS_OK; // the document is now loaded, and the frames are dumped. result = NS_OK; // the document is now loaded, and the frames are dumped.
} else {
result = NS_ERROR_FILE_INVALID_PATH;
}
} }
} }
} }