|
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 "nsIMutable.idl" |
|
7 |
|
8 interface nsIURI; |
|
9 |
|
10 /** |
|
11 * nsIStandardURL defines the interface to an URL with the standard |
|
12 * file path format common to protocols like http, ftp, and file. |
|
13 * It supports initialization from a relative path and provides |
|
14 * some customization on how URLs are normalized. |
|
15 */ |
|
16 [scriptable, uuid(babd6cca-ebe7-4329-967c-d6b9e33caa81)] |
|
17 interface nsIStandardURL : nsIMutable |
|
18 { |
|
19 /** |
|
20 * blah:foo/bar => blah://foo/bar |
|
21 * blah:/foo/bar => blah:///foo/bar |
|
22 * blah://foo/bar => blah://foo/bar |
|
23 * blah:///foo/bar => blah:///foo/bar |
|
24 */ |
|
25 const unsigned long URLTYPE_STANDARD = 1; |
|
26 |
|
27 /** |
|
28 * blah:foo/bar => blah://foo/bar |
|
29 * blah:/foo/bar => blah://foo/bar |
|
30 * blah://foo/bar => blah://foo/bar |
|
31 * blah:///foo/bar => blah://foo/bar |
|
32 */ |
|
33 const unsigned long URLTYPE_AUTHORITY = 2; |
|
34 |
|
35 /** |
|
36 * blah:foo/bar => blah:///foo/bar |
|
37 * blah:/foo/bar => blah:///foo/bar |
|
38 * blah://foo/bar => blah://foo/bar |
|
39 * blah:///foo/bar => blah:///foo/bar |
|
40 */ |
|
41 const unsigned long URLTYPE_NO_AUTHORITY = 3; |
|
42 |
|
43 /** |
|
44 * Initialize a standard URL. |
|
45 * |
|
46 * @param aUrlType - one of the URLTYPE_ flags listed above. |
|
47 * @param aDefaultPort - if the port parsed from the URL string matches |
|
48 * this port, then the port will be removed from the |
|
49 * canonical form of the URL. |
|
50 * @param aSpec - URL string. |
|
51 * @param aOriginCharset - the charset from which this URI string |
|
52 * originated. this corresponds to the charset |
|
53 * that should be used when communicating this |
|
54 * URI to an origin server, for example. if |
|
55 * null, then provide aBaseURI implements this |
|
56 * interface, the origin charset of aBaseURI will |
|
57 * be assumed, otherwise defaulting to UTF-8 (i.e., |
|
58 * no charset transformation from aSpec). |
|
59 * @param aBaseURI - if null, aSpec must specify an absolute URI. |
|
60 * otherwise, aSpec will be resolved relative |
|
61 * to aBaseURI. |
|
62 */ |
|
63 void init(in unsigned long aUrlType, |
|
64 in long aDefaultPort, |
|
65 in AUTF8String aSpec, |
|
66 in string aOriginCharset, |
|
67 in nsIURI aBaseURI); |
|
68 }; |