Interface nsIContentPolicyType

Interface for content policy mechanism. Implementations of this interface can be used to control loading of various types of out-of-line content, or processing of certain types of in-line content.

WARNING: do not block the caller from shouldLoad or shouldProcess (e.g., by launching a dialog to prompt the user for something).

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Should the resource at this location be loaded? ShouldLoad will be called before loading the resource at aContentLocation to determine whether to start the load at all.

    Returns

    ACCEPT or REJECT_*

    Note

    shouldLoad can be called while the DOM and layout of the document involved is in an inconsistent state. This means that implementors of this method MUST NOT do any of the following:

    1. Modify the DOM in any way (e.g. setting attributes is a no-no).
    2. Query any DOM properties that depend on layout (e.g. offset* properties).
    3. Query any DOM properties that depend on style (e.g. computed style).
    4. Query any DOM properties that depend on the current state of the DOM outside the "context" node (e.g. lengths of node lists).
    5. [JavaScript implementations only] Access properties of any sort on any object without using XPCNativeWrapper (either explicitly or implicitly). Due to various DOM0 things, this leads to item 4. If you do any of these things in your shouldLoad implementation, expect unpredictable behavior, possibly including crashes, content not showing up, content showing up doubled, etc. If you need to do any of the things above, do them off timeout or event.

    Parameters

    • aContentLocation: nsIURI

      the location of the content being checked; must not be null

    • aLoadInfo: nsILoadInfo

      the loadinfo of the channel being evaluated.

    • aMimeTypeGuess: string

      OPTIONAL. a guess for the requested content's MIME type, based on information available to the request initiator (e.g., an OBJECT's type attribute); does not reliably reflect the actual MIME type of the requested content

    Returns number

  • Should the resource be processed? ShouldProcess will be called once all the information passed to it has been determined about the resource, typically after part of the resource has been loaded.

    Returns

    ACCEPT or REJECT_*

    Note

    shouldProcess can be called while the DOM and layout of the document involved is in an inconsistent state. See the note on shouldLoad to see what this means for implementors of this method.

    Parameters

    • aContentLocation: nsIURI

      OPTIONAL; the location of the resource being requested: MAY be, e.g., a post-redirection URI for the resource.

    • aLoadInfo: nsILoadInfo

      the loadinfo of the channel being evaluated.

    • aMimeType: string

      the MIME type of the requested resource (e.g., image/png), as reported by the networking library, if available (may be empty if inappropriate for the type).

    Returns number

Generated using TypeDoc