Bug 1635094 - Cleanup the ReferrerInfo code. r=ckerschb
The cast in InitWithNode is wrong. AsElement() asserts instead of checking the flag, so we always pass an element (and if we didn't we'd have type confusion problems). I audited the callers and we're fine. Anyhow, always require an element, and add two convenience constructors for C++ code. Differential Revision: https://phabricator.services.mozilla.com/D73636
This commit is contained in:
@@ -6668,9 +6668,11 @@ void HTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel) {
|
||||
NS_LITERAL_CSTRING("Accept-Encoding"), EmptyCString(), false);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
// Set the Referer header
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo();
|
||||
referrerInfo->InitWithDocument(OwnerDoc());
|
||||
// Set the Referrer header
|
||||
//
|
||||
// FIXME: Shouldn't this use the Element constructor? Though I guess it
|
||||
// doesn't matter as no HTMLMediaElement supports the referrerinfo attribute.
|
||||
auto referrerInfo = MakeRefPtr<ReferrerInfo>(*OwnerDoc());
|
||||
rv = aChannel->SetReferrerInfoWithoutClone(referrerInfo);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user