Skip to content

Commit 2ada5a0

Browse files
author
Neil Rashbrook
committed
Follow-on fixes for bug 17612 r+sr=mrbkap a=beltzner (grudgingly given that I should have filed a new bug)
1 parent fb370b5 commit 2ada5a0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

parser/htmlparser/src/nsViewSourceHTML.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,19 @@ void CViewSourceHTML::WriteTextInElement(const nsAString& tagName,
11131113
const nsAString& attrName,
11141114
const nsAString& attrValue) {
11151115
// Open the element, supplying the attribute, if any.
1116-
CStartToken startToken(tagName, tagType);
1117-
nsCParserStartNode startNode(&startToken, 0/*stack token*/);
1116+
nsTokenAllocator* theAllocator = mTokenizer->GetTokenAllocator();
1117+
if (!theAllocator) {
1118+
return;
1119+
}
1120+
1121+
CStartToken* startToken =
1122+
static_cast<CStartToken*>
1123+
(theAllocator->CreateTokenOfType(eToken_start, tagType, tagName));
1124+
if (!startToken) {
1125+
return;
1126+
}
1127+
1128+
nsCParserStartNode startNode(startToken, theAllocator);
11181129
if (!attrName.IsEmpty()) {
11191130
AddAttrToNode(startNode, allocator, attrName, attrValue);
11201131
}
@@ -1162,7 +1173,7 @@ void CViewSourceHTML::TrimTokenValue(nsAString::const_iterator& start,
11621173
}
11631174
}
11641175

1165-
PRBool CViewSourceHTML::IsTokenValueTrimmableCharacter(char ch) {
1176+
PRBool CViewSourceHTML::IsTokenValueTrimmableCharacter(PRUnichar ch) {
11661177
if (ch == ' ') return PR_TRUE;
11671178
if (ch == '\t') return PR_TRUE;
11681179
if (ch == '\r') return PR_TRUE;

parser/htmlparser/src/nsViewSourceHTML.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class CViewSourceHTML: public nsIDTD
123123
const nsDependentSubstring TrimTokenValue(const nsAString& tokenValue);
124124
void TrimTokenValue(nsAString::const_iterator& start,
125125
nsAString::const_iterator& end);
126-
PRBool IsTokenValueTrimmableCharacter(char ch);
126+
PRBool IsTokenValueTrimmableCharacter(PRUnichar ch);
127127
nsresult GetBaseURI(nsIURI **result);
128128
nsresult SetBaseURI(const nsAString& baseSpec);
129129

0 commit comments

Comments
 (0)