| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 9abe48baba00b2f629cdbe1758e65f34139e8011..050ff22c2518762c99e73697c9881e7b1a4322a7 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -3644,7 +3644,13 @@ String Document::cookie(ExceptionState& es) const
|
| // browsing context.
|
|
|
| if (!securityOrigin()->canAccessCookies()) {
|
| - es.throwDOMException(SecurityError);
|
| + String accessDeniedMessage = "Access to 'cookie' is denied for this document.";
|
| + if (isSandboxed(SandboxOrigin))
|
| + es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
|
| + else if (url().protocolIs("data"))
|
| + es.throwSecurityError(accessDeniedMessage + " Cookies are disabled inside 'data:' URLs.");
|
| + else
|
| + es.throwSecurityError(accessDeniedMessage);
|
| return String();
|
| }
|
|
|
| @@ -3665,7 +3671,13 @@ void Document::setCookie(const String& value, ExceptionState& es)
|
| // browsing context.
|
|
|
| if (!securityOrigin()->canAccessCookies()) {
|
| - es.throwDOMException(SecurityError);
|
| + String accessDeniedMessage = "Access to 'cookie' is denied for this document.";
|
| + if (isSandboxed(SandboxOrigin))
|
| + es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
|
| + else if (url().protocolIs("data"))
|
| + es.throwSecurityError(accessDeniedMessage + " Cookies are disabled inside 'data:' URLs.");
|
| + else
|
| + es.throwSecurityError(accessDeniedMessage);
|
| return;
|
| }
|
|
|
|
|