From 97d5ad9c6e17116ba28779a0f721268d50db37f8 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Tue, 3 Sep 2002 23:06:56 +0000 Subject: [PATCH] Get the plugin into the build and some extra work for instrumenting printing testing Bug 164072 rs=kin r=dcone git-svn-id: svn://10.0.0.236/trunk@128756 18797224-902f-48f8-a5cc-f745e15eee43 --- .../{public/makefile.win => Makefile.in} | 16 +- .../{makefile.win => idl/Makefile.in} | 29 +- .../layout-debug/idl/nsIDebugObject.idl | 21 + .../layout-debug/plugin/Makefile.in | 98 ++++ .../layout-debug/plugin/common/makefile.win | 61 --- .../layout-debug/plugin/createIDL.bat | 7 - .../layout-debug/plugin/idl/nsISupports.idl | 80 ---- .../layout-debug/plugin/idl/nsrootidl.idl | 114 ----- .../layout-debug/plugin/makefile.win | 85 ---- .../plugin/{common => }/np_entry.cpp | 0 .../layout-debug/plugin/npdebug.def | 2 +- .../extensions/layout-debug/plugin/npdebug.rc | 6 +- .../plugin/{common => }/npn_gate.cpp | 0 .../plugin/{common => }/npp_gate.cpp | 0 .../layout-debug/plugin/nsIDebugPlugin.h | 146 ------ .../layout-debug/plugin/nsIDebugPlugin.idl | 23 + .../layout-debug/plugin/nsScriptablePeer.cpp | 111 +++-- .../layout-debug/plugin/nsScriptablePeer.h | 11 +- .../extensions/layout-debug/plugin/plugin.cpp | 178 ++++++-- .../extensions/layout-debug/plugin/plugin.h | 9 +- .../plugin/printRuntimeTests.html | 428 ++++++++++++++++++ .../extensions/layout-debug/plugin/resource.h | 2 +- .../layout-debug/plugin/tableRegression.html | 20 +- .../{idl/makefile.win => public/Makefile.in} | 22 +- .../extensions/layout-debug/src/Makefile.in | 71 +++ .../extensions/layout-debug/src/makefile.win | 72 --- .../layout-debug/src/nsDebugObject.cpp | 96 +++- .../layout-debug/src/nsDebugObject.h | 5 + .../layout-debug/src/nsRegressionTester.cpp | 96 +++- .../layout-debug/src/nsRegressionTester.h | 5 + 30 files changed, 1104 insertions(+), 710 deletions(-) rename mozilla/extensions/layout-debug/{public/makefile.win => Makefile.in} (80%) rename mozilla/extensions/layout-debug/{makefile.win => idl/Makefile.in} (63%) create mode 100644 mozilla/extensions/layout-debug/plugin/Makefile.in delete mode 100644 mozilla/extensions/layout-debug/plugin/common/makefile.win delete mode 100755 mozilla/extensions/layout-debug/plugin/createIDL.bat delete mode 100644 mozilla/extensions/layout-debug/plugin/idl/nsISupports.idl delete mode 100644 mozilla/extensions/layout-debug/plugin/idl/nsrootidl.idl delete mode 100644 mozilla/extensions/layout-debug/plugin/makefile.win rename mozilla/extensions/layout-debug/plugin/{common => }/np_entry.cpp (100%) rename mozilla/extensions/layout-debug/plugin/{common => }/npn_gate.cpp (100%) rename mozilla/extensions/layout-debug/plugin/{common => }/npp_gate.cpp (100%) delete mode 100644 mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.h create mode 100644 mozilla/extensions/layout-debug/plugin/printRuntimeTests.html rename mozilla/extensions/layout-debug/{idl/makefile.win => public/Makefile.in} (78%) create mode 100644 mozilla/extensions/layout-debug/src/Makefile.in delete mode 100644 mozilla/extensions/layout-debug/src/makefile.win diff --git a/mozilla/extensions/layout-debug/public/makefile.win b/mozilla/extensions/layout-debug/Makefile.in similarity index 80% rename from mozilla/extensions/layout-debug/public/makefile.win rename to mozilla/extensions/layout-debug/Makefile.in index 4de98c57a0c..f8e74a91bd9 100644 --- a/mozilla/extensions/layout-debug/public/makefile.win +++ b/mozilla/extensions/layout-debug/Makefile.in @@ -1,4 +1,3 @@ -#!nmake # # The contents of this file are subject to the Netscape Public # License Version 1.1 (the "License"); you may not use this file @@ -18,15 +17,16 @@ # Rights Reserved. # # Contributor(s): +# -DEPTH=..\..\.. +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +include $(DEPTH)/config/autoconf.mk -EXPORTS = \ - nsDebugCIID.h \ - $(NULL) +DIRS += public src idl plugin -MODULE=debug - -include <$(DEPTH)\config\rules.mak> +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/layout-debug/makefile.win b/mozilla/extensions/layout-debug/idl/Makefile.in similarity index 63% rename from mozilla/extensions/layout-debug/makefile.win rename to mozilla/extensions/layout-debug/idl/Makefile.in index 2365b50f506..6fca11f62dd 100644 --- a/mozilla/extensions/layout-debug/makefile.win +++ b/mozilla/extensions/layout-debug/idl/Makefile.in @@ -1,15 +1,14 @@ -#!nmake -# -# The contents of this file are subject to the Netscape Public +# +# 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/NPL/ -# +# 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 @@ -18,10 +17,20 @@ # Rights Reserved. # # Contributor(s): +# -DEPTH=..\.. +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ -DIRS= public src \ - idl +include $(DEPTH)/config/autoconf.mk -include <$(DEPTH)\config\rules.mak> +MODULE = debug +DEFINES=-D_IMPL_NS_UI + +XPIDLSRCS = \ + nsIDebugObject.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/layout-debug/idl/nsIDebugObject.idl b/mozilla/extensions/layout-debug/idl/nsIDebugObject.idl index 91afa672125..8645941375d 100644 --- a/mozilla/extensions/layout-debug/idl/nsIDebugObject.idl +++ b/mozilla/extensions/layout-debug/idl/nsIDebugObject.idl @@ -65,6 +65,27 @@ interface nsIDebugObject : nsISupports */ void CompareFrameModels(in wstring aBasePath,in wstring aVerPath,in wstring aBaseFile,in wstring aVerFile, in unsigned long aFlags); + + /** + * Printing Runtime Error Checking + */ + const short PRT_RUNTIME_NONE = 0; + const short PRT_RUNTIME_CHECKFORPRINTERS = 1; + const short PRT_RUNTIME_CREATEPRTSESSION = 2; + const short PRT_RUNTIME_INITPRTOBJ = 3; + const short PRT_RUNTIME_CREATESPECFACTORY = 4; + const short PRT_RUNTIME_NOPROMPTSERVICE = 5; + const short PRT_RUNTIME_NODEVSPEC = 6; + const short PRT_RUNTIME_NEXTPAGE = 7; + const short PRT_RUNTIME_REFLOWDOCLIST = 8; + const short PRT_RUNTIME_PREPAREDOC = 9; + const short PRT_RUNTIME_BEGINDOC = 10; + + attribute boolean doRuntimeTests; // indicates whether the runtime test will be run + attribute short testId; // id of test to run + attribute boolean printAsIs; // print asis when printing to a file + attribute wstring printFileName; // name of output file + }; diff --git a/mozilla/extensions/layout-debug/plugin/Makefile.in b/mozilla/extensions/layout-debug/plugin/Makefile.in new file mode 100644 index 00000000000..b51f489537b --- /dev/null +++ b/mozilla/extensions/layout-debug/plugin/Makefile.in @@ -0,0 +1,98 @@ +# +# 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. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = npdebug +LIBRARY_NAME = npdebug +RESFILE = npdebug.res +DEFFILE = npdebug.def + +REQUIRES= xpcom \ + dom \ + necko\ + string \ + widget \ + locale \ + view \ + pref \ + gfx2 \ + imglib2 \ + unicharutil \ + java \ + debug \ + plugin \ + $(NULL) + +# plugins should always be shared, even in the "static" build +FORCE_SHARED_LIB = 1 + +# Force use of PIC +FORCE_USE_PIC = 1 + +NO_DIST_INSTALL = 1 +NO_INSTALL = 1 + + +XPIDLSRCS = nsIDebugPlugin.idl + +CPPSRCS = plugin.cpp \ + nsScriptablePeer.cpp \ + np_entry.cpp \ + npn_gate.cpp \ + npp_gate.cpp \ + $(NULL) + +LOCAL_INCLUDES = -I$(XPIDL_GEN_DIR) -I./include + +EXTRA_DSO_LDOPTS += \ + -L$(DIST)/lib \ + $(MOZ_COMPONENT_XPCOM_LIBS) \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS) $(MOZ_GTK_CFLAGS) + +clobber:: + $(RM) *.sbr + $(RM) $(XPDIST)\idl\nsIDebugPlugin.idl + $(RM) $(XPDIST)\include\nsIDebugPlugin.h + $(RM) $(DIST)\bin\plugins\$(LIBRARY_NAME).xpt + $(RM) $(DIST)\bin\plugins\$(SHARED_LIBRARY) + +install-plugin: $(SHARED_LIBRARY) +ifdef SHARED_LIBRARY + $(INSTALL) $(XPIDL_GEN_DIR)/$(LIBRARY_NAME).xpt $(DIST)/bin/plugins + $(INSTALL) $(SHARED_LIBRARY) $(DIST)/bin/plugins +endif + +libs:: install-plugin + +install:: $(SHARED_LIBRARY) +ifdef SHARED_LIBRARY + $(SYSINSTALL) $(IFLAGS2) $< $(DESTDIR)$(mozappdir)/plugins +endif diff --git a/mozilla/extensions/layout-debug/plugin/common/makefile.win b/mozilla/extensions/layout-debug/plugin/common/makefile.win deleted file mode 100644 index 1c589ee3878..00000000000 --- a/mozilla/extensions/layout-debug/plugin/common/makefile.win +++ /dev/null @@ -1,61 +0,0 @@ -#!nmake -# -# 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. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\..\.. - -REQUIRES= xpcom \ - dom \ - necko\ - string \ - widget \ - locale \ - view \ - pref \ - gfx2 \ - imglib2 \ - unicharutil \ - java \ - debug \ - plugin \ - $(NULL) - -include <$(DEPTH)\config\config.mak> - -MAKE_OBJ_TYPE = LIB -LIBRARY_NAME = plugingate -LIB=.\$(OBJDIR)\$(LIBRARY_NAME).lib - -CFLAGS = $(CFLAGS) -I..\include -I..\..\include - -OBJS = \ - .\$(OBJDIR)\npn_gate.obj \ - .\$(OBJDIR)\npp_gate.obj \ - .\$(OBJDIR)\np_entry.obj \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> - -# it will export the lib to the dist/lib dir, so do not forget to remove it -libs:: $(LIB) - $(RM) $(DIST)\lib\$(LIBRARY_NAME).lib - -clobber:: - $(RM) *.sbr diff --git a/mozilla/extensions/layout-debug/plugin/createIDL.bat b/mozilla/extensions/layout-debug/plugin/createIDL.bat deleted file mode 100755 index 1810f75f079..00000000000 --- a/mozilla/extensions/layout-debug/plugin/createIDL.bat +++ /dev/null @@ -1,7 +0,0 @@ - - -..\..\..\dist\WIN32_D.obj\bin\xpidl -m header -I idl nsIDebugPlugin.idl - - - -..\..\..\dist\WIN32_D.obj\bin\xpidl -m typelib -I idl nsIDebugPlugin.idl \ No newline at end of file diff --git a/mozilla/extensions/layout-debug/plugin/idl/nsISupports.idl b/mozilla/extensions/layout-debug/plugin/idl/nsISupports.idl deleted file mode 100644 index 0b0237fc62a..00000000000 --- a/mozilla/extensions/layout-debug/plugin/idl/nsISupports.idl +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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. - * - * 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 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 ***** */ - -/** - * The mother of all xpcom interfaces. - * @status FROZEN - */ - -/* In order to get both the right typelib and the right header we force -* the 'real' output from xpidl to be commentout out in the generated header -* and includes a copy of the original nsISupports.h. This is all just to deal -* with the Mac specific ": public __comobject" thing. -*/ - -#include "nsrootidl.idl" - -%{C++ -/* - * Start commenting out the C++ versions of the below in the output header - */ -#if 0 -%} - -[scriptable, uuid(00000000-0000-0000-c000-000000000046)] -interface nsISupports { - void QueryInterface(in nsIIDRef uuid, - [iid_is(uuid),retval] out nsQIResult result); - [noscript, notxpcom] nsrefcnt AddRef(); - [noscript, notxpcom] nsrefcnt Release(); -}; - -%{C++ -/* - * End commenting out the C++ versions of the above in the output header - */ -#endif -%} - - -%{C++ -#include "nsISupportsBase.h" - -#ifndef MOZILLA_STRICT_API -#include "nsISupportsUtils.h" -#endif -%} diff --git a/mozilla/extensions/layout-debug/plugin/idl/nsrootidl.idl b/mozilla/extensions/layout-debug/plugin/idl/nsrootidl.idl deleted file mode 100644 index aac25a804a3..00000000000 --- a/mozilla/extensions/layout-debug/plugin/idl/nsrootidl.idl +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * 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. - * - * 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): - * Dan Rosen - * - * 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 ***** */ - -/** - * Root idl declarations to be used by all. - * @status FROZEN - */ - -%{C++ - -#include "nscore.h" -#include "prtime.h" - -/* - * Start commenting out the C++ versions of the below in the output header - */ -#if 0 -%} - -typedef boolean PRBool ; -typedef octet PRUint8 ; -typedef unsigned short PRUint16 ; -typedef unsigned short PRUnichar; -typedef unsigned long PRUint32 ; -typedef unsigned long long PRUint64 ; -typedef unsigned long long PRTime ; -typedef short PRInt16 ; -typedef long PRInt32 ; -typedef long long PRInt64 ; - -typedef unsigned long nsrefcnt ; -typedef unsigned long nsresult ; - -// XXX need this built into xpidl compiler so that it's really size_t or PRSize -// and it's scriptable: -typedef unsigned long size_t; - -[ptr] native voidPtr(void); -[ptr] native charPtr(char); -[ptr] native unicharPtr(PRUnichar); - -[ref, nsid] native nsIDRef(nsID); -[ref, nsid] native nsIIDRef(nsIID); -[ref, nsid] native nsCIDRef(nsCID); - -[ptr, nsid] native nsIDPtr(nsID); -[ptr, nsid] native nsIIDPtr(nsIID); -[ptr, nsid] native nsCIDPtr(nsCID); - -// NOTE: Be careful in using the following 3 types. The *Ref and *Ptr variants -// are more commonly used (and better supported). Those variants require -// nsMemory alloc'd copies when used as 'out' params while these types do not. -// However, currently these types can not be used for 'in' params. And, methods -// that use them as 'out' params *must* be declared [notxpcom] (with an explicit -// return type of nsresult). This makes such methods implicitly not scriptable. -// Use of these types in methods without a [notxpcom] declaration will cause -// the xpidl compiler to raise an error. -// See: http://bugzilla.mozilla.org/show_bug.cgi?id=93792 - -[nsid] native nsIID(nsIID); -[nsid] native nsID(nsID); -[nsid] native nsCID(nsCID); - -[ptr] native nsQIResult(void); - -[ref, domstring] native DOMString(ignored); -[ref, domstring] native DOMStringRef(ignored); -[ptr, domstring] native DOMStringPtr(ignored); - -[ref, domstring] native AString(ignored); -[ref, domstring] native AStringRef(ignored); -[ptr, domstring] native AStringPtr(ignored); - -%{C++ -/* - * End commenting out the C++ versions of the above in the output header - */ -#endif -%} diff --git a/mozilla/extensions/layout-debug/plugin/makefile.win b/mozilla/extensions/layout-debug/plugin/makefile.win deleted file mode 100644 index 0aa4b81d3ac..00000000000 --- a/mozilla/extensions/layout-debug/plugin/makefile.win +++ /dev/null @@ -1,85 +0,0 @@ -#!nmake -# -# 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. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\.. -MODULE = npdebug -REQUIRES= xpcom \ - dom \ - necko\ - string \ - widget \ - locale \ - view \ - pref \ - gfx2 \ - imglib2 \ - unicharutil \ - java \ - debug \ - plugin \ - $(NULL) - -include <$(DEPTH)\config\config.mak> - - - - -XPIDLSRCS = \ - .\nsIDebugPlugin.idl \ - $(NULL) - -MAKE_OBJ_TYPE = DLL -DLLNAME = npdebug -RESFILE = npdebug.res -DEFFILE = npdebug.def -DLL=.\$(OBJDIR)\$(DLLNAME).dll - -CFLAGS = $(CFLAGS) -I.\include - - -OBJS = \ - .\$(OBJDIR)\plugin.obj \ - .\$(OBJDIR)\nsScriptablePeer.obj \ - $(NULL) - -LLIBS = \ - .\common\$(OBJDIR)\plugingate.lib \ - $(DIST)\lib\xpcom.lib \ - $(NULL) - -WIN_LIBS = version.lib - -include <$(DEPTH)\config\rules.mak> - -# don't forget to remove files exported by default -libs:: $(DLL) - $(RM) $(XPDIST)\idl\nsIDebugPlugin.idl - $(RM) $(XPDIST)\include\nsIDebugPlugin.h -# $(RM) $(DIST)\bin\components\$(DLLNAME).xpt - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\plugins - - -clobber:: - $(RM) *.sbr - $(RM) $(XPDIST)\idl\nsIDebugPlugin.idl - $(RM) $(XPDIST)\include\nsIDebugPlugin.h - $(RM) $(DIST)\bin\components\$(DLLNAME).xpt - $(RM) $(DIST)\bin\plugins\$(DLLNAME).dll diff --git a/mozilla/extensions/layout-debug/plugin/common/np_entry.cpp b/mozilla/extensions/layout-debug/plugin/np_entry.cpp similarity index 100% rename from mozilla/extensions/layout-debug/plugin/common/np_entry.cpp rename to mozilla/extensions/layout-debug/plugin/np_entry.cpp diff --git a/mozilla/extensions/layout-debug/plugin/npdebug.def b/mozilla/extensions/layout-debug/plugin/npdebug.def index 227d26c721c..b4208b8814c 100644 --- a/mozilla/extensions/layout-debug/plugin/npdebug.def +++ b/mozilla/extensions/layout-debug/plugin/npdebug.def @@ -1,4 +1,4 @@ -LIBRARY NPSIMPLE +LIBRARY npdebug EXPORTS NP_GetEntryPoints @1 diff --git a/mozilla/extensions/layout-debug/plugin/npdebug.rc b/mozilla/extensions/layout-debug/plugin/npdebug.rc index ab877c683a8..b756e530648 100644 --- a/mozilla/extensions/layout-debug/plugin/npdebug.rc +++ b/mozilla/extensions/layout-debug/plugin/npdebug.rc @@ -46,15 +46,15 @@ BEGIN BEGIN VALUE "Comments", "\0" VALUE "CompanyName", " \0" - VALUE "FileDescription", "npdebug\0" + VALUE "FileDescription", "Debugger Plug-in\0" VALUE "FileExtents", "spl\0" - VALUE "FileOpenName", "npdebug\0" + VALUE "FileOpenName", "Layout Debug Plug-in (*.*)\0" VALUE "FileVersion", "1, 0, 0, 1\0" VALUE "InternalName", "npdebug\0" VALUE "LegalCopyright", "Copyright © 2002\0" VALUE "LegalTrademarks", "\0" VALUE "MIMEType", "application/debug-plugin\0" - VALUE "OriginalFilename", "npsimple.dll\0" + VALUE "OriginalFilename", "npdebug.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Debug Example Plugin for Mozilla\0" VALUE "ProductVersion", "1, 0, 0, 1\0" diff --git a/mozilla/extensions/layout-debug/plugin/common/npn_gate.cpp b/mozilla/extensions/layout-debug/plugin/npn_gate.cpp similarity index 100% rename from mozilla/extensions/layout-debug/plugin/common/npn_gate.cpp rename to mozilla/extensions/layout-debug/plugin/npn_gate.cpp diff --git a/mozilla/extensions/layout-debug/plugin/common/npp_gate.cpp b/mozilla/extensions/layout-debug/plugin/npp_gate.cpp similarity index 100% rename from mozilla/extensions/layout-debug/plugin/common/npp_gate.cpp rename to mozilla/extensions/layout-debug/plugin/npp_gate.cpp diff --git a/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.h b/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.h deleted file mode 100644 index 891faaee942..00000000000 --- a/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * DO NOT EDIT. THIS FILE IS GENERATED FROM nsIDebugPlugin.idl - */ - -#ifndef __gen_nsIDebugPlugin_h__ -#define __gen_nsIDebugPlugin_h__ - - -#ifndef __gen_nsISupports_h__ -#include "nsISupports.h" -#endif - -/* For IDL files that don't want to include root IDL files. */ -#ifndef NS_NO_VTABLE -#define NS_NO_VTABLE -#endif - -/* starting interface: nsIDebugPlugin */ -#define NS_IDEBUGPLUGIN_IID_STR "482e1890-1fe5-11d5-9cf8-0060b0fbd8ac" - -#define NS_IDEBUGPLUGIN_IID \ - {0x482e1890, 0x1fe5, 0x11d5, \ - { 0x9c, 0xf8, 0x00, 0x60, 0xb0, 0xfb, 0xd8, 0xac }} - -class NS_NO_VTABLE nsIDebugPlugin : public nsISupports { - public: - - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDEBUGPLUGIN_IID) - - /* readonly attribute string version; */ - 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); */ - NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) = 0; - - /* void StartDirectorySearch (in string aFilePath); */ - NS_IMETHOD StartDirectorySearch(const char *aFilePath) = 0; - - /* void GetNextFileInDirectory ([retval] out string aFileName); */ - NS_IMETHOD GetNextFileInDirectory(char **aFileName) = 0; - - /* void CompareLayoutFiles (in wstring aBasePath, in wstring aVerPath, in wstring aBaseFile, in wstring aVerFile, in unsigned long aFlags, [retval] out long aResult); */ - NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) = 0; - -}; - -/* Use this macro when declaring classes that implement this interface. */ -#define NS_DECL_NSIDEBUGPLUGIN \ - 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 StartDirectorySearch(const char *aFilePath); \ - NS_IMETHOD GetNextFileInDirectory(char **aFileName); \ - NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult); - -/* Use this macro to declare functions that forward the behavior of this interface to another object. */ -#define NS_FORWARD_NSIDEBUGPLUGIN(_to) \ - 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 StartDirectorySearch(const char *aFilePath) { return _to StartDirectorySearch(aFilePath); } \ - NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return _to GetNextFileInDirectory(aFileName); } \ - NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) { return _to CompareLayoutFiles(aBasePath, aVerPath, aBaseFile, aVerFile, aFlags, aResult); } - -/* 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) \ - 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 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 CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->CompareLayoutFiles(aBasePath, aVerPath, aBaseFile, aVerFile, aFlags, aResult); } - -#if 0 -/* Use the code below as a template for the implementation class for this interface. */ - -/* Header file */ -class nsDebugPlugin : public nsIDebugPlugin -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDEBUGPLUGIN - - nsDebugPlugin(); - virtual ~nsDebugPlugin(); - /* additional members */ -}; - -/* Implementation file */ -NS_IMPL_ISUPPORTS1(nsDebugPlugin, nsIDebugPlugin) - -nsDebugPlugin::nsDebugPlugin() -{ - NS_INIT_ISUPPORTS(); - /* member initializers and constructor code */ -} - -nsDebugPlugin::~nsDebugPlugin() -{ - /* destructor code */ -} - -/* readonly attribute string version; */ -NS_IMETHODIMP nsDebugPlugin::GetVersion(char * *aVersion) -{ - 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); */ -NS_IMETHODIMP nsDebugPlugin::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void StartDirectorySearch (in string aFilePath); */ -NS_IMETHODIMP nsDebugPlugin::StartDirectorySearch(const char *aFilePath) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void GetNextFileInDirectory ([retval] out string aFileName); */ -NS_IMETHODIMP nsDebugPlugin::GetNextFileInDirectory(char **aFileName) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void CompareLayoutFiles (in wstring aBasePath, in wstring aVerPath, in wstring aBaseFile, in wstring aVerFile, in unsigned long aFlags, [retval] out long aResult); */ -NS_IMETHODIMP nsDebugPlugin::CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* End of implementation class template. */ -#endif - - -#endif /* __gen_nsIDebugPlugin_h__ */ diff --git a/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.idl b/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.idl index 92adda3b9a2..ff96deaab33 100644 --- a/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.idl +++ b/mozilla/extensions/layout-debug/plugin/nsIDebugPlugin.idl @@ -30,5 +30,28 @@ interface nsIDebugPlugin : nsISupports { void StartDirectorySearch(in string aFilePath); void GetNextFileInDirectory([retval] out string aFileName); void CompareLayoutFiles(in wstring aBasePath,in wstring aVerPath,in wstring aBaseFile,in wstring aVerFile,in unsigned long aFlags,[retval] out long aResult); + void PluginShutdown(); + + /** + * Printing Runtime Error Checking + */ + const short PRT_RUNTIME_NONE = 0; + const short PRT_RUNTIME_CHECKFORPRINTERS = 1; + const short PRT_RUNTIME_CREATEPRTSESSION = 2; + const short PRT_RUNTIME_INITPRTOBJ = 3; + const short PRT_RUNTIME_CREATESPECFACTORY = 4; + const short PRT_RUNTIME_NOPROMPTSERVICE = 5; + const short PRT_RUNTIME_NODEVSPEC = 6; + const short PRT_RUNTIME_NEXTPAGE = 7; + const short PRT_RUNTIME_REFLOWDOCLIST = 8; + const short PRT_RUNTIME_PREPAREDOC = 9; + const short PRT_RUNTIME_BEGINDOC = 10; + + attribute boolean doRuntimeTests; // indicates whether the runtime test will be run + attribute short testId; // id of test to run + attribute boolean printAsIs; // print asis when printing to a file + attribute wstring printFileName; // name of output file + + void SetBoolPref(in wstring aPrefName, in boolean aVal); }; diff --git a/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.cpp b/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.cpp index 10364148d0c..e79358dc581 100644 --- a/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.cpp +++ b/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.cpp @@ -53,31 +53,16 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); nsScriptablePeer::nsScriptablePeer(nsPluginInstance* aPlugin) { + NS_INIT_ISUPPORTS(); mPlugin = aPlugin; - mRefCnt = 0; } nsScriptablePeer::~nsScriptablePeer() { } -// AddRef, Release and QueryInterface are common methods and must -// be implemented for any interface -NS_IMETHODIMP_(nsrefcnt) nsScriptablePeer::AddRef() -{ - ++mRefCnt; - return mRefCnt; -} - -NS_IMETHODIMP_(nsrefcnt) nsScriptablePeer::Release() -{ - --mRefCnt; - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} +NS_IMPL_ADDREF(nsScriptablePeer) +NS_IMPL_RELEASE(nsScriptablePeer) // here nsScriptablePeer should return three interfaces it can be asked for by their iid's // static casts are necessary to ensure that correct pointer is returned @@ -113,24 +98,21 @@ NS_IMETHODIMP nsScriptablePeer::QueryInterface(const nsIID& aIID, void** aInstan NS_IMETHODIMP nsScriptablePeer::GetVersion(char * *aVersion) { if (mPlugin) - mPlugin->getVersion(aVersion); + mPlugin->GetVersion(aVersion); 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 mPlugin->CreateDirectory(aFilePath,aFlags,&retVal); } return NS_OK; } - - NS_IMETHODIMP nsScriptablePeer::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags, PRInt32 *aResult) { @@ -174,7 +156,7 @@ NS_IMETHODIMP nsScriptablePeer::StartDirectorySearch(const char *aFilePath) { if (mPlugin) - mPlugin->StartDirectorySearch(aFilePath); + return mPlugin->StartDirectorySearch(aFilePath); return NS_OK; } @@ -184,8 +166,85 @@ NS_IMETHODIMP nsScriptablePeer::GetNextFileInDirectory(char **aFilePath) { if (mPlugin) - mPlugin->GetNextFileInDirectory(aFilePath); - + return mPlugin->GetNextFileInDirectory(aFilePath); return NS_OK; } + +NS_IMETHODIMP nsScriptablePeer::SetBoolPref(const PRUnichar *aPrefName, PRBool aVal) +{ + if (mPlugin) + return mPlugin->SetBoolPref(aPrefName, aVal); + return NS_ERROR_FAILURE; +} + +/* attribute boolean doRuntimeTests; */ +NS_IMETHODIMP +nsScriptablePeer::GetDoRuntimeTests(PRBool *aDoRuntimeTests) +{ + if (mPlugin) + return mPlugin->GetDoRuntimeTests(aDoRuntimeTests); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsScriptablePeer::SetDoRuntimeTests(PRBool aDoRuntimeTests) +{ + if (mPlugin) + return mPlugin->SetDoRuntimeTests(aDoRuntimeTests); + return NS_ERROR_FAILURE; +} + +/* attribute short testId; */ +NS_IMETHODIMP +nsScriptablePeer::GetTestId(PRInt16 *aTestId) +{ + if (mPlugin) + return mPlugin->GetTestId(aTestId); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsScriptablePeer::SetTestId(PRInt16 aTestId) +{ + if (mPlugin) + return mPlugin->SetTestId(aTestId); + return NS_ERROR_FAILURE; +} + +/* attribute boolean printAsIs; */ +NS_IMETHODIMP +nsScriptablePeer::GetPrintAsIs(PRBool *aPrintAsIs) +{ + if (mPlugin) + return mPlugin->GetPrintAsIs(aPrintAsIs); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsScriptablePeer::SetPrintAsIs(PRBool aPrintAsIs) +{ + if (mPlugin) + return mPlugin->SetPrintAsIs(aPrintAsIs); + return NS_ERROR_FAILURE; +} + +/* attribute wstring printFileName; */ +NS_IMETHODIMP nsScriptablePeer::GetPrintFileName(PRUnichar * *aPrintFileName) +{ + if (mPlugin) + return mPlugin->GetPrintFileName(aPrintFileName); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP nsScriptablePeer::SetPrintFileName(const PRUnichar * aPrintFileName) +{ + if (mPlugin) + return mPlugin->SetPrintFileName(aPrintFileName); + return NS_ERROR_FAILURE; +} + +/* void PluginShutdown (); */ +NS_IMETHODIMP nsScriptablePeer::PluginShutdown() +{ + mPlugin = nsnull; + return NS_OK; +} + + diff --git a/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.h b/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.h index fac4a713ea4..40c6e77e87c 100644 --- a/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.h +++ b/mozilla/extensions/layout-debug/plugin/nsScriptablePeer.h @@ -86,16 +86,7 @@ public: ~nsScriptablePeer(); public: - // methods from nsISupports - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD_(nsrefcnt) AddRef(); - NS_IMETHOD_(nsrefcnt) Release(); - -protected: - nsrefcnt mRefCnt; - -public: - // native methods callable from JavaScript + NS_DECL_ISUPPORTS NS_DECL_NSIDEBUGPLUGIN protected: diff --git a/mozilla/extensions/layout-debug/plugin/plugin.cpp b/mozilla/extensions/layout-debug/plugin/plugin.cpp index 3f22a2017cc..9db45981620 100644 --- a/mozilla/extensions/layout-debug/plugin/plugin.cpp +++ b/mozilla/extensions/layout-debug/plugin/plugin.cpp @@ -46,6 +46,7 @@ #include "nsMemory.h" #include "nsNetUtil.h" #include "nsString.h" +#include "nsIPref.h" // service manager which will give the access to all public browser services // we will use memory service as an illustration @@ -56,8 +57,8 @@ nsIServiceManager * gServiceManager = NULL; // Unix needs this #ifdef XP_UNIX #define MIME_TYPES_HANDLED "application/debug-plugin" -#define PLUGIN_NAME "Debug Plugin" -#define PLUGIN_DESCRIPTION "Debug Plugin" +#define PLUGIN_NAME "Layout Debug Plugin" +#define PLUGIN_DESCRIPTION "Layout Debug Plugin" char* NPP_GetMIMEDescription(void) { @@ -103,6 +104,9 @@ nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * aCreateDataStru return NULL; nsPluginInstance * plugin = new nsPluginInstance(aCreateDataStruct->instance); + if (plugin) { + plugin->init(nsnull); + } return plugin; } @@ -131,15 +135,21 @@ nsPluginInstance::~nsPluginInstance() NPBool nsPluginInstance::init(NPWindow* aWindow) { + mDebugObj = do_GetService("@mozilla.org/debug/debugobject;1"); + if(aWindow == NULL) return FALSE; mInitialized = TRUE; + return TRUE; } void nsPluginInstance::shut() { + mScriptablePeer->PluginShutdown(); + + mDebugObj = nsnull; mInitialized = FALSE; } @@ -148,7 +158,8 @@ NPBool nsPluginInstance::isInitialized() return mInitialized; } -void nsPluginInstance::getVersion(char* *aVersion) +NS_IMETHODIMP +nsPluginInstance::GetVersion(char * *aVersion) { const char *ua = NPN_UserAgent(mInstance); char*& version = *aVersion; @@ -171,86 +182,76 @@ void nsPluginInstance::getVersion(char* *aVersion) // release service NS_IF_RELEASE(nsMemoryService); + return NS_OK; } //----------------------------------------------------- -void nsPluginInstance::OutPutLayoutFrames(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRUint32 aFlags , PRInt32 *aRetVal) +void +nsPluginInstance::OutPutLayoutFrames(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, 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->DumpContent(aWindow,aFilePath,aFileName,aFlags); - } + if(mDebugObj){ + *aRetVal = mDebugObj->DumpContent(aWindow,aFilePath,aFileName,aFlags); } } //----------------------------------------------------- -void nsPluginInstance::CreateDirectory(const PRUnichar *aBasePath, PRUint32 aFlags, PRInt32 *aRetVal) +NS_IMETHODIMP +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); - } + if(mDebugObj){ + *aRetVal = mDebugObj->CreateDirectory(aBasePath, aFlags); } + return NS_OK; } //----------------------------------------------------- -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) { - 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->CompareFrameModels(aBasePath,aVerPath,aBaseFile,aVerFile,aFlags); - } + if(mDebugObj){ + *aRetVal = mDebugObj->CompareFrameModels(aBasePath,aVerPath,aBaseFile,aVerFile,aFlags); } } //----------------------------------------------------- -void +NS_IMETHODIMP nsPluginInstance::StartDirectorySearch(const char *aFilePath) { nsXPIDLCString dirPath; nsresult rv; - nsCOMPtr theDir = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); - rv = NS_InitFileFromURLSpec(theDir, nsDependentCString(aFilePath)); - - if (NS_FAILED(rv)){ + nsCString dirStr(aFilePath); + nsCOMPtr theDir; + rv = NS_GetFileFromURLSpec(dirStr, getter_AddRefs(theDir)); + if (NS_FAILED(rv)) { + printf("nsPluginInstance::StartDirectorySearch failed on creation of nsIFile [%s]\n", aFilePath); mIter = 0; - return; + return NS_OK; } rv = theDir->GetDirectoryEntries(getter_AddRefs(mIter)); if (NS_FAILED(rv)){ + printf("nsPluginInstance::StartDirectorySearch failed on GetDirectoryEntries of nsIFile [%s]\n", aFilePath); mIter = 0; - return; + return NS_OK; } + return NS_OK; } //----------------------------------------------------- -void +NS_IMETHODIMP nsPluginInstance::GetNextFileInDirectory(char **aDirName) { PRBool hasMore; @@ -260,7 +261,7 @@ char* URLName; *aDirName = 0; if ( 0 ==mIter ){ - return; + return NS_OK; } while ( NS_SUCCEEDED(mIter->HasMoreElements(&hasMore)) ){ @@ -292,8 +293,105 @@ char* URLName; nsMemory::Free(afilepath); } } + return NS_OK; } +NS_IMETHODIMP +nsPluginInstance::CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, + const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsPluginInstance::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, + PRUint32 aFlags, PRInt32 *aResult) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void PluginShutdown (); */ +NS_IMETHODIMP +nsPluginInstance::PluginShutdown() +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + + + +NS_IMETHODIMP +nsPluginInstance::SetBoolPref(const PRUnichar *aPrefName, PRBool aVal) +{ + nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID)); + if (prefs) { + nsCString prefName; + prefName.AssignWithConversion(aPrefName); + prefs->SetBoolPref(prefName.get(), aVal); + } + return NS_OK; +} + +/* attribute boolean doRuntimeTests; */ +NS_IMETHODIMP +nsPluginInstance::GetDoRuntimeTests(PRBool *aDoRuntimeTests) +{ + if (mDebugObj) + return mDebugObj->GetDoRuntimeTests(aDoRuntimeTests); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsPluginInstance::SetDoRuntimeTests(PRBool aDoRuntimeTests) +{ + if (mDebugObj) + return mDebugObj->SetDoRuntimeTests(aDoRuntimeTests); + return NS_ERROR_FAILURE; +} + +/* attribute short testId; */ +NS_IMETHODIMP +nsPluginInstance::GetTestId(PRInt16 *aTestId) +{ + if (mDebugObj) + return mDebugObj->GetTestId(aTestId); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsPluginInstance::SetTestId(PRInt16 aTestId) +{ + if (mDebugObj) + return mDebugObj->SetTestId(aTestId); + return NS_ERROR_FAILURE; +} + +/* attribute boolean printAsIs; */ +NS_IMETHODIMP +nsPluginInstance::GetPrintAsIs(PRBool *aPrintAsIs) +{ + if (mDebugObj) + return mDebugObj->GetPrintAsIs(aPrintAsIs); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP +nsPluginInstance::SetPrintAsIs(PRBool aPrintAsIs) +{ + if (mDebugObj) + return mDebugObj->SetPrintAsIs(aPrintAsIs); + return NS_ERROR_FAILURE; +} + +/* attribute wstring printFileName; */ +NS_IMETHODIMP nsPluginInstance::GetPrintFileName(PRUnichar * *aPrintFileName) +{ + if (mDebugObj) + return mDebugObj->GetPrintFileName(aPrintFileName); + return NS_ERROR_FAILURE; +} +NS_IMETHODIMP nsPluginInstance::SetPrintFileName(const PRUnichar * aPrintFileName) +{ + if (mDebugObj) + return mDebugObj->SetPrintFileName(aPrintFileName); + return NS_ERROR_FAILURE; +} //----------------------------------------------------- @@ -371,3 +469,5 @@ nsIDebugPlugin* nsPluginInstance::getScriptablePeer() return NULL; } + + diff --git a/mozilla/extensions/layout-debug/plugin/plugin.h b/mozilla/extensions/layout-debug/plugin/plugin.h index 28a020a2845..f76bfd8dd3a 100644 --- a/mozilla/extensions/layout-debug/plugin/plugin.h +++ b/mozilla/extensions/layout-debug/plugin/plugin.h @@ -43,6 +43,7 @@ #include "nsIFile.h" #include "nsILocalFile.h" #include "nsISimpleEnumerator.h" +#include "nsIDebugObject.h" class nsPluginInstance : public nsPluginInstanceBase { @@ -60,22 +61,20 @@ public: NPError GetValue(NPPVariable variable, void *value); // locals - 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 CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal); - void StartDirectorySearch(const char *aFilePath); - void GetNextFileInDirectory(char **aFilePath); nsIDebugPlugin* getScriptablePeer(); + NS_DECL_NSIDEBUGPLUGIN + private: NPP mInstance; NPBool mInitialized; nsIDebugPlugin * mScriptablePeer; nsCOMPtr mIter; - + nsCOMPtr mDebugObj; public: char mString[128]; }; diff --git a/mozilla/extensions/layout-debug/plugin/printRuntimeTests.html b/mozilla/extensions/layout-debug/plugin/printRuntimeTests.html new file mode 100644 index 00000000000..c045a0aa9cc --- /dev/null +++ b/mozilla/extensions/layout-debug/plugin/printRuntimeTests.html @@ -0,0 +1,428 @@ + + +Debug Plug-in Test + + + + + +
+

