Bug 1639247 - Isolate DNS cache per first-party when privacy.partition.network_state is set to true - part 1 - check the return value of GetUsername(), r=valentin,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D75984
This commit is contained in:
Andrea Marchesini 2020-05-20 15:25:30 +00:00
Родитель 449dbae8b1
Коммит ab5b80165e
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -10,6 +10,7 @@
#include "HttpLog.h"
#include "AltServiceChild.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/Unused.h"
#include "nsDNSPrefetch.h"
#include "nsEscape.h"
#include "nsHttpTransaction.h"
@ -303,12 +304,14 @@ nsresult TRRServiceChannel::BeginConnect() {
rv = mURI->GetScheme(scheme);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiHost(host);
if (NS_SUCCEEDED(rv)) rv = mURI->GetPort(&port);
if (NS_SUCCEEDED(rv)) mURI->GetUsername(mUsername);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiSpec(mSpec);
if (NS_FAILED(rv)) {
return rv;
}
// Just a warning here because some nsIURIs do not implement this method.
Unused << NS_WARN_IF(NS_FAILED(mURI->GetUsername(mUsername)));
// Reject the URL if it doesn't specify a host
if (host.IsEmpty()) {
rv = NS_ERROR_MALFORMED_URI;

Просмотреть файл

@ -6740,12 +6740,14 @@ nsresult nsHttpChannel::BeginConnect() {
rv = mURI->GetScheme(scheme);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiHost(host);
if (NS_SUCCEEDED(rv)) rv = mURI->GetPort(&port);
if (NS_SUCCEEDED(rv)) mURI->GetUsername(mUsername);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiSpec(mSpec);
if (NS_FAILED(rv)) {
return rv;
}
// Just a warning here because some nsIURIs do not implement this method.
Unused << NS_WARN_IF(NS_FAILED(mURI->GetUsername(mUsername)));
// Reject the URL if it doesn't specify a host
if (host.IsEmpty()) {
rv = NS_ERROR_MALFORMED_URI;