LCOV - code coverage report
Current view: top level - netwerk/base - RustURL.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 341 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 78 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "RustURL.h"
       2             : #include "nsCOMPtr.h"
       3             : #include "nsURLHelper.h"
       4             : 
       5             : #ifndef MOZ_RUST_URLPARSE
       6             :   #error "Should be defined"
       7             : #endif
       8             : 
       9             : using namespace mozilla::ipc;
      10             : 
      11             : namespace mozilla {
      12             : namespace net {
      13             : 
      14           0 : NS_IMPL_ADDREF(RustURL)
      15           0 : NS_IMPL_RELEASE(RustURL)
      16             : 
      17           0 : NS_INTERFACE_MAP_BEGIN(RustURL)
      18           0 :   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStandardURL)
      19           0 :   NS_INTERFACE_MAP_ENTRY(nsIURI)
      20           0 :   NS_INTERFACE_MAP_ENTRY(nsIURL)
      21             :   // NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFileURL, mSupportsFileURL)
      22           0 :   NS_INTERFACE_MAP_ENTRY(nsIStandardURL)
      23             :   // NS_INTERFACE_MAP_ENTRY(nsISerializable)
      24           0 :   NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
      25           0 :   NS_INTERFACE_MAP_ENTRY(nsIMutable)
      26             :   // NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI)
      27             :   // NS_INTERFACE_MAP_ENTRY(nsISensitiveInfoHiddenURI)
      28           0 :   NS_INTERFACE_MAP_ENTRY(nsISizeOf)
      29           0 : NS_INTERFACE_MAP_END
      30             : 
      31             : #define ENSURE_MUTABLE() \
      32             :   PR_BEGIN_MACRO \
      33             :     if (!mMutable) { \
      34             :       NS_WARNING("attempt to modify an immutable RustURL"); \
      35             :       return NS_ERROR_ABORT; \
      36             :     } \
      37             :   PR_END_MACRO
      38             : 
      39           0 : RustURL::RustURL()
      40           0 :   : mMutable(true)
      41             : {
      42             : 
      43           0 : }
      44             : 
      45           0 : RustURL::~RustURL()
      46             : {
      47             : 
      48           0 : }
      49             : 
      50             : NS_IMETHODIMP
      51           0 : RustURL::GetSpec(nsACString & aSpec)
      52             : {
      53           0 :   return rusturl_get_spec(mURL.get(), &aSpec);
      54             : }
      55             : 
      56             : NS_IMETHODIMP
      57           0 : RustURL::SetSpec(const nsACString & aSpec)
      58             : {
      59           0 :   ENSURE_MUTABLE();
      60             : 
      61           0 :   rusturl* ptr = rusturl_new(&aSpec);
      62           0 :   if (!ptr) {
      63           0 :     return NS_ERROR_FAILURE;
      64             :   }
      65           0 :   mURL.reset(ptr);
      66           0 :   return NS_OK;
      67             : }
      68             : 
      69             : NS_IMETHODIMP
      70           0 : RustURL::GetPrePath(nsACString & aPrePath)
      71             : {
      72             :   // TODO: use slicing API to get actual prepath
      73           0 :   aPrePath.Truncate();
      74           0 :   nsAutoCString rustResult;
      75           0 :   nsAutoCString part;
      76             : 
      77           0 :   nsresult rv = GetScheme(part);
      78           0 :   if (NS_FAILED(rv)) {
      79           0 :     return rv;
      80             :   }
      81           0 :   rustResult.Append(part);
      82           0 :   rustResult += "://";
      83             : 
      84           0 :   rv = GetUserPass(part);
      85           0 :   if (NS_FAILED(rv)) {
      86           0 :     return rv;
      87             :   }
      88           0 :   if (!part.IsEmpty()) {
      89           0 :     rustResult += part;
      90           0 :     rustResult += "@";
      91             :   }
      92             : 
      93           0 :   rv = GetHostPort(part);
      94           0 :   if (NS_FAILED(rv)) {
      95           0 :     return rv;
      96             :   }
      97             : 
      98           0 :   rustResult += part;
      99           0 :   aPrePath.Assign(rustResult);
     100           0 :   return NS_OK;
     101             : }
     102             : 
     103             : NS_IMETHODIMP
     104           0 : RustURL::GetScheme(nsACString & aScheme)
     105             : {
     106           0 :   return rusturl_get_scheme(mURL.get(), &aScheme);
     107             : }
     108             : 
     109             : NS_IMETHODIMP
     110           0 : RustURL::SetScheme(const nsACString & aScheme)
     111             : {
     112           0 :   ENSURE_MUTABLE();
     113             : 
     114           0 :   return rusturl_set_scheme(mURL.get(), &aScheme);
     115             : }
     116             : 
     117             : NS_IMETHODIMP
     118           0 : RustURL::GetUserPass(nsACString & aUserPass)
     119             : {
     120           0 :   nsresult rv = GetUsername(aUserPass);
     121           0 :   if (NS_FAILED(rv)) {
     122           0 :     aUserPass.Truncate();
     123           0 :     return rv;
     124             :   }
     125             : 
     126           0 :   nsAutoCString password;
     127           0 :   rv = GetPassword(password);
     128           0 :   if (NS_FAILED(rv)) {
     129           0 :     aUserPass.Truncate();
     130           0 :     return rv;
     131             :   }
     132             : 
     133           0 :   if (password.Length()) {
     134           0 :     aUserPass.Append(':');
     135           0 :     aUserPass.Append(password);
     136             :   }
     137           0 :   return NS_OK;
     138             : }
     139             : 
     140             : NS_IMETHODIMP
     141           0 : RustURL::SetUserPass(const nsACString & aUserPass)
     142             : {
     143           0 :   ENSURE_MUTABLE();
     144             : 
     145           0 :   int32_t colonPos = aUserPass.FindChar(':');
     146           0 :   nsAutoCString user;
     147           0 :   nsAutoCString pass;
     148           0 :   if (colonPos == kNotFound) {
     149           0 :     user = aUserPass;
     150             :   } else {
     151           0 :     user = Substring(aUserPass, 0, colonPos);
     152           0 :     pass = Substring(aUserPass, colonPos + 1, aUserPass.Length());
     153             :   }
     154             : 
     155           0 :   nsresult rv = rusturl_set_username(mURL.get(), &user);
     156           0 :   if (NS_WARN_IF(NS_FAILED(rv))) {
     157           0 :     return rv;
     158             :   }
     159             : 
     160           0 :   return rusturl_set_password(mURL.get(), &pass);
     161             : }
     162             : 
     163             : NS_IMETHODIMP
     164           0 : RustURL::GetUsername(nsACString & aUsername)
     165             : {
     166           0 :   return rusturl_get_username(mURL.get(), &aUsername);
     167             : }
     168             : 
     169             : NS_IMETHODIMP
     170           0 : RustURL::SetUsername(const nsACString & aUsername)
     171             : {
     172           0 :   ENSURE_MUTABLE();
     173           0 :   return rusturl_set_username(mURL.get(), &aUsername);
     174             : }
     175             : 
     176             : NS_IMETHODIMP
     177           0 : RustURL::GetPassword(nsACString & aPassword)
     178             : {
     179           0 :   return rusturl_get_password(mURL.get(), &aPassword);
     180             : }
     181             : 
     182             : NS_IMETHODIMP
     183           0 : RustURL::SetPassword(const nsACString & aPassword)
     184             : {
     185           0 :   ENSURE_MUTABLE();
     186           0 :   return rusturl_set_password(mURL.get(), &aPassword);
     187             : }
     188             : 
     189             : NS_IMETHODIMP
     190           0 : RustURL::GetHostPort(nsACString & aHostPort)
     191             : {
     192           0 :   nsresult rv = rusturl_get_host(mURL.get(), &aHostPort);
     193           0 :   if (NS_FAILED(rv)) {
     194           0 :     return rv;
     195             :   }
     196             : 
     197             :   int32_t port;
     198           0 :   rv = GetPort(&port);
     199           0 :   if (NS_FAILED(rv)) {
     200           0 :     return rv;
     201             :   }
     202           0 :   if (port >= 0) {
     203           0 :     aHostPort.Append(':');
     204           0 :     aHostPort.AppendInt(port);
     205             :   }
     206             : 
     207           0 :   return NS_OK;
     208             : }
     209             : 
     210             : NS_IMETHODIMP
     211           0 : RustURL::SetHostPort(const nsACString & aHostPort)
     212             : {
     213           0 :   ENSURE_MUTABLE();
     214           0 :   return rusturl_set_host_port(mURL.get(), &aHostPort);
     215             : }
     216             : 
     217             : NS_IMETHODIMP
     218           0 : RustURL::SetHostAndPort(const nsACString & hostport)
     219             : {
     220           0 :   ENSURE_MUTABLE();
     221           0 :   return rusturl_set_host_and_port(mURL.get(), &hostport);
     222             : }
     223             : 
     224             : NS_IMETHODIMP
     225           0 : RustURL::GetHost(nsACString & aHost)
     226             : {
     227           0 :   nsAutoCString host;
     228           0 :   nsresult rv = rusturl_get_host(mURL.get(), &host);
     229           0 :   if (NS_FAILED(rv)) {
     230           0 :     return rv;
     231             :   }
     232             : 
     233           0 :   if (host.Length() > 0 && host.First() == '[' && host.Last() == ']') {
     234           0 :     aHost = Substring(host, 1, host.Length() - 2);
     235           0 :     return NS_OK;
     236             :   }
     237             : 
     238           0 :   aHost = host;
     239           0 :   return NS_OK;
     240             : }
     241             : 
     242             : NS_IMETHODIMP
     243           0 : RustURL::SetHost(const nsACString & aHost)
     244             : {
     245           0 :   ENSURE_MUTABLE();
     246           0 :   return rusturl_set_host(mURL.get(), &aHost);
     247             : }
     248             : 
     249             : NS_IMETHODIMP
     250           0 : RustURL::GetPort(int32_t *aPort)
     251             : {
     252           0 :   if (!mURL) {
     253           0 :     return NS_ERROR_FAILURE;
     254             :   }
     255           0 :   *aPort = 0;
     256           0 :   return rusturl_get_port(mURL.get(), aPort);
     257             : }
     258             : 
     259             : NS_IMETHODIMP
     260           0 : RustURL::SetPort(int32_t aPort)
     261             : {
     262           0 :   ENSURE_MUTABLE();
     263           0 :   return rusturl_set_port_no(mURL.get(), aPort);
     264             : }
     265             : 
     266             : NS_IMETHODIMP
     267           0 : RustURL::GetPath(nsACString & aPath)
     268             : {
     269           0 :   return rusturl_get_path(mURL.get(), &aPath);
     270             : }
     271             : 
     272             : NS_IMETHODIMP
     273           0 : RustURL::SetPath(const nsACString & aPath)
     274             : {
     275           0 :   ENSURE_MUTABLE();
     276             : 
     277           0 :   nsAutoCString path;
     278           0 :   nsresult rv = GetPrePath(path);
     279           0 :   if (NS_FAILED(rv)) {
     280           0 :     return rv;
     281             :   }
     282             : 
     283           0 :   if (aPath.Length() > 0 && aPath.First() != '/') {
     284           0 :     path.Append('/');
     285             :   }
     286           0 :   path.Append(aPath);
     287             : 
     288           0 :   return SetSpec(path);
     289             : }
     290             : 
     291             : NS_IMETHODIMP
     292           0 : RustURL::Equals(nsIURI *other, bool *aRetVal)
     293             : {
     294           0 :   *aRetVal = false;
     295           0 :   nsAutoCString spec;
     296           0 :   nsresult rv = other->GetSpec(spec);
     297           0 :   if (NS_FAILED(rv)) {
     298           0 :     return rv;
     299             :   }
     300           0 :   nsAutoCString rustSpec;
     301           0 :   rv = GetSpec(rustSpec);
     302           0 :   if (NS_FAILED(rv)) {
     303           0 :     return rv;
     304             :   }
     305           0 :   if (rustSpec == spec) {
     306           0 :     *aRetVal = true;
     307             :   }
     308           0 :   return NS_OK;
     309             : }
     310             : 
     311             : NS_IMETHODIMP
     312           0 : RustURL::SchemeIs(const char * aScheme, bool *aRetVal)
     313             : {
     314           0 :   *aRetVal = false;
     315           0 :   nsAutoCString scheme;
     316           0 :   nsresult rv = GetScheme(scheme);
     317           0 :   if (NS_FAILED(rv)) {
     318           0 :     return rv;
     319             :   }
     320           0 :   if (scheme.Equals(aScheme, nsCaseInsensitiveCStringComparator())) {
     321           0 :     *aRetVal = true;
     322             :   }
     323           0 :   return NS_OK;
     324             : }
     325             : 
     326             : NS_IMETHODIMP
     327           0 : RustURL::Clone(nsIURI * *aRetVal)
     328             : {
     329           0 :   RefPtr<RustURL> url = new RustURL();
     330           0 :   nsAutoCString spec;
     331           0 :   nsresult rv = GetSpec(spec);
     332           0 :   if (NS_FAILED(rv)) {
     333           0 :     return rv;
     334             :   }
     335           0 :   rv = url->SetSpec(spec);
     336           0 :   if (NS_FAILED(rv)) {
     337           0 :     return rv;
     338             :   }
     339           0 :   url.forget(aRetVal);
     340           0 :   return NS_OK;
     341             : }
     342             : 
     343             : NS_IMETHODIMP
     344           0 : RustURL::Resolve(const nsACString & relativePath, nsACString & aRetVal)
     345             : {
     346           0 :   return rusturl_resolve(mURL.get(), &relativePath, &aRetVal);
     347             : }
     348             : 
     349             : NS_IMETHODIMP
     350           0 : RustURL::GetAsciiSpec(nsACString & aAsciiSpec)
     351             : {
     352           0 :   return GetSpec(aAsciiSpec);
     353             : }
     354             : 
     355             : NS_IMETHODIMP
     356           0 : RustURL::GetAsciiHostPort(nsACString & aAsciiHostPort)
     357             : {
     358           0 :   return GetHostPort(aAsciiHostPort);
     359             : }
     360             : 
     361             : NS_IMETHODIMP
     362           0 : RustURL::GetAsciiHost(nsACString & aAsciiHost)
     363             : {
     364           0 :   return GetHost(aAsciiHost);
     365             : }
     366             : 
     367             : NS_IMETHODIMP
     368           0 : RustURL::GetOriginCharset(nsACString & aOriginCharset)
     369             : {
     370           0 :   aOriginCharset.AssignLiteral("UTF-8");
     371           0 :   return NS_OK;
     372             : }
     373             : 
     374             : NS_IMETHODIMP
     375           0 : RustURL::GetRef(nsACString & aRef)
     376             : {
     377           0 :   return rusturl_get_fragment(mURL.get(), &aRef);
     378             : }
     379             : 
     380             : NS_IMETHODIMP
     381           0 : RustURL::SetRef(const nsACString & aRef)
     382             : {
     383           0 :   ENSURE_MUTABLE();
     384           0 :   return rusturl_set_fragment(mURL.get(), &aRef);
     385             : }
     386             : 
     387             : NS_IMETHODIMP
     388           0 : RustURL::EqualsExceptRef(nsIURI *other, bool *_retval)
     389             : {
     390           0 :   *_retval = false;
     391           0 :   nsAutoCString otherSpec;
     392           0 :   nsresult rv = other->GetSpecIgnoringRef(otherSpec);
     393           0 :   if (NS_FAILED(rv)) {
     394           0 :     return rv;
     395             :   }
     396           0 :   nsAutoCString thisSpec;
     397           0 :   rv = GetSpecIgnoringRef(thisSpec);
     398           0 :   if (NS_FAILED(rv)) {
     399           0 :     return rv;
     400             :   }
     401           0 :   if (thisSpec == otherSpec) {
     402           0 :     *_retval = true;
     403             :   }
     404           0 :   return NS_OK;
     405             : }
     406             : 
     407             : NS_IMETHODIMP
     408           0 : RustURL::CloneIgnoringRef(nsIURI * *_retval)
     409             : {
     410           0 :   return CloneWithNewRef(NS_LITERAL_CSTRING(""), _retval);
     411             : }
     412             : 
     413             : NS_IMETHODIMP
     414           0 : RustURL::CloneWithNewRef(const nsACString & newRef, nsIURI * *_retval)
     415             : {
     416           0 :   nsCOMPtr<nsIURI> uri;
     417           0 :   nsresult rv = Clone(getter_AddRefs(uri));
     418           0 :   if (NS_FAILED(rv)) {
     419           0 :     return rv;
     420             :   }
     421           0 :   rv = uri->SetRef(newRef);
     422           0 :   if (NS_FAILED(rv)) {
     423           0 :     return rv;
     424             :   }
     425           0 :   uri.forget(_retval);
     426           0 :   return NS_OK;
     427             : }
     428             : 
     429             : NS_IMETHODIMP
     430           0 : RustURL::GetSpecIgnoringRef(nsACString & aSpecIgnoringRef)
     431             : {
     432           0 :   nsresult rv = GetSpec(aSpecIgnoringRef);
     433           0 :   if (NS_FAILED(rv)) {
     434           0 :     return rv;
     435             :   }
     436           0 :   int32_t pos = aSpecIgnoringRef.FindChar('#');
     437           0 :   if (pos == kNotFound) {
     438           0 :     return NS_OK;
     439             :   }
     440             : 
     441           0 :   aSpecIgnoringRef.Truncate(pos);
     442           0 :   return NS_OK;
     443             : }
     444             : 
     445             : NS_IMETHODIMP
     446           0 : RustURL::GetDisplaySpec(nsACString &aUnicodeSpec)
     447             : {
     448           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     449             : }
     450             : 
     451             : NS_IMETHODIMP
     452           0 : RustURL::GetDisplayHostPort(nsACString &aUnicodeHostPort)
     453             : {
     454           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     455             : }
     456             : 
     457             : NS_IMETHODIMP
     458           0 : RustURL::GetDisplayHost(nsACString &aUnicodeHost)
     459             : {
     460           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     461             : }
     462             : 
     463             : NS_IMETHODIMP
     464           0 : RustURL::GetHasRef(bool *aHasRef)
     465             : {
     466           0 :   *aHasRef = false;
     467           0 :   return rusturl_has_fragment(mURL.get(), aHasRef);
     468             : }
     469             : 
     470             : /// nsIURL
     471             : 
     472             : NS_IMETHODIMP
     473           0 : RustURL::GetFilePath(nsACString & aFilePath)
     474             : {
     475           0 :   return rusturl_get_path(mURL.get(), &aFilePath);
     476             : }
     477             : 
     478             : NS_IMETHODIMP
     479           0 : RustURL::SetFilePath(const nsACString & aFilePath)
     480             : {
     481           0 :   ENSURE_MUTABLE();
     482           0 :   return rusturl_set_path(mURL.get(), &aFilePath);
     483             : }
     484             : 
     485             : NS_IMETHODIMP
     486           0 : RustURL::GetQuery(nsACString & aQuery)
     487             : {
     488           0 :   return rusturl_get_query(mURL.get(), &aQuery);
     489             : }
     490             : 
     491             : NS_IMETHODIMP
     492           0 : RustURL::SetQuery(const nsACString & aQuery)
     493             : {
     494           0 :   ENSURE_MUTABLE();
     495           0 :   return rusturl_set_query(mURL.get(), &aQuery);
     496             : }
     497             : 
     498             : NS_IMETHODIMP
     499           0 : RustURL::GetDirectory(nsACString & aDirectory)
     500             : {
     501           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     502             : }
     503             : 
     504             : NS_IMETHODIMP
     505           0 : RustURL::SetDirectory(const nsACString & aDirectory)
     506             : {
     507           0 :   ENSURE_MUTABLE();
     508           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     509             : }
     510             : 
     511             : NS_IMETHODIMP
     512           0 : RustURL::GetFileName(nsACString & aFileName)
     513             : {
     514           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     515             : }
     516             : 
     517             : NS_IMETHODIMP
     518           0 : RustURL::SetFileName(const nsACString & aFileName)
     519             : {
     520           0 :   ENSURE_MUTABLE();
     521           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     522             : }
     523             : 
     524             : NS_IMETHODIMP
     525           0 : RustURL::GetFileBaseName(nsACString & aFileBaseName)
     526             : {
     527           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     528             : }
     529             : 
     530             : NS_IMETHODIMP
     531           0 : RustURL::SetFileBaseName(const nsACString & aFileBaseName)
     532             : {
     533           0 :   ENSURE_MUTABLE();
     534           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     535             : }
     536             : 
     537             : NS_IMETHODIMP
     538           0 : RustURL::GetFileExtension(nsACString & aFileExtension)
     539             : {
     540           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     541             : }
     542             : 
     543             : NS_IMETHODIMP
     544           0 : RustURL::SetFileExtension(const nsACString & aFileExtension)
     545             : {
     546           0 :   ENSURE_MUTABLE();
     547           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     548             : }
     549             : 
     550             : NS_IMETHODIMP
     551           0 : RustURL::GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval)
     552             : {
     553           0 :   RefPtr<RustURL> url = new RustURL();
     554           0 :   nsAutoCString spec;
     555           0 :   nsresult rv = aURIToCompare->GetSpec(spec);
     556           0 :   if (NS_FAILED(rv)) {
     557           0 :     return rv;
     558             :   }
     559           0 :   rv = url->SetSpec(spec);
     560           0 :   if (NS_FAILED(rv)) {
     561           0 :     return rv;
     562             :   }
     563           0 :   return rusturl_common_base_spec(mURL.get(), url->mURL.get(), &_retval);
     564             : }
     565             : 
     566             : NS_IMETHODIMP
     567           0 : RustURL::GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval)
     568             : {
     569           0 :   RefPtr<RustURL> url = new RustURL();
     570           0 :   nsAutoCString spec;
     571           0 :   nsresult rv = aURIToCompare->GetSpec(spec);
     572           0 :   if (NS_FAILED(rv)) {
     573           0 :     return rv;
     574             :   }
     575           0 :   rv = url->SetSpec(spec);
     576           0 :   if (NS_FAILED(rv)) {
     577           0 :     return rv;
     578             :   }
     579             : 
     580           0 :   return rusturl_relative_spec(mURL.get(), url->mURL.get(), &_retval);
     581             : }
     582             : 
     583             : // nsIFileURL
     584             : 
     585             : 
     586             : NS_IMETHODIMP
     587           0 : RustURL::GetFile(nsIFile * *aFile)
     588             : {
     589           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     590             : }
     591             : 
     592             : NS_IMETHODIMP
     593           0 : RustURL::SetFile(nsIFile *aFile)
     594             : {
     595           0 :   ENSURE_MUTABLE();
     596           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     597             : }
     598             : 
     599             : // nsIStandardURL
     600             : 
     601             : NS_IMETHODIMP
     602           0 : RustURL::Init(uint32_t aUrlType, int32_t aDefaultPort, const nsACString & aSpec,
     603             :               const char * aOriginCharset, nsIURI *aBaseURI)
     604             : {
     605           0 :   ENSURE_MUTABLE();
     606             : 
     607           0 :   if (aBaseURI && net_IsAbsoluteURL(aSpec)) {
     608           0 :     aBaseURI = nullptr;
     609             :   }
     610             : 
     611           0 :   if (!aBaseURI) {
     612           0 :     return SetSpec(aSpec);
     613             :   }
     614             : 
     615           0 :   nsAutoCString buf;
     616           0 :   nsresult rv = aBaseURI->Resolve(aSpec, buf);
     617           0 :   if (NS_FAILED(rv)) {
     618           0 :     return rv;
     619             :   }
     620             : 
     621           0 :   return SetSpec(buf);
     622             : }
     623             : 
     624             : NS_IMETHODIMP
     625           0 : RustURL::SetDefaultPort(int32_t aNewDefaultPort)
     626             : {
     627           0 :   ENSURE_MUTABLE();
     628           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     629             : }
     630             : 
     631             : // nsISerializable
     632             : 
     633             : NS_IMETHODIMP
     634           0 : RustURL::Read(nsIObjectInputStream *aInputStream)
     635             : {
     636           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     637             : }
     638             : 
     639             : NS_IMETHODIMP
     640           0 : RustURL::Write(nsIObjectOutputStream *aOutputStream)
     641             : {
     642           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     643             : }
     644             : 
     645             : void
     646           0 : RustURL::Serialize(URIParams& aParams)
     647             : {
     648             :   // TODO
     649           0 : }
     650             : 
     651             : bool
     652           0 : RustURL::Deserialize(const URIParams& aParams)
     653             : {
     654             :   // TODO
     655           0 :   return false;
     656             : }
     657             : 
     658             : // nsIClassInfo
     659             : 
     660             : NS_IMETHODIMP
     661           0 : RustURL::GetInterfaces(uint32_t *count, nsIID ***array)
     662             : {
     663           0 :   *count = 0;
     664           0 :   *array = nullptr;
     665           0 :   return NS_OK;
     666             : }
     667             : 
     668             : NS_IMETHODIMP
     669           0 : RustURL::GetScriptableHelper(nsIXPCScriptable * *_retval)
     670             : {
     671           0 :   *_retval = nullptr;
     672           0 :   return NS_OK;
     673             : }
     674             : 
     675             : NS_IMETHODIMP
     676           0 : RustURL::GetContractID(char * *aContractID)
     677             : {
     678           0 :   *aContractID = nullptr;
     679           0 :   return NS_OK;
     680             : }
     681             : 
     682             : NS_IMETHODIMP
     683           0 : RustURL::GetClassDescription(char * *aClassDescription)
     684             : {
     685           0 :   *aClassDescription = nullptr;
     686           0 :   return NS_OK;
     687             : }
     688             : 
     689             : NS_IMETHODIMP
     690           0 : RustURL::GetClassID(nsCID **aClassID)
     691             : {
     692           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     693             : }
     694             : 
     695             : NS_IMETHODIMP
     696           0 : RustURL::GetFlags(uint32_t *aFlags)
     697             : {
     698           0 :   *aFlags = nsIClassInfo::MAIN_THREAD_ONLY;
     699           0 :   return NS_OK;
     700             : }
     701             : 
     702             : NS_IMETHODIMP
     703           0 : RustURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
     704             : {
     705           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     706             : }
     707             : 
     708             : /// nsIMutable
     709             : 
     710             : NS_IMETHODIMP
     711           0 : RustURL::GetMutable(bool *aValue)
     712             : {
     713           0 :   *aValue = mMutable;
     714           0 :   return NS_OK;
     715             : }
     716             : 
     717             : NS_IMETHODIMP
     718           0 : RustURL::SetMutable(bool aValue)
     719             : {
     720           0 :   if (mMutable || !aValue) {
     721           0 :     return NS_ERROR_FAILURE;
     722             :   }
     723           0 :   mMutable = aValue;
     724           0 :   return NS_OK;
     725             : }
     726             : 
     727             : // nsISensitiveInfoHiddenURI
     728             : 
     729             : NS_IMETHODIMP
     730           0 : RustURL::GetSensitiveInfoHiddenSpec(nsACString & _retval)
     731             : {
     732           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     733             : }
     734             : 
     735             : // nsISizeOf
     736             : 
     737             : size_t
     738           0 : RustURL::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
     739             : {
     740           0 :   return mURL.get() ? sizeof_rusturl() : 0;
     741             : }
     742             : 
     743             : size_t
     744           0 : RustURL::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
     745             : {
     746           0 :   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
     747             : }
     748             : 
     749             : } // namespace net
     750             : } // namespace mozilla
     751             : 

Generated by: LCOV version 1.13