From 85083fce2da7a270e324fd951b7f3d03a50aef1b Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 20 Nov 2017 14:20:39 +0100 Subject: Implement "cookie-averse document objects". See: https://html.spec.whatwg.org/multipage/dom.html#cookie-averse-document-object This resolves #196. --- dom/html/nsHTMLDocument.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dom/html') diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index 5e6302941..7d66aab04 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1255,6 +1255,11 @@ nsHTMLDocument::GetCookie(nsAString& aCookie, ErrorResult& rv) rv.Throw(NS_ERROR_DOM_SECURITY_ERR); return; } + + // If the document is a cookie-averse document, return an empty string. + if (IsCookieAverse()) { + return; + } // not having a cookie service isn't an error nsCOMPtr service = do_GetService(NS_COOKIESERVICE_CONTRACTID); @@ -1310,6 +1315,11 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie, ErrorResult& rv) return; } + // If the document is a cookie-averse document, do nothing. + if (IsCookieAverse()) { + return; + } + // not having a cookie service isn't an error nsCOMPtr service = do_GetService(NS_COOKIESERVICE_CONTRACTID); if (service && mDocumentURI) { -- cgit v1.2.3