Skip to content

Commit

Permalink
Bug 1599801 - NullPrincipal::Init is infallible. r=bzbarsky
Browse files Browse the repository at this point in the history
I also cleaned up the comment a bit.

Differential Revision: https://phabricator.services.mozilla.com/D54970
  • Loading branch information
amccreight committed Nov 27, 2019
1 parent d40329b commit 3aaeb30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions caps/NullPrincipal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand All @@ -119,8 +118,6 @@ nsresult NullPrincipal::Init(const OriginAttributes& aOriginAttributes,
}

FinishInit(originNoSuffix, attrs);

return NS_OK;
}

nsresult NullPrincipal::GetScriptLocation(nsACString& aStr) {
Expand Down
8 changes: 4 additions & 4 deletions caps/NullPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3aaeb30

Please sign in to comment.