Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp

Issue 2617703003: Remove ContextClient from DOMWindowStorage (Closed)
Patch Set: temp Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/storage/DOMWindowStorage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp
diff --git a/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp b/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp
index 24eca7cfa0cf9648294b05b9a8d57d8635c89226..979e61b987a5d984ce348dd2f33a28483fb8efab 100644
--- a/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp
+++ b/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp
@@ -18,14 +18,13 @@
namespace blink {
DOMWindowStorage::DOMWindowStorage(LocalDOMWindow& window)
- : ContextClient(window.frame()), m_window(&window) {}
+ : Supplement<LocalDOMWindow>(window) {}
DEFINE_TRACE(DOMWindowStorage) {
visitor->trace(m_window);
visitor->trace(m_sessionStorage);
visitor->trace(m_localStorage);
Supplement<LocalDOMWindow>::trace(visitor);
- ContextClient::trace(visitor);
}
// static
@@ -58,13 +57,11 @@ Storage* DOMWindowStorage::localStorage(DOMWindow& window,
Storage* DOMWindowStorage::sessionStorage(
ExceptionState& exceptionState) const {
- if (!m_window->isCurrentlyDisplayedInFrame())
haraken 2017/01/06 01:54:40 This is checking if the frame is detached. It can
- return nullptr;
-
- Document* document = m_window->document();
- if (!document)
+ if (!host()->frame())
return nullptr;
+ Document* document = host()->frame()->document();
+ DCHECK(document);
String accessDeniedMessage = "Access is denied for this document.";
if (!document->getSecurityOrigin()->canAccessLocalStorage()) {
if (document->isSandboxed(SandboxOrigin))
@@ -79,7 +76,7 @@ Storage* DOMWindowStorage::sessionStorage(
}
if (m_sessionStorage) {
- if (!m_sessionStorage->area()->canAccessStorage(m_window->frame())) {
+ if (!m_sessionStorage->area()->canAccessStorage(document->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
@@ -93,21 +90,21 @@ Storage* DOMWindowStorage::sessionStorage(
StorageArea* storageArea =
StorageNamespaceController::from(page)->sessionStorage()->storageArea(
document->getSecurityOrigin());
- if (!storageArea->canAccessStorage(m_window->frame())) {
+ if (!storageArea->canAccessStorage(document->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- m_sessionStorage = Storage::create(m_window->frame(), storageArea);
+ m_sessionStorage = Storage::create(document->frame(), storageArea);
return m_sessionStorage;
}
Storage* DOMWindowStorage::localStorage(ExceptionState& exceptionState) const {
- if (!m_window->isCurrentlyDisplayedInFrame())
haraken 2017/01/06 01:54:40 Ditto.
- return nullptr;
- Document* document = m_window->document();
- if (!document)
+ if (!host()->frame())
return nullptr;
+
+ Document* document = host()->frame()->document();
+ DCHECK(document);
String accessDeniedMessage = "Access is denied for this document.";
if (!document->getSecurityOrigin()->canAccessLocalStorage()) {
if (document->isSandboxed(SandboxOrigin))
@@ -133,11 +130,11 @@ Storage* DOMWindowStorage::localStorage(ExceptionState& exceptionState) const {
return nullptr;
StorageArea* storageArea =
StorageNamespace::localStorageArea(document->getSecurityOrigin());
- if (!storageArea->canAccessStorage(m_window->frame())) {
+ if (!storageArea->canAccessStorage(document->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- m_localStorage = Storage::create(m_window->frame(), storageArea);
+ m_localStorage = Storage::create(document->frame(), storageArea);
return m_localStorage;
}
« no previous file with comments | « third_party/WebKit/Source/modules/storage/DOMWindowStorage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698