1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Steve Swanson <steve.swanson@mackichan.com>
19 * Portions created by the Initial Developer are Copyright (C) 2004
20 * the Initial Developer. All Rights Reserved.
23 * Blake Kaplan <mrbkap@gmail.com>
24 * Robert Sayre <sayrer@gmail.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsXMLContentSink.h"
41 #include "nsIFragmentContentSink.h"
42 #include "nsIXMLContentSink.h"
43 #include "nsContentSink.h"
44 #include "nsIExpatSink.h"
45 #include "nsIParser.h"
46 #include "nsIDocument.h"
47 #include "nsIDOMDocumentFragment.h"
48 #include "nsIContent.h"
49 #include "nsGkAtoms.h"
50 #include "nsINodeInfo.h"
51 #include "nsNodeInfoManager.h"
52 #include "nsContentCreatorFunctions.h"
53 #include "nsDOMError.h"
54 #include "nsIConsoleService.h"
55 #include "nsIScriptError.h"
56 #include "nsServiceManagerUtils.h"
57 #include "nsContentUtils.h"
58 #include "nsIScriptSecurityManager.h"
59 #include "nsNetUtil.h"
60 #include "nsTHashtable.h"
61 #include "nsHashKeys.h"
63 #include "nsCycleCollectionParticipant.h"
65 class nsXMLFragmentContentSink
: public nsXMLContentSink
,
66 public nsIFragmentContentSink
69 nsXMLFragmentContentSink(PRBool aAllContent
= PR_FALSE
);
70 virtual ~nsXMLFragmentContentSink();
72 NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
75 NS_DECL_ISUPPORTS_INHERITED
76 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsXMLFragmentContentSink
,
80 NS_IMETHOD
HandleDoctypeDecl(const nsAString
& aSubset
,
81 const nsAString
& aName
,
82 const nsAString
& aSystemId
,
83 const nsAString
& aPublicId
,
84 nsISupports
* aCatalogData
);
85 NS_IMETHOD
HandleProcessingInstruction(const PRUnichar
*aTarget
,
86 const PRUnichar
*aData
);
87 NS_IMETHOD
HandleXMLDeclaration(const PRUnichar
*aVersion
,
88 const PRUnichar
*aEncoding
,
90 NS_IMETHOD
ReportError(const PRUnichar
* aErrorText
,
91 const PRUnichar
* aSourceText
,
92 nsIScriptError
*aError
,
96 NS_IMETHOD
WillBuildModel(void);
97 NS_IMETHOD
DidBuildModel();
98 NS_IMETHOD
SetDocumentCharset(nsACString
& aCharset
);
99 virtual nsISupports
*GetTarget();
100 NS_IMETHOD
DidProcessATokenImpl();
104 // nsIFragmentContentSink
105 NS_IMETHOD
GetFragment(PRBool aWillOwnFragment
,
106 nsIDOMDocumentFragment
** aFragment
);
107 NS_IMETHOD
SetTargetDocument(nsIDocument
* aDocument
);
108 NS_IMETHOD
WillBuildContent();
109 NS_IMETHOD
DidBuildContent();
110 NS_IMETHOD
IgnoreFirstContainer();
113 virtual PRBool
SetDocElement(PRInt32 aNameSpaceID
,
115 nsIContent
*aContent
);
116 virtual nsresult
CreateElement(const PRUnichar
** aAtts
, PRUint32 aAttsCount
,
117 nsINodeInfo
* aNodeInfo
, PRUint32 aLineNumber
,
118 nsIContent
** aResult
, PRBool
* aAppendContent
,
120 virtual nsresult
CloseElement(nsIContent
* aContent
);
122 virtual void MaybeStartLayout(PRBool aIgnorePendingSheets
);
124 // nsContentSink overrides
125 virtual nsresult
ProcessStyleLink(nsIContent
* aElement
,
126 const nsSubstring
& aHref
,
128 const nsSubstring
& aTitle
,
129 const nsSubstring
& aType
,
130 const nsSubstring
& aMedia
);
131 nsresult
LoadXSLStyleSheet(nsIURI
* aUrl
);
134 nsCOMPtr
<nsIDocument
> mTargetDocument
;
136 nsCOMPtr
<nsIContent
> mRoot
;
137 PRPackedBool mParseError
;
139 // if FALSE, take content inside endnote tag
140 PRPackedBool mAllContent
;
144 NewXMLFragmentContentSinkHelper(PRBool aAllContent
, nsIFragmentContentSink
** aResult
)
146 nsXMLFragmentContentSink
* it
= new nsXMLFragmentContentSink(aAllContent
);
148 return NS_ERROR_OUT_OF_MEMORY
;
151 NS_ADDREF(*aResult
= it
);
157 NS_NewXMLFragmentContentSink2(nsIFragmentContentSink
** aResult
)
159 return NewXMLFragmentContentSinkHelper(PR_TRUE
, aResult
);
163 NS_NewXMLFragmentContentSink(nsIFragmentContentSink
** aResult
)
165 return NewXMLFragmentContentSinkHelper(PR_FALSE
, aResult
);
168 nsXMLFragmentContentSink::nsXMLFragmentContentSink(PRBool aAllContent
)
169 : mParseError(PR_FALSE
), mAllContent(aAllContent
)
173 nsXMLFragmentContentSink::~nsXMLFragmentContentSink()
177 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXMLFragmentContentSink
)
178 NS_INTERFACE_MAP_ENTRY(nsIFragmentContentSink
)
179 NS_INTERFACE_MAP_END_INHERITING(nsXMLContentSink
)
181 NS_IMPL_ADDREF_INHERITED(nsXMLFragmentContentSink
, nsXMLContentSink
)
182 NS_IMPL_RELEASE_INHERITED(nsXMLFragmentContentSink
, nsXMLContentSink
)
184 NS_IMPL_CYCLE_COLLECTION_CLASS(nsXMLFragmentContentSink
)
186 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLFragmentContentSink
,
188 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTargetDocument
)
189 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRoot
)
190 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
193 nsXMLFragmentContentSink::WillBuildModel(void)
199 mState
= eXMLContentSinkState_InDocumentElement
;
201 NS_ASSERTION(mTargetDocument
, "Need a document!");
203 nsCOMPtr
<nsIDOMDocumentFragment
> frag
;
204 nsresult rv
= NS_NewDocumentFragment(getter_AddRefs(frag
), mNodeInfoManager
);
205 NS_ENSURE_SUCCESS(rv
, rv
);
207 mRoot
= do_QueryInterface(frag
);
210 // Preload content stack because we know all content goes in the fragment
218 nsXMLFragmentContentSink::DidBuildModel()
221 PopContent(); // remove mRoot pushed above
224 nsCOMPtr
<nsIParser
> kungFuDeathGrip(mParser
);
226 // Drop our reference to the parser to get rid of a circular
234 nsXMLFragmentContentSink::SetDocumentCharset(nsACString
& aCharset
)
236 NS_NOTREACHED("fragments shouldn't set charset");
241 nsXMLFragmentContentSink::GetTarget()
243 return mTargetDocument
;
246 ////////////////////////////////////////////////////////////////////////
249 nsXMLFragmentContentSink::SetDocElement(PRInt32 aNameSpaceID
,
251 nsIContent
*aContent
)
253 // this is a fragment, not a document
258 nsXMLFragmentContentSink::CreateElement(const PRUnichar
** aAtts
, PRUint32 aAttsCount
,
259 nsINodeInfo
* aNodeInfo
, PRUint32 aLineNumber
,
260 nsIContent
** aResult
, PRBool
* aAppendContent
,
263 // Claim to not be coming from parser, since we don't do any of the
264 // fancy CloseElement stuff.
265 nsresult rv
= nsXMLContentSink::CreateElement(aAtts
, aAttsCount
,
266 aNodeInfo
, aLineNumber
,
267 aResult
, aAppendContent
,
270 // When we aren't grabbing all of the content we, never open a doc
271 // element, we run into trouble on the first element, so we don't append,
272 // and simply push this onto the content stack.
273 if (!mAllContent
&& mContentStack
.Length() == 0) {
274 *aAppendContent
= PR_FALSE
;
281 nsXMLFragmentContentSink::CloseElement(nsIContent
* aContent
)
283 // don't do fancy stuff in nsXMLContentSink
288 nsXMLFragmentContentSink::MaybeStartLayout(PRBool aIgnorePendingSheets
)
293 ////////////////////////////////////////////////////////////////////////
296 nsXMLFragmentContentSink::HandleDoctypeDecl(const nsAString
& aSubset
,
297 const nsAString
& aName
,
298 const nsAString
& aSystemId
,
299 const nsAString
& aPublicId
,
300 nsISupports
* aCatalogData
)
302 NS_NOTREACHED("fragments shouldn't have doctype declarations");
308 nsXMLFragmentContentSink::HandleProcessingInstruction(const PRUnichar
*aTarget
,
309 const PRUnichar
*aData
)
313 nsresult result
= NS_OK
;
314 const nsDependentString
target(aTarget
);
315 const nsDependentString
data(aData
);
317 nsCOMPtr
<nsIContent
> node
;
319 result
= NS_NewXMLProcessingInstruction(getter_AddRefs(node
),
320 mNodeInfoManager
, target
, data
);
321 if (NS_SUCCEEDED(result
)) {
322 // no special processing here. that should happen when the fragment moves into the document
323 result
= AddContentAsLeaf(node
);
329 nsXMLFragmentContentSink::HandleXMLDeclaration(const PRUnichar
*aVersion
,
330 const PRUnichar
*aEncoding
,
333 NS_NOTREACHED("fragments shouldn't have XML declarations");
338 nsXMLFragmentContentSink::ReportError(const PRUnichar
* aErrorText
,
339 const PRUnichar
* aSourceText
,
340 nsIScriptError
*aError
,
343 NS_PRECONDITION(aError
&& aSourceText
&& aErrorText
, "Check arguments!!!");
345 // The expat driver should report the error.
348 mParseError
= PR_TRUE
;
351 // Report the error to stderr.
354 NS_LossyConvertUTF16toASCII(aErrorText
).get(),
355 NS_LossyConvertUTF16toASCII(aSourceText
).get());
358 // The following code is similar to the cleanup in nsXMLContentSink::ReportError()
359 mState
= eXMLContentSinkState_InProlog
;
361 // Clear the current content
362 nsCOMPtr
<nsIDOMNode
> node(do_QueryInterface(mRoot
));
365 nsCOMPtr
<nsIDOMNode
> child
, dummy
;
366 node
->GetLastChild(getter_AddRefs(child
));
369 node
->RemoveChild(child
, getter_AddRefs(dummy
));
373 // Clear any buffered-up text we have. It's enough to set the length to 0.
374 // The buffer itself is allocated when we're created and deleted in our
375 // destructor, so don't mess with it.
382 nsXMLFragmentContentSink::ProcessStyleLink(nsIContent
* aElement
,
383 const nsSubstring
& aHref
,
385 const nsSubstring
& aTitle
,
386 const nsSubstring
& aType
,
387 const nsSubstring
& aMedia
)
389 // don't process until moved to document
394 nsXMLFragmentContentSink::LoadXSLStyleSheet(nsIURI
* aUrl
)
396 NS_NOTREACHED("fragments shouldn't have XSL style sheets");
397 return NS_ERROR_UNEXPECTED
;
401 nsXMLFragmentContentSink::StartLayout()
403 NS_NOTREACHED("fragments shouldn't layout");
406 ////////////////////////////////////////////////////////////////////////
409 nsXMLFragmentContentSink::GetFragment(PRBool aWillOwnFragment
,
410 nsIDOMDocumentFragment
** aFragment
)
414 //XXX PARSE_ERR from DOM3 Load and Save would be more appropriate
415 return NS_ERROR_DOM_SYNTAX_ERR
;
417 nsresult rv
= CallQueryInterface(mRoot
, aFragment
);
418 if (NS_SUCCEEDED(rv
) && aWillOwnFragment
) {
428 nsXMLFragmentContentSink::SetTargetDocument(nsIDocument
* aTargetDocument
)
430 NS_ENSURE_ARG_POINTER(aTargetDocument
);
432 mTargetDocument
= aTargetDocument
;
433 mNodeInfoManager
= aTargetDocument
->NodeInfoManager();
439 nsXMLFragmentContentSink::WillBuildContent()
441 // If we're taking all of the content, then we've already pushed mRoot
442 // onto the content stack, otherwise, start here.
451 nsXMLFragmentContentSink::DidBuildContent()
453 // If we're taking all of the content, then this is handled in DidBuildModel
455 // Note: we need to FlushText() here because if we don't, we might not get
456 // an end element to do it for us, so make sure.
467 nsXMLFragmentContentSink::DidProcessATokenImpl()
473 nsXMLFragmentContentSink::IgnoreFirstContainer()
475 NS_NOTREACHED("XML isn't as broken as HTML");
476 return NS_ERROR_FAILURE
;
480 // nsXHTMLParanoidFragmentSink
482 // Find the whitelist of allowed elements and attributes in
483 // nsContentSink.h We share it with nsHTMLParanoidFragmentSink
485 class nsXHTMLParanoidFragmentSink
: public nsXMLFragmentContentSink
488 nsXHTMLParanoidFragmentSink();
490 static nsresult
Init();
491 static void Cleanup();
494 NS_DECL_ISUPPORTS_INHERITED
497 nsresult
AddAttributes(const PRUnichar
** aNode
, nsIContent
* aContent
);
500 NS_IMETHOD
HandleStartElement(const PRUnichar
*aName
,
501 const PRUnichar
**aAtts
,
502 PRUint32 aAttsCount
, PRInt32 aIndex
,
503 PRUint32 aLineNumber
);
505 NS_IMETHOD
HandleEndElement(const PRUnichar
*aName
);
507 NS_IMETHOD
HandleComment(const PRUnichar
*aName
);
509 NS_IMETHOD
HandleProcessingInstruction(const PRUnichar
*aTarget
,
510 const PRUnichar
*aData
);
512 NS_IMETHOD
HandleCDataSection(const PRUnichar
*aData
,
515 NS_IMETHOD
HandleCharacterData(const PRUnichar
*aData
,
518 PRUint32 mSkipLevel
; // used when we descend into <style> or <script>
519 // Use nsTHashTable as a hash set for our whitelists
520 static nsTHashtable
<nsISupportsHashKey
>* sAllowedTags
;
521 static nsTHashtable
<nsISupportsHashKey
>* sAllowedAttributes
;
524 nsTHashtable
<nsISupportsHashKey
>* nsXHTMLParanoidFragmentSink::sAllowedTags
;
525 nsTHashtable
<nsISupportsHashKey
>* nsXHTMLParanoidFragmentSink::sAllowedAttributes
;
527 nsXHTMLParanoidFragmentSink::nsXHTMLParanoidFragmentSink():
528 nsXMLFragmentContentSink(PR_FALSE
), mSkipLevel(0)
533 nsXHTMLParanoidFragmentSink::Init()
535 nsresult rv
= NS_ERROR_FAILURE
;
541 sAllowedTags
= new nsTHashtable
<nsISupportsHashKey
>();
543 rv
= sAllowedTags
->Init(80);
544 for (PRUint32 i
= 0; kDefaultAllowedTags
[i
] && NS_SUCCEEDED(rv
); i
++) {
545 if (!sAllowedTags
->PutEntry(*kDefaultAllowedTags
[i
])) {
546 rv
= NS_ERROR_OUT_OF_MEMORY
;
551 sAllowedAttributes
= new nsTHashtable
<nsISupportsHashKey
>();
552 if (sAllowedAttributes
&& NS_SUCCEEDED(rv
)) {
553 rv
= sAllowedAttributes
->Init(80);
555 kDefaultAllowedAttributes
[i
] && NS_SUCCEEDED(rv
); i
++) {
556 if (!sAllowedAttributes
->PutEntry(*kDefaultAllowedAttributes
[i
])) {
557 rv
= NS_ERROR_OUT_OF_MEMORY
;
563 NS_WARNING("Failed to populate whitelist hash sets");
571 nsXHTMLParanoidFragmentSink::Cleanup()
575 sAllowedTags
= nsnull
;
578 if (sAllowedAttributes
) {
579 delete sAllowedAttributes
;
580 sAllowedAttributes
= nsnull
;
585 NS_NewXHTMLParanoidFragmentSink(nsIFragmentContentSink
** aResult
)
587 nsXHTMLParanoidFragmentSink
* it
= new nsXHTMLParanoidFragmentSink();
589 return NS_ERROR_OUT_OF_MEMORY
;
591 nsresult rv
= nsXHTMLParanoidFragmentSink::Init();
592 NS_ENSURE_SUCCESS(rv
, rv
);
593 NS_ADDREF(*aResult
= it
);
599 NS_XHTMLParanoidFragmentSinkShutdown()
601 nsXHTMLParanoidFragmentSink::Cleanup();
604 NS_IMPL_ISUPPORTS_INHERITED0(nsXHTMLParanoidFragmentSink
,
605 nsXMLFragmentContentSink
)
608 nsXHTMLParanoidFragmentSink::AddAttributes(const PRUnichar
** aAtts
,
609 nsIContent
* aContent
)
613 // use this to check for safe URIs in the few attributes that allow them
614 nsIScriptSecurityManager
* secMan
= nsContentUtils::GetSecurityManager();
615 nsCOMPtr
<nsIURI
> baseURI
;
616 PRUint32 flags
= nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL
;
618 // scrub URI attributes that point at dangerous content
619 // We have to do this here, because this is where we have a base URI,
620 // but we can't do all the scrubbing here, because other parts of the
621 // code get the attributes before this method is called.
622 nsTArray
<const PRUnichar
*> allowedAttrs
;
624 nsCOMPtr
<nsIAtom
> prefix
, localName
;
625 nsCOMPtr
<nsINodeInfo
> nodeInfo
;
627 nsContentUtils::SplitExpatName(aAtts
[0], getter_AddRefs(prefix
),
628 getter_AddRefs(localName
), &nameSpaceID
);
629 nodeInfo
= mNodeInfoManager
->GetNodeInfo(localName
, prefix
, nameSpaceID
);
630 NS_ENSURE_TRUE(nodeInfo
, NS_ERROR_OUT_OF_MEMORY
);
631 // check the attributes we allow that contain URIs
632 if (IsAttrURI(nodeInfo
->NameAtom())) {
634 rv
= NS_ERROR_FAILURE
;
636 baseURI
= aContent
->GetBaseURI();
637 nsCOMPtr
<nsIURI
> attrURI
;
638 rv
= NS_NewURI(getter_AddRefs(attrURI
), nsDependentString(aAtts
[1]),
640 if (NS_SUCCEEDED(rv
)) {
641 rv
= secMan
->CheckLoadURIWithPrincipal(mTargetDocument
->NodePrincipal(),
646 if (NS_SUCCEEDED(rv
)) {
647 allowedAttrs
.AppendElement(aAtts
[0]);
648 allowedAttrs
.AppendElement(aAtts
[1]);
653 allowedAttrs
.AppendElement((const PRUnichar
*) nsnull
);
655 return nsXMLFragmentContentSink::AddAttributes(allowedAttrs
.Elements(),
660 nsXHTMLParanoidFragmentSink::HandleStartElement(const PRUnichar
*aName
,
661 const PRUnichar
**aAtts
,
664 PRUint32 aLineNumber
)
668 nsCOMPtr
<nsIAtom
> prefix
, localName
;
669 nsContentUtils::SplitExpatName(aName
, getter_AddRefs(prefix
),
670 getter_AddRefs(localName
), &nameSpaceID
);
672 // If the element is not in the XHTML namespace, bounce it
673 if (nameSpaceID
!= kNameSpaceID_XHTML
)
676 nsCOMPtr
<nsINodeInfo
> nodeInfo
;
677 nodeInfo
= mNodeInfoManager
->GetNodeInfo(localName
, prefix
, nameSpaceID
);
678 NS_ENSURE_TRUE(nodeInfo
, NS_ERROR_OUT_OF_MEMORY
);
680 // bounce it if it's not on the whitelist or we're inside
681 // <script> or <style>
682 nsCOMPtr
<nsIAtom
> name
= nodeInfo
->NameAtom();
683 if (mSkipLevel
!= 0 ||
684 name
== nsGkAtoms::script
||
685 name
== nsGkAtoms::style
) {
686 ++mSkipLevel
; // track this so we don't spew script text
690 if (!sAllowedTags
|| !sAllowedTags
->GetEntry(name
))
693 // It's an allowed element, so let's scrub the attributes
694 nsTArray
<const PRUnichar
*> allowedAttrs
;
695 for (PRUint32 i
= 0; i
< aAttsCount
; i
+= 2) {
696 nsContentUtils::SplitExpatName(aAtts
[i
], getter_AddRefs(prefix
),
697 getter_AddRefs(localName
), &nameSpaceID
);
698 nodeInfo
= mNodeInfoManager
->GetNodeInfo(localName
, prefix
, nameSpaceID
);
699 NS_ENSURE_TRUE(nodeInfo
, NS_ERROR_OUT_OF_MEMORY
);
701 name
= nodeInfo
->NameAtom();
702 // Add if it's xmlns, xml: or on the HTML whitelist
703 if (nameSpaceID
== kNameSpaceID_XMLNS
||
704 nameSpaceID
== kNameSpaceID_XML
||
705 (sAllowedAttributes
&& sAllowedAttributes
->GetEntry(name
))) {
706 allowedAttrs
.AppendElement(aAtts
[i
]);
707 allowedAttrs
.AppendElement(aAtts
[i
+ 1]);
710 allowedAttrs
.AppendElement((const PRUnichar
*) nsnull
);
712 nsXMLFragmentContentSink::HandleStartElement(aName
,
713 allowedAttrs
.Elements(),
714 allowedAttrs
.Length() - 1,
720 nsXHTMLParanoidFragmentSink::HandleEndElement(const PRUnichar
*aName
)
723 nsCOMPtr
<nsIAtom
> prefix
, localName
;
724 nsContentUtils::SplitExpatName(aName
, getter_AddRefs(prefix
),
725 getter_AddRefs(localName
), &nameSpaceID
);
727 // If the element is not in the XHTML namespace, bounce it
728 if (nameSpaceID
!= kNameSpaceID_XHTML
) {
732 nsCOMPtr
<nsINodeInfo
> nodeInfo
;
733 nodeInfo
= mNodeInfoManager
->GetNodeInfo(localName
, prefix
, nameSpaceID
);
734 NS_ENSURE_TRUE(nodeInfo
, NS_ERROR_OUT_OF_MEMORY
);
736 nsCOMPtr
<nsIAtom
> name
= nodeInfo
->NameAtom();
737 if (mSkipLevel
!= 0) {
742 if (!sAllowedTags
|| !sAllowedTags
->GetEntry(name
)) {
746 return nsXMLFragmentContentSink::HandleEndElement(aName
);
750 nsXHTMLParanoidFragmentSink::
751 HandleProcessingInstruction(const PRUnichar
*aTarget
,
752 const PRUnichar
*aData
)
759 nsXHTMLParanoidFragmentSink::HandleComment(const PRUnichar
*aName
)
761 // We don't do comments
765 // We pass all character data through, unless we're inside <script>
767 nsXHTMLParanoidFragmentSink::HandleCDataSection(const PRUnichar
*aData
,
770 if (mSkipLevel
!= 0) {
774 return nsXMLFragmentContentSink::HandleCDataSection(aData
, aLength
);
778 nsXHTMLParanoidFragmentSink::HandleCharacterData(const PRUnichar
*aData
,
781 if (mSkipLevel
!= 0) {
785 return nsXMLFragmentContentSink::HandleCharacterData(aData
, aLength
);