|
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 "nsIProtocolHandler.idl" |
|
7 |
|
8 /** |
|
9 * Protocol handler interface for the resource:// protocol |
|
10 */ |
|
11 [scriptable, uuid(067ca872-e947-4bd6-8946-a479cb6ba5dd)] |
|
12 interface nsIResProtocolHandler : nsIProtocolHandler |
|
13 { |
|
14 /** |
|
15 * Sets the substitution for the root key: |
|
16 * resource://root/path ==> baseURI.resolve(path) |
|
17 * |
|
18 * A null baseURI removes the specified substitution. |
|
19 * |
|
20 * A root key should always be lowercase; however, this may not be |
|
21 * enforced. |
|
22 */ |
|
23 void setSubstitution(in ACString root, in nsIURI baseURI); |
|
24 |
|
25 /** |
|
26 * Gets the substitution for the root key. |
|
27 * |
|
28 * @throws NS_ERROR_NOT_AVAILABLE if none exists. |
|
29 */ |
|
30 nsIURI getSubstitution(in ACString root); |
|
31 |
|
32 /** |
|
33 * Returns TRUE if the substitution exists and FALSE otherwise. |
|
34 */ |
|
35 boolean hasSubstitution(in ACString root); |
|
36 |
|
37 /** |
|
38 * Utility function to resolve a resource URI. A resolved URI is not |
|
39 * guaranteed to reference a resource that exists (ie. opening a channel to |
|
40 * the resolved URI may fail). |
|
41 * |
|
42 * @throws NS_ERROR_NOT_AVAILABLE if resURI.host() is an unknown root key. |
|
43 */ |
|
44 AUTF8String resolveURI(in nsIURI resURI); |
|
45 }; |