| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 3679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3690 | 3690 |
| 3691 HTMLFrameOwnerElement* Document::ownerElement() const | 3691 HTMLFrameOwnerElement* Document::ownerElement() const |
| 3692 { | 3692 { |
| 3693 if (!frame()) | 3693 if (!frame()) |
| 3694 return 0; | 3694 return 0; |
| 3695 return frame()->ownerElement(); | 3695 return frame()->ownerElement(); |
| 3696 } | 3696 } |
| 3697 | 3697 |
| 3698 String Document::cookie(ExceptionState& es) const | 3698 String Document::cookie(ExceptionState& es) const |
| 3699 { | 3699 { |
| 3700 if (page() && !page()->settings().cookieEnabled()) | 3700 if (settings() && !settings()->cookieEnabled()) |
| 3701 return String(); | 3701 return String(); |
| 3702 | 3702 |
| 3703 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 3703 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
| 3704 // InvalidStateError exception on getting if the Document has no | 3704 // InvalidStateError exception on getting if the Document has no |
| 3705 // browsing context. | 3705 // browsing context. |
| 3706 | 3706 |
| 3707 if (!securityOrigin()->canAccessCookies()) { | 3707 if (!securityOrigin()->canAccessCookies()) { |
| 3708 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; | 3708 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; |
| 3709 if (isSandboxed(SandboxOrigin)) | 3709 if (isSandboxed(SandboxOrigin)) |
| 3710 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); | 3710 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); |
| 3711 else if (url().protocolIs("data")) | 3711 else if (url().protocolIs("data")) |
| 3712 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i
nside 'data:' URLs."); | 3712 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i
nside 'data:' URLs."); |
| 3713 else | 3713 else |
| 3714 es.throwSecurityError(accessDeniedMessage); | 3714 es.throwSecurityError(accessDeniedMessage); |
| 3715 return String(); | 3715 return String(); |
| 3716 } | 3716 } |
| 3717 | 3717 |
| 3718 KURL cookieURL = this->cookieURL(); | 3718 KURL cookieURL = this->cookieURL(); |
| 3719 if (cookieURL.isEmpty()) | 3719 if (cookieURL.isEmpty()) |
| 3720 return String(); | 3720 return String(); |
| 3721 | 3721 |
| 3722 return cookies(this, cookieURL); | 3722 return cookies(this, cookieURL); |
| 3723 } | 3723 } |
| 3724 | 3724 |
| 3725 void Document::setCookie(const String& value, ExceptionState& es) | 3725 void Document::setCookie(const String& value, ExceptionState& es) |
| 3726 { | 3726 { |
| 3727 if (page() && !page()->settings().cookieEnabled()) | 3727 if (settings() && !settings()->cookieEnabled()) |
| 3728 return; | 3728 return; |
| 3729 | 3729 |
| 3730 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 3730 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
| 3731 // InvalidStateError exception on setting if the Document has no | 3731 // InvalidStateError exception on setting if the Document has no |
| 3732 // browsing context. | 3732 // browsing context. |
| 3733 | 3733 |
| 3734 if (!securityOrigin()->canAccessCookies()) { | 3734 if (!securityOrigin()->canAccessCookies()) { |
| 3735 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; | 3735 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; |
| 3736 if (isSandboxed(SandboxOrigin)) | 3736 if (isSandboxed(SandboxOrigin)) |
| 3737 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); | 3737 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); |
| (...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5312 { | 5312 { |
| 5313 return DocumentLifecycleNotifier::create(this); | 5313 return DocumentLifecycleNotifier::create(this); |
| 5314 } | 5314 } |
| 5315 | 5315 |
| 5316 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5316 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
| 5317 { | 5317 { |
| 5318 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5318 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
| 5319 } | 5319 } |
| 5320 | 5320 |
| 5321 } // namespace WebCore | 5321 } // namespace WebCore |
| OLD | NEW |