Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIMutable.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIURI; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * nsIStandardURL defines the interface to an URL with the standard |
michael@0 | 12 | * file path format common to protocols like http, ftp, and file. |
michael@0 | 13 | * It supports initialization from a relative path and provides |
michael@0 | 14 | * some customization on how URLs are normalized. |
michael@0 | 15 | */ |
michael@0 | 16 | [scriptable, uuid(babd6cca-ebe7-4329-967c-d6b9e33caa81)] |
michael@0 | 17 | interface nsIStandardURL : nsIMutable |
michael@0 | 18 | { |
michael@0 | 19 | /** |
michael@0 | 20 | * blah:foo/bar => blah://foo/bar |
michael@0 | 21 | * blah:/foo/bar => blah:///foo/bar |
michael@0 | 22 | * blah://foo/bar => blah://foo/bar |
michael@0 | 23 | * blah:///foo/bar => blah:///foo/bar |
michael@0 | 24 | */ |
michael@0 | 25 | const unsigned long URLTYPE_STANDARD = 1; |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * blah:foo/bar => blah://foo/bar |
michael@0 | 29 | * blah:/foo/bar => blah://foo/bar |
michael@0 | 30 | * blah://foo/bar => blah://foo/bar |
michael@0 | 31 | * blah:///foo/bar => blah://foo/bar |
michael@0 | 32 | */ |
michael@0 | 33 | const unsigned long URLTYPE_AUTHORITY = 2; |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * blah:foo/bar => blah:///foo/bar |
michael@0 | 37 | * blah:/foo/bar => blah:///foo/bar |
michael@0 | 38 | * blah://foo/bar => blah://foo/bar |
michael@0 | 39 | * blah:///foo/bar => blah:///foo/bar |
michael@0 | 40 | */ |
michael@0 | 41 | const unsigned long URLTYPE_NO_AUTHORITY = 3; |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Initialize a standard URL. |
michael@0 | 45 | * |
michael@0 | 46 | * @param aUrlType - one of the URLTYPE_ flags listed above. |
michael@0 | 47 | * @param aDefaultPort - if the port parsed from the URL string matches |
michael@0 | 48 | * this port, then the port will be removed from the |
michael@0 | 49 | * canonical form of the URL. |
michael@0 | 50 | * @param aSpec - URL string. |
michael@0 | 51 | * @param aOriginCharset - the charset from which this URI string |
michael@0 | 52 | * originated. this corresponds to the charset |
michael@0 | 53 | * that should be used when communicating this |
michael@0 | 54 | * URI to an origin server, for example. if |
michael@0 | 55 | * null, then provide aBaseURI implements this |
michael@0 | 56 | * interface, the origin charset of aBaseURI will |
michael@0 | 57 | * be assumed, otherwise defaulting to UTF-8 (i.e., |
michael@0 | 58 | * no charset transformation from aSpec). |
michael@0 | 59 | * @param aBaseURI - if null, aSpec must specify an absolute URI. |
michael@0 | 60 | * otherwise, aSpec will be resolved relative |
michael@0 | 61 | * to aBaseURI. |
michael@0 | 62 | */ |
michael@0 | 63 | void init(in unsigned long aUrlType, |
michael@0 | 64 | in long aDefaultPort, |
michael@0 | 65 | in AUTF8String aSpec, |
michael@0 | 66 | in string aOriginCharset, |
michael@0 | 67 | in nsIURI aBaseURI); |
michael@0 | 68 | }; |