nsIStandardURL.idl (3482B)
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 "nsISupports.idl" 7 8 interface nsIURI; 9 interface nsIURIMutator; 10 11 /** 12 * nsIStandardURL defines the interface to an URL with the standard 13 * file path format common to protocols like http, ftp, and file. 14 * It supports initialization from a relative path and provides 15 * some customization on how URLs are normalized. 16 */ 17 [scriptable, builtinclass, uuid(babd6cca-ebe7-4329-967c-d6b9e33caa81)] 18 interface nsIStandardURL : nsISupports 19 { 20 /** 21 * blah:foo/bar => blah://foo/bar 22 * blah:/foo/bar => blah:///foo/bar 23 * blah://foo/bar => blah://foo/bar 24 * blah:///foo/bar => blah:///foo/bar 25 */ 26 const unsigned long URLTYPE_STANDARD = 1; 27 28 /** 29 * blah:foo/bar => blah://foo/bar 30 * blah:/foo/bar => blah://foo/bar 31 * blah://foo/bar => blah://foo/bar 32 * blah:///foo/bar => blah://foo/bar 33 */ 34 const unsigned long URLTYPE_AUTHORITY = 2; 35 36 /** 37 * blah:foo/bar => blah:///foo/bar 38 * blah:/foo/bar => blah:///foo/bar 39 * blah://foo/bar => blah://foo/bar 40 * blah:///foo/bar => blah:///foo/bar 41 */ 42 const unsigned long URLTYPE_NO_AUTHORITY = 3; 43 }; 44 45 [scriptable, builtinclass, uuid(fc894e98-23a1-43cd-a7fe-72876f8ea2ee)] 46 interface nsIStandardURLMutator : nsISupports 47 { 48 /** 49 * Initialize a standard URL. 50 * 51 * @param aUrlType - one of the URLTYPE_ flags listed above. 52 * @param aDefaultPort - if the port parsed from the URL string matches 53 * this port, then the port will be removed from the 54 * canonical form of the URL. 55 * @param aSpec - URL string. 56 * @param aOriginCharset - the charset from which this URI string 57 * originated. this corresponds to the charset 58 * that should be used when communicating this 59 * URI to an origin server, for example. if 60 * null, then provide aBaseURI implements this 61 * interface, the origin charset of aBaseURI will 62 * be assumed, otherwise defaulting to UTF-8 (i.e., 63 * no charset transformation from aSpec). 64 * @param aBaseURI - if null, aSpec must specify an absolute URI. 65 * otherwise, aSpec will be resolved relative 66 * to aBaseURI. 67 */ 68 nsIURIMutator init(in unsigned long aUrlType, 69 in long aDefaultPort, 70 in AUTF8String aSpec, 71 in string aOriginCharset, 72 in nsIURI aBaseURI); 73 74 /** 75 * Set the default port. 76 * 77 * Note: If this object is already using its default port (i.e. if it has 78 * mPort == -1), then it will now implicitly be using the new default port. 79 * 80 * @param aNewDefaultPort - if the URI has (or is later given) a port that 81 * matches this default, then we won't include a 82 * port number in the canonical form of the URL. 83 */ 84 nsIURIMutator setDefaultPort(in long aNewDefaultPort); 85 };