OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 | 751 |
752 Storage* DOMWindow::sessionStorage(ExceptionState& exceptionState) const | 752 Storage* DOMWindow::sessionStorage(ExceptionState& exceptionState) const |
753 { | 753 { |
754 if (!isCurrentlyDisplayedInFrame()) | 754 if (!isCurrentlyDisplayedInFrame()) |
755 return 0; | 755 return 0; |
756 | 756 |
757 Document* document = this->document(); | 757 Document* document = this->document(); |
758 if (!document) | 758 if (!document) |
759 return 0; | 759 return 0; |
760 | 760 |
761 String accessDeniedMessage = "Access to 'sessionStorage' is denied for this
document."; | 761 String accessDeniedMessage = "Access is denied for this document."; |
762 if (!document->securityOrigin()->canAccessLocalStorage()) { | 762 if (!document->securityOrigin()->canAccessLocalStorage()) { |
763 if (document->isSandboxed(SandboxOrigin)) | 763 if (document->isSandboxed(SandboxOrigin)) |
764 exceptionState.throwSecurityError(accessDeniedMessage + " The docume
nt is sandboxed and lacks the 'allow-same-origin' flag."); | 764 exceptionState.throwSecurityError("The document is sandboxed and lac
ks the 'allow-same-origin' flag."); |
765 else if (document->url().protocolIs("data")) | 765 else if (document->url().protocolIs("data")) |
766 exceptionState.throwSecurityError(accessDeniedMessage + " Storage is
disabled inside 'data:' URLs."); | 766 exceptionState.throwSecurityError("Storage is disabled inside 'data:
' URLs."); |
767 else | 767 else |
768 exceptionState.throwSecurityError(accessDeniedMessage); | 768 exceptionState.throwSecurityError(accessDeniedMessage); |
769 return 0; | 769 return 0; |
770 } | 770 } |
771 | 771 |
772 if (m_sessionStorage) { | 772 if (m_sessionStorage) { |
773 if (!m_sessionStorage->area()->canAccessStorage(m_frame)) { | 773 if (!m_sessionStorage->area()->canAccessStorage(m_frame)) { |
774 exceptionState.throwSecurityError(accessDeniedMessage); | 774 exceptionState.throwSecurityError(accessDeniedMessage); |
775 return 0; | 775 return 0; |
776 } | 776 } |
(...skipping 16 matching lines...) Expand all Loading... |
793 | 793 |
794 Storage* DOMWindow::localStorage(ExceptionState& exceptionState) const | 794 Storage* DOMWindow::localStorage(ExceptionState& exceptionState) const |
795 { | 795 { |
796 if (!isCurrentlyDisplayedInFrame()) | 796 if (!isCurrentlyDisplayedInFrame()) |
797 return 0; | 797 return 0; |
798 | 798 |
799 Document* document = this->document(); | 799 Document* document = this->document(); |
800 if (!document) | 800 if (!document) |
801 return 0; | 801 return 0; |
802 | 802 |
803 String accessDeniedMessage = "Access to 'localStorage' is denied for this do
cument."; | 803 String accessDeniedMessage = "Access is denied for this document."; |
804 if (!document->securityOrigin()->canAccessLocalStorage()) { | 804 if (!document->securityOrigin()->canAccessLocalStorage()) { |
805 if (document->isSandboxed(SandboxOrigin)) | 805 if (document->isSandboxed(SandboxOrigin)) |
806 exceptionState.throwSecurityError(accessDeniedMessage + " The docume
nt is sandboxed and lacks the 'allow-same-origin' flag."); | 806 exceptionState.throwSecurityError("The document is sandboxed and lac
ks the 'allow-same-origin' flag."); |
807 else if (document->url().protocolIs("data")) | 807 else if (document->url().protocolIs("data")) |
808 exceptionState.throwSecurityError(accessDeniedMessage + " Storage is
disabled inside 'data:' URLs."); | 808 exceptionState.throwSecurityError("Storage is disabled inside 'data:
' URLs."); |
809 else | 809 else |
810 exceptionState.throwSecurityError(accessDeniedMessage); | 810 exceptionState.throwSecurityError(accessDeniedMessage); |
811 return 0; | 811 return 0; |
812 } | 812 } |
813 | 813 |
814 if (m_localStorage) { | 814 if (m_localStorage) { |
815 if (!m_localStorage->area()->canAccessStorage(m_frame)) { | 815 if (!m_localStorage->area()->canAccessStorage(m_frame)) { |
816 exceptionState.throwSecurityError(accessDeniedMessage); | 816 exceptionState.throwSecurityError(accessDeniedMessage); |
817 return 0; | 817 return 0; |
818 } | 818 } |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); | 1877 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); |
1878 } | 1878 } |
1879 | 1879 |
1880 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() | 1880 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() |
1881 { | 1881 { |
1882 return DOMWindowLifecycleNotifier::create(this); | 1882 return DOMWindowLifecycleNotifier::create(this); |
1883 } | 1883 } |
1884 | 1884 |
1885 | 1885 |
1886 } // namespace WebCore | 1886 } // namespace WebCore |
OLD | NEW |