netwerk/base/public/nsIURIChecker.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIURIChecker.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsIRequest.idl"
    1.10 +
    1.11 +interface nsIURI;
    1.12 +interface nsIChannel;
    1.13 +interface nsIRequestObserver;
    1.14 +
    1.15 +/**
    1.16 + * nsIURIChecker
    1.17 + *
    1.18 + * The URI checker is a component that can be used to verify the existence
    1.19 + * of a resource at the location specified by a given URI.  It will use
    1.20 + * protocol specific methods to verify the URI (e.g., use of HEAD request
    1.21 + * for HTTP URIs).
    1.22 + */
    1.23 +[scriptable, uuid(4660c1a1-be2d-4c78-9baf-c22984176c28)]
    1.24 +interface nsIURIChecker : nsIRequest
    1.25 +{
    1.26 +    /**
    1.27 +     * Initializes the URI checker.  After this method is called, it is valid
    1.28 +     * to further configure the URI checker by calling its nsIRequest methods.
    1.29 +     * This method creates the channel that will be used to verify the URI.
    1.30 +     * In the case of the HTTP protocol, only a HEAD request will be issued.
    1.31 +     *
    1.32 +     * @param aURI
    1.33 +     *        The URI to be checked.
    1.34 +     */
    1.35 +    void init(in nsIURI aURI);
    1.36 +
    1.37 +    /**
    1.38 +     * Returns the base channel that will be used to verify the URI.
    1.39 +     */
    1.40 +    readonly attribute nsIChannel baseChannel;
    1.41 +
    1.42 +    /**
    1.43 +     * Begin asynchronous checking URI for validity.  Notification will be
    1.44 +     * asynchronous through the nsIRequestObserver callback interface.  When
    1.45 +     * OnStartRequest is fired, the baseChannel attribute will have been
    1.46 +     * updated to reflect the final channel used (corresponding to any redirects
    1.47 +     * that may have been followed).
    1.48 +     *
    1.49 +     * Our interpretations of the nsIRequestObserver status codes:
    1.50 +     *   NS_BINDING_SUCCEEDED:   link is valid
    1.51 +     *   NS_BINDING_FAILED:      link is invalid (gave an error)
    1.52 +     *   NS_BINDING_ABORTED:     timed out, or cancelled
    1.53 +     *
    1.54 +     * @param aObserver
    1.55 +     *        The object to notify when the link is verified.  We will
    1.56 +     *        call aObserver.OnStartRequest followed immediately by
    1.57 +     *        aObserver.OnStopRequest.  It is recommended that the caller use
    1.58 +     *        OnStopRequest to act on the link's status.  The underlying request
    1.59 +     *        will not be cancelled until after OnStopRequest has been called.
    1.60 +     * @param aContext
    1.61 +     *        A closure that will be passed back to the nsIRequestObserver
    1.62 +     *        methods.
    1.63 +     */
    1.64 +    void asyncCheck(in nsIRequestObserver aObserver, in nsISupports aContext);
    1.65 +};

mercurial