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