michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIRequest.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIChannel; michael@0: interface nsIRequestObserver; michael@0: michael@0: /** michael@0: * nsIURIChecker michael@0: * michael@0: * The URI checker is a component that can be used to verify the existence michael@0: * of a resource at the location specified by a given URI. It will use michael@0: * protocol specific methods to verify the URI (e.g., use of HEAD request michael@0: * for HTTP URIs). michael@0: */ michael@0: [scriptable, uuid(4660c1a1-be2d-4c78-9baf-c22984176c28)] michael@0: interface nsIURIChecker : nsIRequest michael@0: { michael@0: /** michael@0: * Initializes the URI checker. After this method is called, it is valid michael@0: * to further configure the URI checker by calling its nsIRequest methods. michael@0: * This method creates the channel that will be used to verify the URI. michael@0: * In the case of the HTTP protocol, only a HEAD request will be issued. michael@0: * michael@0: * @param aURI michael@0: * The URI to be checked. michael@0: */ michael@0: void init(in nsIURI aURI); michael@0: michael@0: /** michael@0: * Returns the base channel that will be used to verify the URI. michael@0: */ michael@0: readonly attribute nsIChannel baseChannel; michael@0: michael@0: /** michael@0: * Begin asynchronous checking URI for validity. Notification will be michael@0: * asynchronous through the nsIRequestObserver callback interface. When michael@0: * OnStartRequest is fired, the baseChannel attribute will have been michael@0: * updated to reflect the final channel used (corresponding to any redirects michael@0: * that may have been followed). michael@0: * michael@0: * Our interpretations of the nsIRequestObserver status codes: michael@0: * NS_BINDING_SUCCEEDED: link is valid michael@0: * NS_BINDING_FAILED: link is invalid (gave an error) michael@0: * NS_BINDING_ABORTED: timed out, or cancelled michael@0: * michael@0: * @param aObserver michael@0: * The object to notify when the link is verified. We will michael@0: * call aObserver.OnStartRequest followed immediately by michael@0: * aObserver.OnStopRequest. It is recommended that the caller use michael@0: * OnStopRequest to act on the link's status. The underlying request michael@0: * will not be cancelled until after OnStopRequest has been called. michael@0: * @param aContext michael@0: * A closure that will be passed back to the nsIRequestObserver michael@0: * methods. michael@0: */ michael@0: void asyncCheck(in nsIRequestObserver aObserver, in nsISupports aContext); michael@0: };