Bug 1432257 - Remove nsIStandardURL setter methods
* Removes nsIStandardURL.{init,setDefaultPort} as these have been migrated to nsIStandardURLMutator
MozReview-Commit-ID: 7JPZmyEr65h
--- a/netwerk/base/nsIStandardURL.idl
+++ b/netwerk/base/nsIStandardURL.idl
@@ -35,24 +35,16 @@ interface nsIStandardURL : nsIMutable
/**
* blah:foo/bar => blah:///foo/bar
* blah:/foo/bar => blah:///foo/bar
* blah://foo/bar => blah://foo/bar
* blah:///foo/bar => blah:///foo/bar
*/
const unsigned long URLTYPE_NO_AUTHORITY = 3;
-
- void init(in unsigned long aUrlType,
- in long aDefaultPort,
- in AUTF8String aSpec,
- in string aOriginCharset,
- in nsIURI aBaseURI);
-
- void setDefaultPort(in long aNewDefaultPort);
};
[scriptable, builtinclass, uuid(fc894e98-23a1-43cd-a7fe-72876f8ea2ee)]
interface nsIStandardURLMutator : nsISupports
{
/**
* Initialize a standard URL.
*
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -3289,17 +3289,17 @@ nsStandardURL::SetFile(nsIFile *file)
return NS_OK;
}
//----------------------------------------------------------------------------
// nsStandardURL::nsIStandardURL
//----------------------------------------------------------------------------
-NS_IMETHODIMP
+nsresult
nsStandardURL::Init(uint32_t urlType,
int32_t defaultPort,
const nsACString &spec,
const char *charset,
nsIURI *baseURI)
{
ENSURE_MUTABLE();
@@ -3346,17 +3346,17 @@ nsStandardURL::Init(uint32_t urlType,
nsAutoCString buf;
nsresult rv = baseURI->Resolve(spec, buf);
if (NS_FAILED(rv)) return rv;
return SetSpecWithEncoding(buf, encoding);
}
-NS_IMETHODIMP
+nsresult
nsStandardURL::SetDefaultPort(int32_t aNewDefaultPort)
{
ENSURE_MUTABLE();
InvalidateCache();
// should never be more than 16 bit
if (aNewDefaultPort >= std::numeric_limits<uint16_t>::max()) {
--- a/netwerk/base/nsStandardURL.h
+++ b/netwerk/base/nsStandardURL.h
@@ -176,16 +176,20 @@ protected:
// Helper for subclass implementation of GetFile(). Subclasses that map
// URIs to files in a special way should implement this method. It should
// ensure that our mFile is initialized, if it's possible.
// returns NS_ERROR_NO_INTERFACE if the url does not map to a file
virtual nsresult EnsureFile();
private:
+ nsresult Init(uint32_t urlType, int32_t defaultPort, const nsACString &spec,
+ const char *charset, nsIURI *baseURI);
+ nsresult SetDefaultPort(int32_t aNewDefaultPort);
+
int32_t Port() { return mPort == -1 ? mDefaultPort : mPort; }
void ReplacePortInSpec(int32_t aNewPort);
void Clear();
void InvalidateCache(bool invalidateCachedFile = true);
bool ValidIPv6orHostname(const char *host, uint32_t aLen);
static bool IsValidOfBase(unsigned char c, const uint32_t base);