Bug 1433958 - Change code that uses nsIURI.setHostAndPort() to use nsIURIMutator r=mayhemer
* Removes setHostAndPort from nsIURIMutator as it only has one use * Instead, the consumer sets the port to -1 before calling setHostPort() MozReview-Commit-ID: Jx9UMW440hq
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "nsDOMString.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURIMutator.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPrivateBrowsingChannel.h"
|
||||
@@ -926,24 +927,17 @@ nsHTMLDocument::CreateInheritingURIForHost(const nsACString& aHostString)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
nsresult rv = uri->Clone(getter_AddRefs(newURI));
|
||||
nsresult rv;
|
||||
rv = NS_MutateURI(uri)
|
||||
.SetUserPass(EmptyCString())
|
||||
.SetPort(-1) // we want to reset the port number if needed.
|
||||
.SetHostPort(aHostString)
|
||||
.Finalize(uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rv = newURI->SetUserPass(EmptyCString());
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We use SetHostAndPort because we want to reset the port number if needed.
|
||||
rv = newURI->SetHostAndPort(aHostString);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newURI.forget();
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
|
||||
Reference in New Issue
Block a user