1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
6 #include
"nsIProtocolHandler.idl"
10 * Protocol handler superinterface for a protocol which performs substitutions
11 * from URIs of its scheme to URIs of another scheme.
13 [scriptable
, uuid(154c64fd
-a69e
-4105
-89f8
-bd7dfe621372
)]
14 interface nsISubstitutingProtocolHandler
: nsIProtocolHandler
17 * Content script may access files in this package.
19 const short ALLOW_CONTENT_ACCESS
= 1 << 0;
21 * This substitution exposes nsIJARURI instead of a nsIFileURL. By default
22 * NewURI will always return a nsIFileURL even when the URL is jar:
24 const short RESOLVE_JAR_URI
= 1 << 1;
27 * Sets the substitution for the root key:
28 * resource://root/path ==> baseURI.resolve(path)
30 * A null baseURI removes the specified substitution.
32 * The root key will be converted to lower-case to conform to
33 * case-insensitive URI hostname matching behavior.
35 [must_use
] void setSubstitution
(in ACString root
, in nsIURI baseURI
);
38 * Same as setSubstitution, but with specific flags.
40 [must_use
] void setSubstitutionWithFlags
(in ACString root
, in nsIURI baseURI
, in uint32_t flags
);
43 * Gets the substitution for the root key.
45 * @throws NS_ERROR_NOT_AVAILABLE if none exists.
47 [must_use
] nsIURI getSubstitution
(in ACString root
);
50 * Returns TRUE if the substitution exists and FALSE otherwise.
52 [must_use
] boolean hasSubstitution
(in ACString root
);
55 * Utility function to resolve a substituted URI. A resolved URI is not
56 * guaranteed to reference a resource that exists (ie. opening a channel to
57 * the resolved URI may fail).
59 * @throws NS_ERROR_NOT_AVAILABLE if resURI.host() is an unknown root key.
61 [must_use
] AUTF8String resolveURI
(in nsIURI resURI
);