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 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3675 | 3675 |
3676 HTMLFrameOwnerElement* Document::ownerElement() const | 3676 HTMLFrameOwnerElement* Document::ownerElement() const |
3677 { | 3677 { |
3678 if (!frame()) | 3678 if (!frame()) |
3679 return 0; | 3679 return 0; |
3680 return frame()->ownerElement(); | 3680 return frame()->ownerElement(); |
3681 } | 3681 } |
3682 | 3682 |
3683 String Document::cookie(ExceptionState& es) const | 3683 String Document::cookie(ExceptionState& es) const |
3684 { | 3684 { |
3685 if (page() && !page()->settings().cookieEnabled()) | 3685 if (settings() && !settings()->cookieEnabled()) |
3686 return String(); | 3686 return String(); |
3687 | 3687 |
3688 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 3688 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
3689 // InvalidStateError exception on getting if the Document has no | 3689 // InvalidStateError exception on getting if the Document has no |
3690 // browsing context. | 3690 // browsing context. |
3691 | 3691 |
3692 if (!securityOrigin()->canAccessCookies()) { | 3692 if (!securityOrigin()->canAccessCookies()) { |
3693 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; | 3693 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; |
3694 if (isSandboxed(SandboxOrigin)) | 3694 if (isSandboxed(SandboxOrigin)) |
3695 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); | 3695 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); |
3696 else if (url().protocolIs("data")) | 3696 else if (url().protocolIs("data")) |
3697 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i
nside 'data:' URLs."); | 3697 es.throwSecurityError(accessDeniedMessage + " Cookies are disabled i
nside 'data:' URLs."); |
3698 else | 3698 else |
3699 es.throwSecurityError(accessDeniedMessage); | 3699 es.throwSecurityError(accessDeniedMessage); |
3700 return String(); | 3700 return String(); |
3701 } | 3701 } |
3702 | 3702 |
3703 KURL cookieURL = this->cookieURL(); | 3703 KURL cookieURL = this->cookieURL(); |
3704 if (cookieURL.isEmpty()) | 3704 if (cookieURL.isEmpty()) |
3705 return String(); | 3705 return String(); |
3706 | 3706 |
3707 return cookies(this, cookieURL); | 3707 return cookies(this, cookieURL); |
3708 } | 3708 } |
3709 | 3709 |
3710 void Document::setCookie(const String& value, ExceptionState& es) | 3710 void Document::setCookie(const String& value, ExceptionState& es) |
3711 { | 3711 { |
3712 if (page() && !page()->settings().cookieEnabled()) | 3712 if (settings() && !settings()->cookieEnabled()) |
3713 return; | 3713 return; |
3714 | 3714 |
3715 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 3715 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
3716 // InvalidStateError exception on setting if the Document has no | 3716 // InvalidStateError exception on setting if the Document has no |
3717 // browsing context. | 3717 // browsing context. |
3718 | 3718 |
3719 if (!securityOrigin()->canAccessCookies()) { | 3719 if (!securityOrigin()->canAccessCookies()) { |
3720 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; | 3720 String accessDeniedMessage = "Access to 'cookie' is denied for this docu
ment."; |
3721 if (isSandboxed(SandboxOrigin)) | 3721 if (isSandboxed(SandboxOrigin)) |
3722 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); | 3722 es.throwSecurityError(accessDeniedMessage + " The document is sandbo
xed and lacks the 'allow-same-origin' flag."); |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 { | 5301 { |
5302 return DocumentLifecycleNotifier::create(this); | 5302 return DocumentLifecycleNotifier::create(this); |
5303 } | 5303 } |
5304 | 5304 |
5305 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5305 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5306 { | 5306 { |
5307 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5307 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
5308 } | 5308 } |
5309 | 5309 |
5310 } // namespace WebCore | 5310 } // namespace WebCore |
OLD | NEW |