michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsTreeSanitizer_h_ michael@0: #define nsTreeSanitizer_h_ michael@0: michael@0: #include "mozilla/css/StyleRule.h" michael@0: #include "nsIPrincipal.h" michael@0: #include "mozilla/dom/Element.h" michael@0: michael@0: class nsIContent; michael@0: michael@0: /** michael@0: * See the documentation of nsIParserUtils::sanitize for documentation michael@0: * about the default behavior and the configuration options of this sanitizer. michael@0: */ michael@0: class MOZ_STACK_CLASS nsTreeSanitizer { michael@0: michael@0: public: michael@0: michael@0: /** michael@0: * The constructor. michael@0: * michael@0: * @param aFlags Flags from nsIParserUtils michael@0: */ michael@0: nsTreeSanitizer(uint32_t aFlags = 0); michael@0: michael@0: static void InitializeStatics(); michael@0: static void ReleaseStatics(); michael@0: michael@0: /** michael@0: * Sanitizes a disconnected DOM fragment freshly obtained from a parser. michael@0: * The argument must be of type nsINode::eDOCUMENT_FRAGMENT and, michael@0: * consequently, must not be in the document. Furthermore, the fragment michael@0: * must have just come from a parser so that it can't have mutation michael@0: * event listeners set on it. michael@0: */ michael@0: void Sanitize(nsIContent* aFragment); michael@0: michael@0: /** michael@0: * Sanitizes a disconnected (not in a docshell) document freshly obtained michael@0: * from a parser. The document must not be embedded in a docshell and must michael@0: * not have had a chance to get mutation event listeners attached to it. michael@0: * The root element must be . michael@0: */ michael@0: void Sanitize(nsIDocument* aDocument); michael@0: michael@0: private: michael@0: michael@0: /** michael@0: * Whether