diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
index 4a17375622f..bce85c134fe 100644
--- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp
+++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
@@ -1179,7 +1179,9 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
rv = mSink->AddAttributes(aNode, content);
if (mPreAppend) {
- NS_ASSERTION(mStackPos > 0, "container w/o parent");
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
if (mStack[mStackPos-1].mInsertionPoint != -1) {
parent->InsertChildAt(content,
@@ -1252,7 +1254,9 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
// Add container to its parent if we haven't already done it
if (0 == (mStack[mStackPos].mFlags & APPENDED)) {
- NS_ASSERTION(mStackPos > 0, "container w/o parent");
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
// If the parent has an insertion point, insert rather than
// append.
@@ -1563,7 +1567,11 @@ SinkContext::AddLeaf(const nsIParserNode& aNode)
nsresult
SinkContext::AddLeaf(nsIHTMLContent* aContent)
{
- NS_ASSERTION(mStackPos > 0, "leaf w/o container");
+
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
// If the parent has an insertion point, insert rather than
// append.
@@ -1865,7 +1873,10 @@ SinkContext::FlushText(PRBool* aDidFlush, PRBool aReleaseLast)
NS_RELEASE(text);
// Add text to its parent
- NS_ASSERTION(mStackPos > 0, "leaf w/o container");
+ if (mStackPos<= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mStack[mStackPos - 1].mContent;
if (mStack[mStackPos-1].mInsertionPoint != -1) {
parent->InsertChildAt(content,
@@ -2299,7 +2310,9 @@ HTMLContentSink::BeginContext(PRInt32 aPosition)
return NS_ERROR_OUT_OF_MEMORY;
}
- NS_ASSERTION(mCurrentContext != nsnull," Non-existing context");
+ if (mCurrentContext == 0) {
+ return NS_ERROR_FAILURE;
+ }
// Flush everything in the current context so that we don't have
// to worry about insertions resulting in inconsistent frame creation.
@@ -3915,7 +3928,10 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
}
// Create content object
- NS_ASSERTION(mCurrentContext->mStackPos > 0, "leaf w/o container");
+ if (mCurrentContext->mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
nsAutoString tag("SCRIPT");
nsIHTMLContent* element = nsnull;
diff --git a/mozilla/layout/html/document/src/html.css b/mozilla/layout/html/document/src/html.css
index ca8e1d42cd4..9cccf09aaa8 100644
--- a/mozilla/layout/html/document/src/html.css
+++ b/mozilla/layout/html/document/src/html.css
@@ -1522,6 +1522,7 @@ viewsource|val {color: blue; font-weight:normal;}
viewsource|val:before {content: "="; color: black;}
viewsource|entity {color: maroon; font-weight:normal;}
+viewsource|entity:before {content: "&"; color: maroon;}
viewsource|comment {color: green; font-style:italic; }
viewsource|cdata {color: #CC0066;}
diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
index 4a17375622f..bce85c134fe 100644
--- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
+++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp
@@ -1179,7 +1179,9 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
rv = mSink->AddAttributes(aNode, content);
if (mPreAppend) {
- NS_ASSERTION(mStackPos > 0, "container w/o parent");
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
if (mStack[mStackPos-1].mInsertionPoint != -1) {
parent->InsertChildAt(content,
@@ -1252,7 +1254,9 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
// Add container to its parent if we haven't already done it
if (0 == (mStack[mStackPos].mFlags & APPENDED)) {
- NS_ASSERTION(mStackPos > 0, "container w/o parent");
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
// If the parent has an insertion point, insert rather than
// append.
@@ -1563,7 +1567,11 @@ SinkContext::AddLeaf(const nsIParserNode& aNode)
nsresult
SinkContext::AddLeaf(nsIHTMLContent* aContent)
{
- NS_ASSERTION(mStackPos > 0, "leaf w/o container");
+
+ if (mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mStack[mStackPos-1].mContent;
// If the parent has an insertion point, insert rather than
// append.
@@ -1865,7 +1873,10 @@ SinkContext::FlushText(PRBool* aDidFlush, PRBool aReleaseLast)
NS_RELEASE(text);
// Add text to its parent
- NS_ASSERTION(mStackPos > 0, "leaf w/o container");
+ if (mStackPos<= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mStack[mStackPos - 1].mContent;
if (mStack[mStackPos-1].mInsertionPoint != -1) {
parent->InsertChildAt(content,
@@ -2299,7 +2310,9 @@ HTMLContentSink::BeginContext(PRInt32 aPosition)
return NS_ERROR_OUT_OF_MEMORY;
}
- NS_ASSERTION(mCurrentContext != nsnull," Non-existing context");
+ if (mCurrentContext == 0) {
+ return NS_ERROR_FAILURE;
+ }
// Flush everything in the current context so that we don't have
// to worry about insertions resulting in inconsistent frame creation.
@@ -3915,7 +3928,10 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
}
// Create content object
- NS_ASSERTION(mCurrentContext->mStackPos > 0, "leaf w/o container");
+ if (mCurrentContext->mStackPos <= 0) {
+ return NS_ERROR_FAILURE;
+ }
+
nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
nsAutoString tag("SCRIPT");
nsIHTMLContent* element = nsnull;
diff --git a/mozilla/layout/style/html.css b/mozilla/layout/style/html.css
index ca8e1d42cd4..9cccf09aaa8 100644
--- a/mozilla/layout/style/html.css
+++ b/mozilla/layout/style/html.css
@@ -1522,6 +1522,7 @@ viewsource|val {color: blue; font-weight:normal;}
viewsource|val:before {content: "="; color: black;}
viewsource|entity {color: maroon; font-weight:normal;}
+viewsource|entity:before {content: "&"; color: maroon;}
viewsource|comment {color: green; font-style:italic; }
viewsource|cdata {color: #CC0066;}