Bug 1228950 - Disallow scheme sets on nsHostObjectURI. r=bz

This commit is contained in:
Bobby Holley 2015-12-01 22:06:55 -08:00
parent 952f898e0a
commit 4360860a8d
2 changed files with 11 additions and 0 deletions

View File

@ -135,6 +135,15 @@ nsHostObjectURI::Deserialize(const mozilla::ipc::URIParams& aParams)
return mPrincipal != nullptr;
}
NS_IMETHODIMP
nsHostObjectURI::SetScheme(const nsACString& aScheme)
{
// Disallow setting the scheme, since that could cause us to be associated
// with a different protocol handler that doesn't expect us to be carrying
// around a principal with nsIURIWithPrincipal.
return NS_ERROR_FAILURE;
}
// nsIURI methods:
nsresult
nsHostObjectURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode,

View File

@ -38,6 +38,8 @@ public:
NS_DECL_NSICLASSINFO
NS_DECL_NSIIPCSERIALIZABLEURI
NS_IMETHOD SetScheme(const nsACString &aProtocol) override;
// Override CloneInternal() and EqualsInternal()
virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
nsIURI** aClone) override;