michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIMutable.idl" michael@0: michael@0: interface nsIURI; michael@0: michael@0: /** michael@0: * nsIStandardURL defines the interface to an URL with the standard michael@0: * file path format common to protocols like http, ftp, and file. michael@0: * It supports initialization from a relative path and provides michael@0: * some customization on how URLs are normalized. michael@0: */ michael@0: [scriptable, uuid(babd6cca-ebe7-4329-967c-d6b9e33caa81)] michael@0: interface nsIStandardURL : nsIMutable michael@0: { michael@0: /** michael@0: * blah:foo/bar => blah://foo/bar michael@0: * blah:/foo/bar => blah:///foo/bar michael@0: * blah://foo/bar => blah://foo/bar michael@0: * blah:///foo/bar => blah:///foo/bar michael@0: */ michael@0: const unsigned long URLTYPE_STANDARD = 1; michael@0: michael@0: /** michael@0: * blah:foo/bar => blah://foo/bar michael@0: * blah:/foo/bar => blah://foo/bar michael@0: * blah://foo/bar => blah://foo/bar michael@0: * blah:///foo/bar => blah://foo/bar michael@0: */ michael@0: const unsigned long URLTYPE_AUTHORITY = 2; michael@0: michael@0: /** michael@0: * blah:foo/bar => blah:///foo/bar michael@0: * blah:/foo/bar => blah:///foo/bar michael@0: * blah://foo/bar => blah://foo/bar michael@0: * blah:///foo/bar => blah:///foo/bar michael@0: */ michael@0: const unsigned long URLTYPE_NO_AUTHORITY = 3; michael@0: michael@0: /** michael@0: * Initialize a standard URL. michael@0: * michael@0: * @param aUrlType - one of the URLTYPE_ flags listed above. michael@0: * @param aDefaultPort - if the port parsed from the URL string matches michael@0: * this port, then the port will be removed from the michael@0: * canonical form of the URL. michael@0: * @param aSpec - URL string. michael@0: * @param aOriginCharset - the charset from which this URI string michael@0: * originated. this corresponds to the charset michael@0: * that should be used when communicating this michael@0: * URI to an origin server, for example. if michael@0: * null, then provide aBaseURI implements this michael@0: * interface, the origin charset of aBaseURI will michael@0: * be assumed, otherwise defaulting to UTF-8 (i.e., michael@0: * no charset transformation from aSpec). michael@0: * @param aBaseURI - if null, aSpec must specify an absolute URI. michael@0: * otherwise, aSpec will be resolved relative michael@0: * to aBaseURI. michael@0: */ michael@0: void init(in unsigned long aUrlType, michael@0: in long aDefaultPort, michael@0: in AUTF8String aSpec, michael@0: in string aOriginCharset, michael@0: in nsIURI aBaseURI); michael@0: };