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