Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIRequest.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIURI; |
michael@0 | 9 | interface nsIChannel; |
michael@0 | 10 | interface nsIRequestObserver; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * nsIURIChecker |
michael@0 | 14 | * |
michael@0 | 15 | * The URI checker is a component that can be used to verify the existence |
michael@0 | 16 | * of a resource at the location specified by a given URI. It will use |
michael@0 | 17 | * protocol specific methods to verify the URI (e.g., use of HEAD request |
michael@0 | 18 | * for HTTP URIs). |
michael@0 | 19 | */ |
michael@0 | 20 | [scriptable, uuid(4660c1a1-be2d-4c78-9baf-c22984176c28)] |
michael@0 | 21 | interface nsIURIChecker : nsIRequest |
michael@0 | 22 | { |
michael@0 | 23 | /** |
michael@0 | 24 | * Initializes the URI checker. After this method is called, it is valid |
michael@0 | 25 | * to further configure the URI checker by calling its nsIRequest methods. |
michael@0 | 26 | * This method creates the channel that will be used to verify the URI. |
michael@0 | 27 | * In the case of the HTTP protocol, only a HEAD request will be issued. |
michael@0 | 28 | * |
michael@0 | 29 | * @param aURI |
michael@0 | 30 | * The URI to be checked. |
michael@0 | 31 | */ |
michael@0 | 32 | void init(in nsIURI aURI); |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Returns the base channel that will be used to verify the URI. |
michael@0 | 36 | */ |
michael@0 | 37 | readonly attribute nsIChannel baseChannel; |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * Begin asynchronous checking URI for validity. Notification will be |
michael@0 | 41 | * asynchronous through the nsIRequestObserver callback interface. When |
michael@0 | 42 | * OnStartRequest is fired, the baseChannel attribute will have been |
michael@0 | 43 | * updated to reflect the final channel used (corresponding to any redirects |
michael@0 | 44 | * that may have been followed). |
michael@0 | 45 | * |
michael@0 | 46 | * Our interpretations of the nsIRequestObserver status codes: |
michael@0 | 47 | * NS_BINDING_SUCCEEDED: link is valid |
michael@0 | 48 | * NS_BINDING_FAILED: link is invalid (gave an error) |
michael@0 | 49 | * NS_BINDING_ABORTED: timed out, or cancelled |
michael@0 | 50 | * |
michael@0 | 51 | * @param aObserver |
michael@0 | 52 | * The object to notify when the link is verified. We will |
michael@0 | 53 | * call aObserver.OnStartRequest followed immediately by |
michael@0 | 54 | * aObserver.OnStopRequest. It is recommended that the caller use |
michael@0 | 55 | * OnStopRequest to act on the link's status. The underlying request |
michael@0 | 56 | * will not be cancelled until after OnStopRequest has been called. |
michael@0 | 57 | * @param aContext |
michael@0 | 58 | * A closure that will be passed back to the nsIRequestObserver |
michael@0 | 59 | * methods. |
michael@0 | 60 | */ |
michael@0 | 61 | void asyncCheck(in nsIRequestObserver aObserver, in nsISupports aContext); |
michael@0 | 62 | }; |