Implement "cookie-averse document objects".

See: https://html.spec.whatwg.org/multipage/dom.html#cookie-averse-document-object
This resolves #196.
This commit is contained in:
wolfbeast 2017-11-20 14:20:39 +01:00 committed by Roy Tam
commit 3df0152d88
3 changed files with 43 additions and 0 deletions

View file

@ -305,6 +305,11 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
mDocument->SetHeaderData(aHeader, aValue);
if (aHeader == nsGkAtoms::setcookie) {
// Don't allow setting cookies in cookie-averse documents.
if (mDocument->IsCookieAverse()) {
return NS_OK;
}
// Note: Necko already handles cookies set via the channel. We can't just
// call SetCookie on the channel because we want to do some security checks
// here.