diff --git a/mozilla/htmlparser/src/nsIParser.h b/mozilla/htmlparser/src/nsIParser.h
index 98048b3a770..5abe62af7dc 100644
--- a/mozilla/htmlparser/src/nsIParser.h
+++ b/mozilla/htmlparser/src/nsIParser.h
@@ -49,6 +49,9 @@
#define NS_IPARSER_BUNDLE_IID \
{ 0x8b6a98a0, 0x260e, 0x11d4, { 0x81, 0x53, 0x0, 0x10, 0xa4, 0xe0, 0xc7, 0x6 } };
+// {41421C60-310A-11d4-816F-000064657374}
+#define NS_IDEBUG_DUMP_CONTENT_IID \
+{ 0x41421c60, 0x310a, 0x11d4, { 0x81, 0x6f, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } };
class nsIContentSink;
class nsIStreamObserver;
@@ -105,6 +108,20 @@ public:
virtual PRUint32 GetSize(void)=0;
};
+/**
+ * FOR DEBUG PURPOSE ONLY
+ *
+ * Use this interface to query objects that contain content information.
+ * Ex. Parser can trigger dump content by querying the sink that has
+ * access to the content.
+ *
+ * @update harishd 05/25/00
+ */
+class nsIDebugDumpContent : public nsISupports {
+public:
+ static const nsIID& GetIID() { static nsIID iid = NS_IDEBUG_DUMP_CONTENT_IID; return iid; }
+ NS_IMETHOD DumpContentModel()=0;
+};
class nsISupportsParserBundle : public nsISupports {
public:
diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp
index 31446678871..9cfa2f6093f 100644
--- a/mozilla/htmlparser/src/nsParser.cpp
+++ b/mozilla/htmlparser/src/nsParser.cpp
@@ -198,6 +198,8 @@ void nsParser::FreeSharedObjects(void) {
}
}
+static PRBool gDumpContent=PR_FALSE;
+
/**
* default constructor
*
@@ -207,6 +209,13 @@ void nsParser::FreeSharedObjects(void) {
*/
nsParser::nsParser(nsITokenObserver* anObserver) {
NS_INIT_REFCNT();
+
+#ifdef NS_DEBUG
+ if(!gDumpContent) {
+ gDumpContent=(PR_GetEnv("PARSER_DUMP_CONTENT"))? PR_TRUE:PR_FALSE;
+ }
+#endif
+
mCharset.AssignWithConversion("ISO-8859-1");
mParserFilter = 0;
mObserver = 0;
@@ -236,6 +245,21 @@ nsParser::nsParser(nsITokenObserver* anObserver) {
* @return
*/
nsParser::~nsParser() {
+
+#ifdef NS_DEBUG
+ if(gDumpContent) {
+ if(mSink) {
+ // Sink ( HTMLContentSink at this time) supports nsIDebugDumpContent
+ // interface. We can get to the content model through the sink.
+ nsresult result=NS_OK;
+ nsCOMPtr trigger=do_QueryInterface(mSink,&result);
+ if(NS_SUCCEEDED(result)) {
+ trigger->DumpContentModel();
+ }
+ }
+ }
+#endif
+
NS_IF_RELEASE(mObserver);
NS_IF_RELEASE(mProgressEventSink);
NS_IF_RELEASE(mSink);
diff --git a/mozilla/parser/htmlparser/src/nsIParser.h b/mozilla/parser/htmlparser/src/nsIParser.h
index 98048b3a770..5abe62af7dc 100644
--- a/mozilla/parser/htmlparser/src/nsIParser.h
+++ b/mozilla/parser/htmlparser/src/nsIParser.h
@@ -49,6 +49,9 @@
#define NS_IPARSER_BUNDLE_IID \
{ 0x8b6a98a0, 0x260e, 0x11d4, { 0x81, 0x53, 0x0, 0x10, 0xa4, 0xe0, 0xc7, 0x6 } };
+// {41421C60-310A-11d4-816F-000064657374}
+#define NS_IDEBUG_DUMP_CONTENT_IID \
+{ 0x41421c60, 0x310a, 0x11d4, { 0x81, 0x6f, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } };
class nsIContentSink;
class nsIStreamObserver;
@@ -105,6 +108,20 @@ public:
virtual PRUint32 GetSize(void)=0;
};
+/**
+ * FOR DEBUG PURPOSE ONLY
+ *
+ * Use this interface to query objects that contain content information.
+ * Ex. Parser can trigger dump content by querying the sink that has
+ * access to the content.
+ *
+ * @update harishd 05/25/00
+ */
+class nsIDebugDumpContent : public nsISupports {
+public:
+ static const nsIID& GetIID() { static nsIID iid = NS_IDEBUG_DUMP_CONTENT_IID; return iid; }
+ NS_IMETHOD DumpContentModel()=0;
+};
class nsISupportsParserBundle : public nsISupports {
public:
diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index 31446678871..9cfa2f6093f 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -198,6 +198,8 @@ void nsParser::FreeSharedObjects(void) {
}
}
+static PRBool gDumpContent=PR_FALSE;
+
/**
* default constructor
*
@@ -207,6 +209,13 @@ void nsParser::FreeSharedObjects(void) {
*/
nsParser::nsParser(nsITokenObserver* anObserver) {
NS_INIT_REFCNT();
+
+#ifdef NS_DEBUG
+ if(!gDumpContent) {
+ gDumpContent=(PR_GetEnv("PARSER_DUMP_CONTENT"))? PR_TRUE:PR_FALSE;
+ }
+#endif
+
mCharset.AssignWithConversion("ISO-8859-1");
mParserFilter = 0;
mObserver = 0;
@@ -236,6 +245,21 @@ nsParser::nsParser(nsITokenObserver* anObserver) {
* @return
*/
nsParser::~nsParser() {
+
+#ifdef NS_DEBUG
+ if(gDumpContent) {
+ if(mSink) {
+ // Sink ( HTMLContentSink at this time) supports nsIDebugDumpContent
+ // interface. We can get to the content model through the sink.
+ nsresult result=NS_OK;
+ nsCOMPtr trigger=do_QueryInterface(mSink,&result);
+ if(NS_SUCCEEDED(result)) {
+ trigger->DumpContentModel();
+ }
+ }
+ }
+#endif
+
NS_IF_RELEASE(mObserver);
NS_IF_RELEASE(mProgressEventSink);
NS_IF_RELEASE(mSink);