Printing XPConnect Scriptable Debug Plug-in Regression Page

+
+
+ + +
+
+ + + + + + + + + + + + + + +
Error TestsPrint out Tests
  + +
+
      
+ + + + + + + +
Drive: +
+
Custom:
+
+
+ + + + + + + diff --git a/mozilla/extensions/layout-debug/plugin/resource.h b/mozilla/extensions/layout-debug/plugin/resource.h index 864d18674f5..ed6482a0dad 100644 --- a/mozilla/extensions/layout-debug/plugin/resource.h +++ b/mozilla/extensions/layout-debug/plugin/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. -// Used by npDebug.rc +// Used by npdebug.rc // #define IDD_MAIN 101 #define IDC_BUTTON_GO 1002 diff --git a/mozilla/extensions/layout-debug/plugin/tableRegression.html b/mozilla/extensions/layout-debug/plugin/tableRegression.html index 4e5b9aad6cc..19d5500a59f 100644 --- a/mozilla/extensions/layout-debug/plugin/tableRegression.html +++ b/mozilla/extensions/layout-debug/plugin/tableRegression.html @@ -84,7 +84,7 @@ var myArray = new Array(15); function CompareFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile) { - err = embed.CompareLayoutFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile,1); + var err = embed.CompareLayoutFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile,1); if(err == 0) { WriteOutput("File \" "+aVerFile + "\" PASSED",false,"success",true,true ); @@ -97,7 +97,7 @@ function CompareFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile) function ClearOutput() { - textarea = document.getElementById('output'); + var textarea = document.getElementById('output'); textarea.innerHTML = ""; } @@ -106,10 +106,10 @@ function ClearOutput() function WriteOutput( aText, aReplace, aTextColor,aToStatus, aToOutPut ) { - textarea = document.getElementById('output'); - statusarea = document.getElementById('status'); + var textarea = document.getElementById('output'); + var statusarea = document.getElementById('status'); - thecolor = ""; + var thecolor = ""; if(aTextColor == "failure") thecolor = ""; if(aTextColor == "success") @@ -155,10 +155,10 @@ function placeWindows(aOutputWindow,aTestWindow) aOutputWindow.statusbar.visible = false; aOutputWindow.toolbar.visible = false; - top = window.screen.availTop; - left = window.screen.availLeft; - height = window.screen.availHeight; - width = window.screen.availWidth; + var top = window.screen.availTop; + var left = window.screen.availLeft; + var height = window.screen.availHeight; + var width = window.screen.availWidth; if (height > 1000) { height = 800; } else { @@ -238,6 +238,8 @@ function DumpDirectoryies(aTestType) baseExt = ".bas"; verExt = ".ver"; + var dirURL; + var err; // create the output directories if ( testType == 1 ) { dirURL = "file:///"+ baseDir; diff --git a/mozilla/extensions/layout-debug/idl/makefile.win b/mozilla/extensions/layout-debug/public/Makefile.in similarity index 78% rename from mozilla/extensions/layout-debug/idl/makefile.win rename to mozilla/extensions/layout-debug/public/Makefile.in index 2fbce0ff850..7adff31ab0b 100644 --- a/mozilla/extensions/layout-debug/idl/makefile.win +++ b/mozilla/extensions/layout-debug/public/Makefile.in @@ -1,4 +1,3 @@ -#!nmake # # The contents of this file are subject to the Netscape Public # License Version 1.1 (the "License"); you may not use this file @@ -18,19 +17,20 @@ # Rights Reserved. # # Contributor(s): +# -DEPTH=..\..\.. +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +include $(DEPTH)/config/autoconf.mk -DEFINES=-D_IMPL_NS_UI -MODULE=debug +MODULE = debug -XPIDLSRCS = \ - .\nsIDebugObject.idl \ - $(NULL) +EXPORTS = \ + nsDebugCIID.h \ + $(NULL) -EXPORTS= \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/layout-debug/src/Makefile.in b/mozilla/extensions/layout-debug/src/Makefile.in new file mode 100644 index 00000000000..e4c76c31d00 --- /dev/null +++ b/mozilla/extensions/layout-debug/src/Makefile.in @@ -0,0 +1,71 @@ +# +# 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. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = debug +LIBRARY_NAME = gkdebug +EXPORT_LIBRARY = 1 +IS_COMPONENT = 1 +MODULE_NAME = nsDebugModule + +REQUIRES= xpcom \ + string \ + debugobject\ + windowwatcher\ + docshell\ + string \ + dom\ + gfx\ + content\ + necko\ + layout\ + widget \ + locale \ + view \ + pref \ + gfx2 \ + imglib2 \ + unicharutil \ + $(NULL) + +CPPSRCS = \ + nsDebugObject.cpp \ + nsDebugFactory.cpp \ + $(NULL) + +EXTRA_DSO_LDOPTS = \ + $(LIBS_DIRS) \ + $(MOZ_UNICHARUTIL_LIBS) \ + $(MOZ_COMPONENT_LIBS) \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +libs:: + +clobber:: + rm -f $(DIST)\lib\library diff --git a/mozilla/extensions/layout-debug/src/makefile.win b/mozilla/extensions/layout-debug/src/makefile.win deleted file mode 100644 index 446d4bd1d4d..00000000000 --- a/mozilla/extensions/layout-debug/src/makefile.win +++ /dev/null @@ -1,72 +0,0 @@ -#!nmake -# -# 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. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\.. - -MODULE=debug - - -REQUIRES= xpcom \ - string \ - debugobject\ - windowwatcher\ - docshell\ - string \ - dom\ - gfx\ - content\ - necko\ - layout\ - widget \ - locale \ - view \ - pref \ - gfx2 \ - imglib2 \ - unicharutil \ - $(NULL) - -include <$(DEPTH)\config\config.mak> - -LIBRARY_NAME=gkdebug -MODULE_NAME=nsDebugModule - - -CPP_OBJS=.\$(OBJDIR)\nsDebugObject.obj \ - .\$(OBJDIR)\nsDebugFactory.obj \ - $(NULL) - - -LCFLAGS = \ - $(LCFLAGS) \ - $(DEFINES) \ - $(NULL) - -LLIBS= \ - $(DIST)\lib\util.lib \ - $(DIST)\lib\xpcom.lib - -include <$(DEPTH)\config\rules.mak> - -libs:: - -clobber:: - rm -f $(DIST)\lib\library diff --git a/mozilla/extensions/layout-debug/src/nsDebugObject.cpp b/mozilla/extensions/layout-debug/src/nsDebugObject.cpp index a8db7a5670f..4e3792526b0 100644 --- a/mozilla/extensions/layout-debug/src/nsDebugObject.cpp +++ b/mozilla/extensions/layout-debug/src/nsDebugObject.cpp @@ -38,6 +38,7 @@ * ***** END LICENSE BLOCK ***** */ #include "nsISupports.h" +#include "nsDebugObject.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" @@ -45,7 +46,6 @@ #include "nsIWindowWatcher.h" #include "nsVoidArray.h" #include "prmem.h" -#include "nsDebugObject.h" #include "nsIDocShellTreeItem.h" #include "nsIDOMWindowInternal.h" #include "nsIPresShell.h" @@ -61,8 +61,11 @@ #include "nsIFrameUtil.h" #include "nsLayoutCID.h" #include "nsNetUtil.h" +#include "nsIFile.h" +#include "nsIPref.h" NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject) + static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID); static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); @@ -70,7 +73,11 @@ static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); * See documentation in nsDebugObject.h * @update 5/16/02 dwc */ -nsDebugObject::nsDebugObject() +nsDebugObject::nsDebugObject() : + mRuntimeTestIsOn(PR_FALSE), + mPrintAsIs(PR_FALSE), + mRuntimeTestId(nsIDebugObject::PRT_RUNTIME_NONE), + mFileName(nsnull) { NS_INIT_ISUPPORTS(); } @@ -81,7 +88,9 @@ nsDebugObject::nsDebugObject() */ nsDebugObject::~nsDebugObject() { - + if (mFileName) { + nsMemory::Free(mFileName); + } } /** --------------------------------------------------- @@ -92,20 +101,24 @@ 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 localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); - rv = NS_InitFileFromURLSpec( localFile,nsDependentCString(dirPath)); - if ( rv == NS_OK) { + nsCString dirStr; + dirStr.AssignWithConversion(aFilePath); + nsCOMPtr localFile; + rv = NS_GetFileFromURLSpec(dirStr, getter_AddRefs(localFile)); + if ( NS_SUCCEEDED(rv) ) { rv = localFile->Exists(&exists); if (!exists){ rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0600); + if (NS_FAILED(rv)) { + printf("Failed to create directory [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); + } + } else { + printf("OK - Directory Exists [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); } + } else { + printf("Failed to init path for local file in CreateDirectory [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); } return result; @@ -219,3 +232,64 @@ FILE *bp,*vp; return result; } +/* attribute boolean doRuntimeTests; */ +NS_IMETHODIMP +nsDebugObject::GetDoRuntimeTests(PRBool *aDoRuntimeTests) +{ + NS_ENSURE_ARG_POINTER(aDoRuntimeTests); + *aDoRuntimeTests = mRuntimeTestIsOn; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetDoRuntimeTests(PRBool aDoRuntimeTests) +{ + mRuntimeTestIsOn = aDoRuntimeTests; + return NS_OK; +} + +/* attribute short testId; */ +NS_IMETHODIMP +nsDebugObject::GetTestId(PRInt16 *aTestId) +{ + NS_ENSURE_ARG_POINTER(aTestId); + *aTestId = mRuntimeTestId; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetTestId(PRInt16 aTestId) +{ + mRuntimeTestId = aTestId; + return NS_OK; +} + +/* attribute boolean printAsIs; */ +NS_IMETHODIMP +nsDebugObject::GetPrintAsIs(PRBool *aPrintAsIs) +{ + NS_ENSURE_ARG_POINTER(aPrintAsIs); + *aPrintAsIs = mPrintAsIs; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetPrintAsIs(PRBool aPrintAsIs) +{ + mPrintAsIs = aPrintAsIs; + return NS_OK; +} + +/* attribute wstring printFileName; */ +NS_IMETHODIMP nsDebugObject::GetPrintFileName(PRUnichar * *aPrintFileName) +{ + *aPrintFileName = nsCRT::strdup(mFileName); + return NS_OK; +} +NS_IMETHODIMP nsDebugObject::SetPrintFileName(const PRUnichar * aPrintFileName) +{ + if (mFileName) { + nsMemory::Free(mFileName); + } + mFileName = nsCRT::strdup(aPrintFileName); + return NS_OK; +} + + diff --git a/mozilla/extensions/layout-debug/src/nsDebugObject.h b/mozilla/extensions/layout-debug/src/nsDebugObject.h index 2e3dabfd544..6b00725313b 100644 --- a/mozilla/extensions/layout-debug/src/nsDebugObject.h +++ b/mozilla/extensions/layout-debug/src/nsDebugObject.h @@ -36,6 +36,11 @@ public: nsDebugObject(); virtual ~nsDebugObject(); +protected: + PRBool mRuntimeTestIsOn; + PRBool mPrintAsIs; + PRInt16 mRuntimeTestId; + PRUnichar* mFileName; }; diff --git a/mozilla/extensions/layout-debug/src/nsRegressionTester.cpp b/mozilla/extensions/layout-debug/src/nsRegressionTester.cpp index a8db7a5670f..4e3792526b0 100644 --- a/mozilla/extensions/layout-debug/src/nsRegressionTester.cpp +++ b/mozilla/extensions/layout-debug/src/nsRegressionTester.cpp @@ -38,6 +38,7 @@ * ***** END LICENSE BLOCK ***** */ #include "nsISupports.h" +#include "nsDebugObject.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" @@ -45,7 +46,6 @@ #include "nsIWindowWatcher.h" #include "nsVoidArray.h" #include "prmem.h" -#include "nsDebugObject.h" #include "nsIDocShellTreeItem.h" #include "nsIDOMWindowInternal.h" #include "nsIPresShell.h" @@ -61,8 +61,11 @@ #include "nsIFrameUtil.h" #include "nsLayoutCID.h" #include "nsNetUtil.h" +#include "nsIFile.h" +#include "nsIPref.h" NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject) + static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID); static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); @@ -70,7 +73,11 @@ static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); * See documentation in nsDebugObject.h * @update 5/16/02 dwc */ -nsDebugObject::nsDebugObject() +nsDebugObject::nsDebugObject() : + mRuntimeTestIsOn(PR_FALSE), + mPrintAsIs(PR_FALSE), + mRuntimeTestId(nsIDebugObject::PRT_RUNTIME_NONE), + mFileName(nsnull) { NS_INIT_ISUPPORTS(); } @@ -81,7 +88,9 @@ nsDebugObject::nsDebugObject() */ nsDebugObject::~nsDebugObject() { - + if (mFileName) { + nsMemory::Free(mFileName); + } } /** --------------------------------------------------- @@ -92,20 +101,24 @@ 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 localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); - rv = NS_InitFileFromURLSpec( localFile,nsDependentCString(dirPath)); - if ( rv == NS_OK) { + nsCString dirStr; + dirStr.AssignWithConversion(aFilePath); + nsCOMPtr localFile; + rv = NS_GetFileFromURLSpec(dirStr, getter_AddRefs(localFile)); + if ( NS_SUCCEEDED(rv) ) { rv = localFile->Exists(&exists); if (!exists){ rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0600); + if (NS_FAILED(rv)) { + printf("Failed to create directory [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); + } + } else { + printf("OK - Directory Exists [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); } + } else { + printf("Failed to init path for local file in CreateDirectory [%s]\n", NS_LossyConvertUCS2toASCII(nsAutoString(aFilePath)).get()); } return result; @@ -219,3 +232,64 @@ FILE *bp,*vp; return result; } +/* attribute boolean doRuntimeTests; */ +NS_IMETHODIMP +nsDebugObject::GetDoRuntimeTests(PRBool *aDoRuntimeTests) +{ + NS_ENSURE_ARG_POINTER(aDoRuntimeTests); + *aDoRuntimeTests = mRuntimeTestIsOn; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetDoRuntimeTests(PRBool aDoRuntimeTests) +{ + mRuntimeTestIsOn = aDoRuntimeTests; + return NS_OK; +} + +/* attribute short testId; */ +NS_IMETHODIMP +nsDebugObject::GetTestId(PRInt16 *aTestId) +{ + NS_ENSURE_ARG_POINTER(aTestId); + *aTestId = mRuntimeTestId; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetTestId(PRInt16 aTestId) +{ + mRuntimeTestId = aTestId; + return NS_OK; +} + +/* attribute boolean printAsIs; */ +NS_IMETHODIMP +nsDebugObject::GetPrintAsIs(PRBool *aPrintAsIs) +{ + NS_ENSURE_ARG_POINTER(aPrintAsIs); + *aPrintAsIs = mPrintAsIs; + return NS_OK; +} +NS_IMETHODIMP +nsDebugObject::SetPrintAsIs(PRBool aPrintAsIs) +{ + mPrintAsIs = aPrintAsIs; + return NS_OK; +} + +/* attribute wstring printFileName; */ +NS_IMETHODIMP nsDebugObject::GetPrintFileName(PRUnichar * *aPrintFileName) +{ + *aPrintFileName = nsCRT::strdup(mFileName); + return NS_OK; +} +NS_IMETHODIMP nsDebugObject::SetPrintFileName(const PRUnichar * aPrintFileName) +{ + if (mFileName) { + nsMemory::Free(mFileName); + } + mFileName = nsCRT::strdup(aPrintFileName); + return NS_OK; +} + + diff --git a/mozilla/extensions/layout-debug/src/nsRegressionTester.h b/mozilla/extensions/layout-debug/src/nsRegressionTester.h index 2e3dabfd544..6b00725313b 100644 --- a/mozilla/extensions/layout-debug/src/nsRegressionTester.h +++ b/mozilla/extensions/layout-debug/src/nsRegressionTester.h @@ -36,6 +36,11 @@ public: nsDebugObject(); virtual ~nsDebugObject(); +protected: + PRBool mRuntimeTestIsOn; + PRBool mPrintAsIs; + PRInt16 mRuntimeTestId; + PRUnichar* mFileName; };