Bug 1432257 - Remove nsIStandardURL setter methods draft
authorValentin Gosu <valentin.gosu@gmail.com>
Mon, 22 Jan 2018 20:20:18 +0100
changeset 723216 594020e3495b5dbfc84427ac4e1f4e2e96a6a478
parent 723215 b8ecf94a41294e3d5e36f9973dfcbe047d77768d
child 746806 179dd04bcf4f74b6aa86909c56912429dec7c46f
push id96369
push uservalentin.gosu@gmail.com
push dateMon, 22 Jan 2018 19:20:52 +0000
bugs1432257
milestone59.0a1
Bug 1432257 - Remove nsIStandardURL setter methods * Removes nsIStandardURL.{init,setDefaultPort} as these have been migrated to nsIStandardURLMutator MozReview-Commit-ID: 7JPZmyEr65h
netwerk/base/nsIStandardURL.idl
netwerk/base/nsStandardURL.cpp
netwerk/base/nsStandardURL.h
--- 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);