Struct xpcom::interfaces::nsIParserUtils [] [src]

#[repr(C)]
pub struct nsIParserUtils { /* fields omitted */ }

interface nsIParserUtils : nsISupports

/**
 * Non-Web HTML parser functionality to Firefox extensions and XULRunner apps.
 * Don't use this from within Gecko--use nsContentUtils, nsTreeSanitizer, etc.
 * directly instead.
 */

Methods

impl nsIParserUtils
[src]

[src]

Cast this nsIParserUtils to one of its base interfaces.

impl nsIParserUtils
[src]

SanitizerAllowComments: i64 = 1
/**
   * Flag for sanitizer: Allow comment nodes.
   */

SanitizerAllowStyle: i64 = 2
/**
   * Flag for sanitizer: Allow <style> and style="" (with contents sanitized
   * in case of -moz-binding). Note! If -moz-binding is absent, properties
   * that might be XSS risks in other Web engines are preserved!
   */

SanitizerCidEmbedsOnly: i64 = 4
/**
   * Flag for sanitizer: Only allow cid: URLs for embedded content.
   *
   * At present, sanitizing CSS backgrounds, etc., is not supported, so setting
   * this together with SanitizerAllowStyle doesn't make sense.
   *
   * At present, sanitizing CSS syntax in SVG presentational attributes is not
   * supported, so this option flattens out SVG.
   */

SanitizerDropNonCSSPresentation: i64 = 8
/**
   * Flag for sanitizer: Drop non-CSS presentational HTML elements and
   * attributes, such as <font>, <center> and bgcolor="".
   */

SanitizerDropForms: i64 = 16
/**
   * Flag for sanitizer: Drop forms and form controls (excluding
   * fieldset/legend).
   */

SanitizerDropMedia: i64 = 32
/**
   * Flag for sanitizer: Drop <img>, <video>, <audio> and <source> and flatten
   * out SVG.
   */

[src]

/**
   * Parses a string into an HTML document, sanitizes the document and
   * returns the result serialized to a string.
   *
   * The sanitizer is designed to protect against XSS when sanitized content
   * is inserted into a different-origin context without an iframe-equivalent
   * sandboxing mechanism.
   *
   * By default, the sanitizer doesn't try to avoid leaking information that
   * the content was viewed to third parties. That is, by default, e.g.
   * <img src> pointing to an HTTP server potentially controlled by a third
   * party is not removed. To avoid ambient information leakage upon loading
   * the sanitized content, use the SanitizerInternalEmbedsOnly flag. In that
   * case, <a href> links (and similar) to other content are preserved, so an
   * explicit user action (following a link) after the content has been loaded
   * can still leak information.
   *
   * By default, non-dangerous non-CSS presentational HTML elements and
   * attributes or forms are not removed. To remove these, use
   * SanitizerDropNonCSSPresentation and/or SanitizerDropForms.
   *
   * By default, comments and CSS is removed. To preserve comments, use
   * SanitizerAllowComments. To preserve <style> and style="", use
   * SanitizerAllowStyle. -moz-binding is removed from <style> and style="" if
   * present. In this case, properties that Gecko doesn't recognize can get
   * removed as a side effect. Note! If -moz-binding is not present, <style>
   * and style="" and SanitizerAllowStyle is specified, the sanitized content
   * may still be XSS dangerous if loaded into a non-Gecko Web engine!
   *
   * @param src the HTML source to parse (C++ callers are allowed but not
   *            required to use the same string for the return value.)
   * @param flags sanitization option flags defined above
   */

AString sanitize (in AString src, in unsigned long flags);

[src]

/**
   * Convert HTML to plain text.
   *
   * @param src the HTML source to parse (C++ callers are allowed but not
   *            required to use the same string for the return value.)
   * @param flags conversion option flags defined in nsIDocumentEncoder
   * @param wrapCol number of characters per line; 0 for no auto-wrapping
   */

AString convertToPlainText (in AString src, in unsigned long flags, in unsigned long wrapCol);

[src]

/**
   * Parses markup into a sanitized document fragment.
   *
   * @param fragment the input markup
   * @param flags sanitization option flags defined above
   * @param isXML true if |fragment| is XML and false if HTML
   * @param baseURI the base URL for this fragment
   * @param element the context node for the fragment parsing algorithm
   */

nsIDOMDocumentFragment parseFragment (in AString fragment, in unsigned long flags, in boolean isXML, in nsIURI baseURI, in nsIDOMElement element);

Methods from Deref<Target = nsISupports>

[src]

Cast this nsISupports to one of its base interfaces.

[src]

void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);

[src]

[noscript,notxpcom] nsrefcnt AddRef ();

[src]

[noscript,notxpcom] nsrefcnt Release ();

Trait Implementations

impl XpCom for nsIParserUtils
[src]

IID: nsIID = nsID(2702184773, 37, 16670, [136, 115, 253, 245, 123, 242, 129, 40])

[src]

Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more

impl RefCounted for nsIParserUtils
[src]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIParserUtils
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.