Interface nsINetworkPredictorType

nsINetworkPredictor - learn about pages users visit, and allow us to take predictive actions upon future visits. NOTE: nsINetworkPredictor should only be used on the main thread.

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

  • Add to our compendium of knowledge

    This adds to our prediction database to make things (hopefully) smarter next time we predict something.

    Parameters

    • targetURI: nsIURI

      The URI that was loaded that we are keeping track of.

    • sourceURI: nsIURI

      The URI that caused targetURI to be loaded (for page loads). This means the DOCUMENT URI.

    • reason: PredictorLearnReason

      The reason we are learning this bit of knowledge. Reason can be any of the LEARN_* values. In the case of LEARN_LOAD_SUBRESOURCE, targetURI should be the URI of a subresource of a page, and sourceURI should be the top-level URI. In the case of LEARN_LOAD_REDIRECT, targetURI is the NEW URI of a top-level resource that was redirected to, and sourceURI is the ORIGINAL URI of said top-level resource. In the case of LEARN_STARTUP, targetURI should be the URI of a page that was loaded immediately after browser startup, and sourceURI should be null.

    • originAttributes: any

      The originAttributes for the page load that we are learning about.

    Returns void

  • Parameters

    • targetURI: nsIURI
    • sourceURI: nsIURI
    • reason: PredictorLearnReason
    • originAttributes: OriginAttributes

    Returns number

  • Start taking predictive actions

    Calling this will cause the predictor to (possibly) start taking actions such as DNS prefetch and/or TCP preconnect based on (1) the host name that we are given, and (2) the reason we are being asked to take actions.

    Parameters

    • targetURI: nsIURI

      The URI we are being asked to take actions based on.

    • sourceURI: nsIURI

      The URI that is currently loaded. This is so we can avoid doing predictive actions for link hover on an HTTPS page (for example).

    • reason: PredictorPredictReason

      The reason we are being asked to take actions. Can be any of the PREDICT_* values above. In the case of PREDICT_LINK, targetURI should be the URI of the link that is being hovered over, and sourceURI should be the URI of the page on which the link appears. In the case of PREDICT_LOAD, targetURI should be the URI of the page that is being loaded and sourceURI should be null. In the case of PREDICT_STARTUP, both targetURI and sourceURI should be null.

    • originAttributes: any

      The originAttributes of the page load we are predicting about.

    • verifier: nsINetworkPredictorVerifier

      An nsINetworkPredictorVerifier used in testing to ensure we're predicting the way we expect to. Not necessary (or desired) for normal operation.

    Returns void

  • Parameters

    • targetURI: nsIURI
    • sourceURI: nsIURI
    • reason: PredictorPredictReason
    • originAttributes: OriginAttributes
    • verifier: nsINetworkPredictorVerifier

    Returns number

  • Clear out all our learned knowledge

    This removes everything from our database so that any predictions begun after this completes will start from a blank slate.

    Returns void

Generated using TypeDoc