OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/storage/DOMWindowStorage.h" | 5 #include "modules/storage/DOMWindowStorage.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameHost.h" | |
9 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
10 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
11 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
12 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
13 #include "modules/storage/Storage.h" | 12 #include "modules/storage/Storage.h" |
14 #include "modules/storage/StorageNamespace.h" | 13 #include "modules/storage/StorageNamespace.h" |
15 #include "modules/storage/StorageNamespaceController.h" | 14 #include "modules/storage/StorageNamespaceController.h" |
16 #include "wtf/PassRefPtr.h" | 15 #include "wtf/PassRefPtr.h" |
17 | 16 |
18 namespace blink { | 17 namespace blink { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return nullptr; | 116 return nullptr; |
118 } | 117 } |
119 if (m_localStorage) { | 118 if (m_localStorage) { |
120 if (!m_localStorage->area()->canAccessStorage(document->frame())) { | 119 if (!m_localStorage->area()->canAccessStorage(document->frame())) { |
121 exceptionState.throwSecurityError(accessDeniedMessage); | 120 exceptionState.throwSecurityError(accessDeniedMessage); |
122 return nullptr; | 121 return nullptr; |
123 } | 122 } |
124 return m_localStorage; | 123 return m_localStorage; |
125 } | 124 } |
126 // FIXME: Seems this check should be much higher? | 125 // FIXME: Seems this check should be much higher? |
127 FrameHost* host = document->frameHost(); | 126 Page* page = document->page(); |
128 if (!host || !host->settings().getLocalStorageEnabled()) | 127 if (!page || !page->settings().getLocalStorageEnabled()) |
129 return nullptr; | 128 return nullptr; |
130 StorageArea* storageArea = | 129 StorageArea* storageArea = |
131 StorageNamespace::localStorageArea(document->getSecurityOrigin()); | 130 StorageNamespace::localStorageArea(document->getSecurityOrigin()); |
132 if (!storageArea->canAccessStorage(document->frame())) { | 131 if (!storageArea->canAccessStorage(document->frame())) { |
133 exceptionState.throwSecurityError(accessDeniedMessage); | 132 exceptionState.throwSecurityError(accessDeniedMessage); |
134 return nullptr; | 133 return nullptr; |
135 } | 134 } |
136 m_localStorage = Storage::create(document->frame(), storageArea); | 135 m_localStorage = Storage::create(document->frame(), storageArea); |
137 return m_localStorage; | 136 return m_localStorage; |
138 } | 137 } |
139 | 138 |
140 } // namespace blink | 139 } // namespace blink |
OLD | NEW |