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]
pub fn coerce<T: nsIParserUtilsCoerce>(&self) -> &T
[src]
Cast this nsIParserUtils
to one of its base interfaces.
impl nsIParserUtils
[src]
pub const SanitizerAllowComments: i64
SanitizerAllowComments: i64 = 1
/**
* Flag for sanitizer: Allow comment nodes.
*/
pub const SanitizerAllowStyle: i64
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!
*/
pub const SanitizerCidEmbedsOnly: i64
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.
*/
pub const SanitizerDropNonCSSPresentation: i64
SanitizerDropNonCSSPresentation: i64 = 8
/**
* Flag for sanitizer: Drop non-CSS presentational HTML elements and
* attributes, such as <font>, <center> and bgcolor="".
*/
pub const SanitizerDropForms: i64
SanitizerDropForms: i64 = 16
/**
* Flag for sanitizer: Drop forms and form controls (excluding
* fieldset/legend).
*/
pub const SanitizerDropMedia: i64
SanitizerDropMedia: i64 = 32
/**
* Flag for sanitizer: Drop <img>, <video>, <audio> and <source> and flatten
* out SVG.
*/
pub unsafe fn Sanitize(
&self,
src: &nsAString,
flags: uint32_t,
_retval: &mut nsAString
) -> nsresult
[src]
&self,
src: &nsAString,
flags: uint32_t,
_retval: &mut nsAString
) -> nsresult
/**
* 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);
pub unsafe fn ConvertToPlainText(
&self,
src: &nsAString,
flags: uint32_t,
wrapCol: uint32_t,
_retval: &mut nsAString
) -> nsresult
[src]
&self,
src: &nsAString,
flags: uint32_t,
wrapCol: uint32_t,
_retval: &mut nsAString
) -> nsresult
/**
* 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);
pub unsafe fn ParseFragment(
&self,
fragment: &nsAString,
flags: uint32_t,
isXML: bool,
baseURI: *const nsIURI,
element: *const nsIDOMElement,
_retval: *mut *const nsIDOMDocumentFragment
) -> nsresult
[src]
&self,
fragment: &nsAString,
flags: uint32_t,
isXML: bool,
baseURI: *const nsIURI,
element: *const nsIDOMElement,
_retval: *mut *const nsIDOMDocumentFragment
) -> nsresult
/**
* 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>
pub fn coerce<T: nsISupportsCoerce>(&self) -> &T
[src]
Cast this nsISupports
to one of its base interfaces.
pub unsafe fn QueryInterface(
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
[src]
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);
pub unsafe fn AddRef(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt AddRef ();
pub unsafe fn Release(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt Release ();
Trait Implementations
impl XpCom for nsIParserUtils
[src]
const IID: nsIID
IID: nsIID = nsID(2702184773, 37, 16670, [136, 115, 253, 245, 123, 242, 129, 40])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[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]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsIParserUtils
[src]
type Target = nsISupports
The resulting type after dereferencing.
fn deref(&self) -> &nsISupports
[src]
Dereferences the value.