Bug 1599801 - NullPrincipal::Init is infallible. r=bzbarsky

I also cleaned up the comment a bit.

Differential Revision: https://phabricator.services.mozilla.com/D54970

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-11-27 20:17:46 +00:00
Родитель b199ff482d
Коммит 817696d634
2 изменённых файлов: 7 добавлений и 10 удалений

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

@ -54,8 +54,7 @@ already_AddRefed<NullPrincipal> NullPrincipal::CreateWithInheritedAttributes(
already_AddRefed<NullPrincipal> NullPrincipal::CreateWithInheritedAttributes(
const OriginAttributes& aOriginAttributes, bool aIsFirstParty) {
RefPtr<NullPrincipal> nullPrin = new NullPrincipal();
nsresult rv = nullPrin->Init(aOriginAttributes, aIsFirstParty);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
nullPrin->Init(aOriginAttributes, aIsFirstParty);
return nullPrin.forget();
}
@ -98,8 +97,8 @@ nsresult NullPrincipal::Init(const OriginAttributes& aOriginAttributes,
return NS_OK;
}
nsresult NullPrincipal::Init(const OriginAttributes& aOriginAttributes,
bool aIsFirstParty) {
void NullPrincipal::Init(const OriginAttributes& aOriginAttributes,
bool aIsFirstParty) {
mURI = new NullPrincipalURI();
nsAutoCString originNoSuffix;
@ -119,8 +118,6 @@ nsresult NullPrincipal::Init(const OriginAttributes& aOriginAttributes,
}
FinishInit(originNoSuffix, attrs);
return NS_OK;
}
nsresult NullPrincipal::GetScriptLocation(nsACString& aStr) {

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

@ -112,11 +112,11 @@ class NullPrincipal final : public BasePrincipal {
nsCOMPtr<nsIURI> mURI;
private:
// If aIsFirstParty is true, this NullPrincipal will be initialized base on
// the aOriginAttributes with FirstPartyDomain set to an unique value, and
// this value is generated from mURI.path, with ".mozilla" appending at the
// If aIsFirstParty is true, this NullPrincipal will be initialized based on
// the aOriginAttributes with FirstPartyDomain set to a unique value.
// This value is generated from mURI.path, with ".mozilla" appended at the
// end.
nsresult Init(const OriginAttributes& aOriginAttributes, bool aIsFirstParty);
void Init(const OriginAttributes& aOriginAttributes, bool aIsFirstParty);
};
} // namespace mozilla