nsISubstitutingProtocolHandler.idl (2075B)
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/. */ 5 6 #include "nsIProtocolHandler.idl" 7 8 9 /** 10 * Protocol handler superinterface for a protocol which performs substitutions 11 * from URIs of its scheme to URIs of another scheme. 12 */ 13 [scriptable, uuid(154c64fd-a69e-4105-89f8-bd7dfe621372)] 14 interface nsISubstitutingProtocolHandler : nsIProtocolHandler 15 { 16 /** 17 * Content script may access files in this package. 18 */ 19 const short ALLOW_CONTENT_ACCESS = 1 << 0; 20 /** 21 * This substitution exposes nsIJARURI instead of a nsIFileURL. By default 22 * NewURI will always return a nsIFileURL even when the URL is jar: 23 */ 24 const short RESOLVE_JAR_URI = 1 << 1; 25 26 /** 27 * Sets the substitution for the root key: 28 * resource://root/path ==> baseURI.resolve(path) 29 * 30 * A null baseURI removes the specified substitution. 31 * 32 * The root key will be converted to lower-case to conform to 33 * case-insensitive URI hostname matching behavior. 34 */ 35 [must_use] void setSubstitution(in ACString root, in nsIURI baseURI); 36 37 /** 38 * Same as setSubstitution, but with specific flags. 39 */ 40 [must_use] void setSubstitutionWithFlags(in ACString root, in nsIURI baseURI, in uint32_t flags); 41 42 /** 43 * Gets the substitution for the root key. 44 * 45 * @throws NS_ERROR_NOT_AVAILABLE if none exists. 46 */ 47 [must_use] nsIURI getSubstitution(in ACString root); 48 49 /** 50 * Returns TRUE if the substitution exists and FALSE otherwise. 51 */ 52 [must_use] boolean hasSubstitution(in ACString root); 53 54 /** 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). 58 * 59 * @throws NS_ERROR_NOT_AVAILABLE if resURI.host() is an unknown root key. 60 */ 61 [must_use] AUTF8String resolveURI(in nsIURI resURI); 62 };